feat(launcher): add a patch type that finds code by byte signature (#165)

This commit is contained in:
Fiereu authored and GitHub committed 2026-08-11 10:56:33 +02:00
1 parent 95c90284ac
commit f1c3441644
3 files changed
+28

No files matched your search

@@ -75,6 +75,28 @@ stores the length of every string separately, so a longer one cannot fit and a
shorter one leaves rubbish behind. For a url you can pad the end with `?xxx`,
which servers ignore.
### Patching code
Code has no constant to search for, so `binary_signature` finds it by the bytes
around it instead. `??` matches any byte, which lets a signature keep working
when operands move between builds:
```toml
[[patches]]
type = "binary_signature"
name = "SkipCall"
target = "@client"
signature = "83 7A 20 03 75 ?? E8 ?? ?? ?? ?? 90 41 83 7F 10 00"
offset = 6
replace = "B8 01 00 00 00"
```
`offset` counts from the start of the match, so this one overwrites the five
bytes of `E8 ?? ?? ?? ??` and leaves the rest of the signature alone. It defaults
to `0`. The replacement has to fit inside the match, because the file is patched
in place and nothing may move. Every match is replaced, as with a string patch,
so a signature has to be narrow enough to name one site.
Two other patch types exist. `strings` adds lines to `data/strings/strings_*.xml`
using ids from 1000000000 up, which is above anything PokeMMO uses. `file` writes
a whole file from an asset next to the manifest.
@@ -0,0 +1,3 @@
Removed on request of pokemmo.eu.
Date: 2026-08-17
Nonce: fd82ba5bd34241f4909cc100aa27b9dd
@@ -0,0 +1,3 @@
Removed on request of pokemmo.eu.
Date: 2026-08-17
Nonce: 8210883fd0644c99bc182ee9ffb60ba1