Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MBBSEmu SoftPatch Support #502

Merged
merged 9 commits into from
Dec 29, 2021
Merged

MBBSEmu SoftPatch Support #502

merged 9 commits into from
Dec 29, 2021

Conversation

enusbaum
Copy link
Member

@enusbaum enusbaum commented Oct 4, 2021

This PR adds support to MBBSEmu to "SoftPatch" modules, where modifications to modules can be loaded via config without having to apply changes directly to DLL files.

  • Added Patch option to the Module Configuration JSON Specification
  • Supported patch types are Hex (string of Hex Codes to be patched in) and Text (string to be patched in directly)
  • Changed Module JSON Loading to straight JSON Deserialization using System.Text.Json (versus loading it as a configuration file via System.Configuration)
  • Added Unit Tests for new Module Configuration Loading + New JSON Converters
  • Updated modules.json that is included to reflect how to apply a SoftPatch

Currently only AbsoluteOffset is supported, I'll add support for SEGMENT:OFFSET patches in another PR, but the properties are defined here.

This will allow for easy byte level patching of binaries without having to use a hex editor.

bitmoji

- Change `module.json` to load as JSON, not as an AppConfig
- Add Classes for Patching Objects
- Applying Absolute Offset Patching on Module Load
- Cast `ModuleEnabled` as nullable Bool
- Handle Nullable Bool when referencing `ModuleEnabled`
- Add new JsonBooleanConverter to handle various cases
- If `ModuleEnabled` is null (omitted from Module JSON), default to enabled `true`
- Had to handle Absolute File Patching prior to NE File Loader (which breads the raw data out into segments)
- Pass NE File Data into NE Loader vs. having it load in the constructor
@enusbaum enusbaum added the enhancement New feature or request label Oct 4, 2021
@enusbaum enusbaum requested a review from paladine October 4, 2021 00:39

public override void Write(Utf8JsonWriter writer, bool value, JsonSerializerOptions options)
{
switch (value)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

9 lines down to 1?
return writer.WriteStringValue(value ? "1" : "0");

@paladine paladine merged commit 024f351 into master Dec 29, 2021
@paladine paladine deleted the patcher branch December 29, 2021 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants