Repository navigation
feat(il2cpp): link methods to native addresses and write Ghidra seeds - #5327
Conversation
With binary_path naming the matching Mach-O, PE or ELF IL2CPP binary, method addresses (with a code, no-body or unknown state) and field, parameter and return type names are read from its code-generation modules and type table without running it; ELF RELATIVE relocations are applied and x86-64 builds without a static CodeRegistration are linked through the instruction that loads the module array. --ghidra-seeds writes REA_GHIDRA_SEED_FILE function seeds, with folded methods listed as comments. Linking yields between batches and keeps the metadata source facts when it fails.
dfac07b to
e139382
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
[Medium impact] The PR appears safe to merge; no blocking findings remain. SummaryAdds static IL2CPP method-address linking, retained native queries, and Ghidra seed export.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
M[Metadata file] --> S[Shared inspection service]
B[Optional native binary] --> S
S --> E[Complete Evidence]
E --> V[Summary and selected pages]
E --> W[Optional seed export]
W --> F[New Ghidra seed file]
Reviews (4) · Last reviewed commit: "test(cli): assert file URL rejection ind..." · Reviewed by Greptile |
Repair independently reproduced main CI failures: normalize exported statements at their position owner and assert URL rejection independently of schema wording. Existing boundary regression and 74 relevant tests pass on a separately built main with these repairs.
|
Thank you very much, @gensokyo-dev, for merging this and for the follow-up commits that kept my original commit in the history. I re-ran the real samples on the merged head
Every method row (address, state and type names) is identical on all 15 runs, and every seed file parses back with Thanks again for all the careful hardening work on this. |
Summary
Fixes #5112. Link IL2CPP metadata names to native method addresses/type facts and export Ghidra seeds, extending @8rulerstar's implementation and retaining their latest commit
e13938233with follow-ups.Behavior and boundaries
binary_pathselects a matching 64-bit PE/ELF/Mach-O binary. CLI/MCP share the same application/producer implementation. Retained views select batches of indices, addresses or states, fields and pages; every folded-body alternative and both artifact identities remain accessible. Module tables have their own page instead of inflating the default summary; full Evidence remains exportable.Native readers reuse the container owner's mappings/executable spans and populate facts once. Cooperative scans, lazy generic names, no pointer-table copy, early row/text admission and bounded expansion control work and allocation. The shared application seed workflow reuses the completed report, enforces existing consumer limits, publishes atomically to a new file and retains completed Evidence/output receipts on failure; failed cleanup stays owned. Superseded formatter/writer paths and redundant tests were removed.
Observed metadata, derived static associations, and inferred executable-byte fallback remain distinct. Unknown relocations never become observed-zero/no-body. Unrequested native counts are null; unsupported/partial results retain source identity and reasons. Matching is structural, not cryptographic same-build proof.
Scope: existing local static file reading, caller-requested output and existing Ghidra import; no new execution/injection/provider authority, dependency or installer changes. Domain facts, native adapters, application workflows and CLI/MCP keep inward dependencies. Authored contracts/docs/skill updated; generated outputs stay ignored.
Executed validation
Production verification at
9b6045b26; final head66bcbfdb0c5d78111364bb2861622039915eed09only removes one stale acceptance assertion:npm run check:ci: all 8 tasks and architecture guards passed;docs:generate/docs:checkpassed, including 5 README tests. No threshold/exclusion changes.IngameDebugConsole.DebugLogManager$$ShouldRemoveLogEntryToShowat0x180c5ca60, and returned its 26-byte body,8 instructions and pseudocode after default auto-analysis. JVM/project removed on close; input unchanged. Ghidra runtime was pinned to95a20b11a; later changes leave Ghidra and seed rows unchanged.An additional acceptance consumer of the same stale URL wording was independently reproduced on built main and corrected. All17 related CLI/path tests and the duplication gate pass; this follow-up changes no production code.
Two reproduced main CI blockers are repaired in a separate follow-up commit: URL rejection tests depended on obsolete wording (3 failures), and exported declarations lost their semantic statement position (1 actual built-worker failure). Statement ownership now normalizes the export wrapper and removes the class-only workaround; URL tests preserve rejection/path assertions. A separately built main with only those repairs passes 74 relevant tests, including branch/activation uncertainty cases. Redundant fixture/setup/response parsing was consolidated with original oracles retained; the global duplication gate passes unchanged.
Artifact identities and complete-task cost evidence
5691bdd9161d054db69cc842397c7a42c6bf4a544060f05d741e99a6a3a07d29a3ae7f6ecd1f671297b7d98d12713ef024062d93cd7a4205298102656c93b67a3814d666a9f83388a71d7ad7ffb67b2cdaf7f2fef5c48c021ddf43373cdad64e9fa9170439ccdca152bfb86ea5d1ee2fae62c476b226c4251fec9fc935c88d9eTask: find
DebugLogManager.get_IsLogWindowVisible, address0x180c56ed0, both shared-body definitions (indices 39403/45972), their names/owners/return types, and export full Evidence. Legacy scans 512-row address pages; selected uses the exact address filter. Both final variants retain identical requested facts/Evidence access. Revision 95a alternated both orders; small fixtures also ran both orders (representative rows below). Revision 9b repeats the equivalent complete real task after review fixes.Tokenx estimates include used/all input declarations, arguments and full replies, with all extra calls. Final whole-wire estimates, including catalog output schemas: legacy 4,063,553, selected 1,057,887. Actual model usage/rendering/tool selection are unmeasured.
Separate 24 warm retained-address probes: median 17.51ms, range 15.80–26.35ms, excluded from the primary rows above. Whole-task profiles include SDK/client/server, catalog/AJV, decoding, queries, export and teardown. Engine-only costs unmeasured; fresh runtime caches, OS caches/host load uncontrolled. Baseline fc14 includes an older main, so its timing change is not attributed solely to this feature. Small input is authored, not real-engine coverage.
Linux/Node 24.18.0; two-CPU affinity,3 GiB V8 heaps,8 GiB sampled process-family guard; no OOM/guard stops/retries. RSS sampled20 ms may double-count shared pages or miss brief peaks. Report budgets are not total-RSS bounds. Reference tools lived privately, outside REA dependencies.
Ghidra default cold analysis is expensive: 1395.88s wall /1705.24s familyCPU /7.218 GiB sampled familyRSS,2 CPUs/4 GiB JVM heap/8 GiB guard; no guard stop. No Ghidra speedup is claimed.
Coverage limits: generic instances/thunks/invokers,32-bit images, packed ELF relocations and Mach-O chained fixups remain unsupported. Original contributor-reported non-v29/platform runs remain credited in the discussion/docs and were not rerun here. Reference omission does not prove no-body/unknown semantics. Fallback bytes do not prove instruction boundaries/runtime use. No game executed or executable modified.
Author readiness
Human owner: @gensokyo-dev
Original contribution: @8rulerstar. The human owner authorized the work, delegated technical review/validation to Codex and directed these declarations and ready submission. This records that instruction; it does not assert an independent human review of follow-ups or review of later commits by the original contributor.
Before merge
type(scope): outcome.