mon / BemaniPatcher

Web based DLL binary patcher
MIT License
211 stars 136 forks source link

Support HexPatch #320

Closed navaroli closed 1 year ago

navaroli commented 1 year ago

Enables direct manipulation of hex values in the binary. eg: changing hard-coded values or strings that may not necessarily be numerical.

mon commented 1 year ago

The implementation looks fine - do you have a good example of how this would be used? I can't really see what it provides over int patches or radios etc

navaroli commented 1 year ago

Sounds good! My usage isn't for a bemani game, but for megatouch arcade game. I'm porting over the console-based patching instructions here:

http://megatouch.arcade-cabinets.com/cracks/force-2011/cracking_walkthrough-2.shtml

These patches allow the arcade software to work without the physical security key (after storing its data on file). HexPatcher is relevant to "Step 11" on that page - you need to hard-code the 8-byte serial number of the security key into the binary (since the program cannot find the physical key and hard-codes a bogus one). This could be done with the int patcher instead, but that'd require a manual conversion step (hex is engraved on the key, not the int value) and is nicer to see the hex representation.

Not sure if this would have use for the bemani patches; no worries if we don't want to bloat the javascript with this, happy to use it locally!

mon commented 1 year ago

That's plenty good enough of a reason, nice!

I don't really like popping up an alert when the value is invalid - but considering the niche use, I can fix it later (planning on a bit of a modern code rework to make things cleaner).

If you have an example page just I I can double check that hitting "merge" won't break the repo (I'm on mobile for the next 10 hours), I can merge!

navaroli commented 1 year ago

Looks like I can only post images in comments. Here's a mega link that contains an example HTML file with a HexPatch on a toy file:

https://mega.nz/file/86pFCYIa#x7zRFXNOxb71axHCVVQdinpvSg77n_M36udy6AsTHHo

Patch code looks like this:

{
  type: 'hex',
  name: 'Hard-coded 3-byte string',
  tooltip: 'Sets 3 bytes',
  offset: 0x2,
  off: [0x33, 0x44, 0x55]
},
mon commented 1 year ago

"On mobile" and "mega link" aren't really friends with each other, but I managed to get a quick time with my laptop. 😅

Good to merge, I will definitely rework it later to make the UI a bit cleaner (such as proper as-you-type input validation instead of the alert).

Thanks for the PR!