Skip to content

Finding a value

cech12 edited this page Dec 4, 2026 · 1 revision

Finding a value

You need a disassembler such as Ghidra or x64dbg to understand the code. Find a text near the value (Ghidra: Search → For Strings), follow its references and look for the number. Then let locate.py show the bytes behind each reference. It needs Python 3 and no extra packages. Download .tools/locate.py of the repository (or clone it):

python locate.py "C:\...\Diggles.exe" --anchor Grosse_Holzkiepe
Diggles.exe: exe id 5FE4FAC3_002CF39B, image base 0x400000
anchor "Grosse_Holzkiepe": 1 string(s) at RVA 0x32c6ec
1 code reference(s); "xref": "first" = 0, "last" = 0

xref 0: reference at RVA 0x1c74eb (instruction starts a few bytes before). Window offsets count from RVA 0x1c74ef:
  +0    E8 0C 1D 0F 00 8D 4E 18 C7 46 14 08 00 00 00 68
  +16   00 C7 72 00 E8 F8 1C 0F 00 8D 4E 20 C7 46 1C 06
  ...

C7 46 14 08 00 00 00 at window offset +8 is mov dword [esi+0x14], 8: the 8 extra slots of the big basket. The 8 starts 3 bytes after the pattern start, so "bytes" : "C7 4? ?? ?? 00 00 00", "at" : 3. ?? is used for the bytes that differ between the exes (register, offset, the value itself). The same check on the CD Wiggles.exe shows 2 references; behind the last one the instruction comes 106 bytes later, so the window has to be [0, 160]. In such a large window the pattern also matches the following instructions, so "occurrence" : 1 takes the first match. Use ?? for bytes that may differ and keep the window as small as possible.

Checking your file without starting the game

python locate.py "C:\...\Wiggles.exe" "C:\...\MyMod\EnginePatch\mods\MyMod.json"

It checks all entries of catalog.json and of your file against the given exe and shows the address and the current value, or why an entry is not found. Run it for every exe you want to support (CD, Steam, GOG). Exit code 1 means a problem was found. In a clone of the repository it uses EnginePatch/catalog.json of the repository. If you downloaded only the script, pass the catalog of your game folder: --catalog "C:\...\EnginePatch\catalog.json" (first argument after the exe).

Clone this wiki locally