This folder contains Ghidra-only helpers for recovering static offsets after game updates.
- Open game
*.exein Ghidra and let analysis finish. - Add this
GameHelper2 Offset Recovery Frameworkfolder as a Script Manager directory. - Run
OffsetRecoveryFramework.java.
Validated with Ghidra 12.1. Keep archived or comparison copies outside this script folder, or give them a non-.java extension, because Ghidra compiles every Java file in the bundle.
The script prints the best candidate for each offset, confidence, unique output pattern data, and a final summary. High-confidence results also receive bookmarks and labels in the Ghidra database.
Set VERBOSE = true in OffsetRecoveryFramework.java to print score reasons and validation notes while debugging recipes.
Game StatesFile Root(Mods.datby filename, regardless of directory)AreaChangeCounterTerrain Rotator HelperTerrain Rotation SelectorGameCullSize
Most recipes start from one or more anchor strings, follow XREFs and call chains, then scan Ghidra instructions for a RIP-relative static reference. Some recipes, such as Terrain Rotator Helper and GameCullSize, use function-shape detection instead of a string anchor. After semantic hooks select the best candidate for an offset, the framework runs one SigMaker-style pass for that result by wildcarding RIP-relative displacement bytes and extending across instruction boundaries until the pattern is unique in executable memory. A result is valid only when the final output pattern has exactly one executable-memory match.
For simple offsets, use AnchorRecipeBuilder. For complex offsets, add a custom OffsetRecipe implementation.
- Pick durable anchors: strings, nearby log text, table paths, or error messages.
- Define the traversal: same function, direct calls, or nested calls.
- Match a stable instruction shape, preferably RIP-relative.
- Resolve the static address with
resolveRipRelative. - Add validation rules that prove the candidate is semantically correct.
- Make wrong candidates lose score or fail cleanly.
If confidence is high, the result is usually enough. If confidence is medium or low, enable VERBOSE, rerun the script, and inspect the printed candidate in Ghidra using the bookmarks and validation notes before updating production offsets.