Repository navigation
feat(il2cpp): inventory Unity IL2CPP global-metadata images, types and methods - #3807
Conversation
|
Nice to see it, please go ahead and implement all unity. |
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 new actionable issue was established. SummaryAdds static Unity IL2CPP metadata inspection for versions 29, 31 and 39.
The ancestry check passed, but the merge bases differed, so this review used the full PR diff. All supplied previous threads were unnumbered and were treated as context rather than numbered findings. No tests were executed during this review. GitHub authentication was unavailable, so supersession could not be checked remotely. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Selected metadata file] --> B[Stable bytes and SHA-256]
B --> C[Check header and decode rows]
C --> D[Complete Evidence]
D --> E[CLI complete output or exclusive export]
D --> F[MCP retained Evidence]
F --> G[Summary and filtered pages]
Reviews (18) · Last reviewed commit: "chore(il2cpp): integrate current scenari..." · Reviewed by Greptile |
ed34f7c to
b7c1800
Compare
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
90db332 to
daf9ab7
Compare
daf9ab7 to
931e4a3
Compare
931e4a3 to
dc5db4f
Compare
Add inspect_il2cpp_metadata (CLI inspect-il2cpp-metadata), a read-only in-process decoder for unencrypted Unity global-metadata.dat version 39. It reports header sections, serialized index widths, images, type definitions (nesting from the nestedTypes section) and method names. Unrecognized magic and other versions are unsupported; damaged headers, overlapping sections, inconsistent record sizes, out-of-range indices and invalid strings fail with a reason code and no partial success. MCP detail summary retains the complete Evidence and pages rows through inspect_analysis_view kind il2cpp-metadata. Adds an opt-in verify:il2cpp:metadata -- --metadata PATH check.
A 112,232-method file produced a 10.5 MB complete response, above the 10 MiB stdio budget. Default MCP delivery is now the retained summary; detail complete stays available, and the one-shot CLI requests it.
…drift Review fuzzing showed that moving the strings section offset by one byte silently renamed every image, type and method. Name indices must now start a string, which also bounds total decoding by the section size. Nesting cycles and methods whose declaring type disagrees with the owning type range are rejected instead of returned. Adds service, shutdown and index-width coverage, and moves environment-specific measurements out of the public guide and tool description.
Unity 2022.3 writes version 29 or 31 metadata: a 256-byte header of (offset, size) pairs, fixed 4-byte indices, type records with elementTypeIndex, and method records that gained returnParameterToken in version 31. Record counts come from section sizes and must be whole. Sections report a null count for these versions and index widths report fixed-width-version. Image, type and method rows keep the same shape, and the string, nesting and method-ownership checks apply to every version.
Rows share decoded names, so a 130 KB file could expand into gigabytes of JSON before the 64 MiB budget check, ending in an internal RangeError. The provider now refuses from a lower bound on the serialized rows first. The decoder also rejects non-empty sections inside the header, methods outside their declaring type's range and overlapping image type ranges, and keeps a leading byte order mark in names. Layouts now carry one indexing mode instead of two coupled flags, and the tool description explains nested_type_start.
Address review findings on the IL2CPP metadata inventory: - check a lower bound from header row counts before any row object is allocated, so a large rejected file no longer builds every row first; - validate sealed parent Evidence and count its rows once per report instead of on every inspect_analysis_view page; - decode version 39 fixtures with 2- and 4-byte type-definition, generic-container and parameter indices.
…on tools inspect_il2cpp_metadata defaulted to detail summary, the only inspection tool to do so. Omitted detail now returns every row inline, as inspect_artifact, decode_interface_builder and the capture tools do; summary stays one argument away and the guide, CLI reference and skill reference say to select it first for large games, whose complete MCP delivery is refused at the stdio budget with retained Evidence.
…ault An empty image stores its type start as the all-ones value of a one- or two-byte index; the decoder reads it as -1, but no fixture exercised it, so removing either conversion passed the suite. The fixture can now append an empty image, and both widths decode it. The skill still described a summary default; it now says to select summary first, as the guide does.
bc1f3be to
16a0109
Compare
Use absoluteCallerPath (morluto#4067) so a path with a symlink followed by .. names the same file the CLI and MCP inspect.
Retain source-indexed Evidence for filtered batch and field queries. Bound representation growth before serialization, yield decoding for cancellation, and share CLI Evidence publication with desktop inspection. Verify public Unity metadata against independent byte and managed-DLL oracles and exercise actual stdio SDK workflows.
|
@codex review |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
…ansition-view Resolve conflicts with main's il2cpp-metadata view (morluto#3807) by keeping both view kinds: the analysis-view request and result unions, parent operations, summaries, unsigned view types and the tool description now cover the il2cpp-metadata and browser-scenario views. The generic unsupported-parent message names both, and the unreachable browser-scenario fallback stays removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Outcome
Report the validated header magic/version and decode image, type and method names from a caller-selected Unity IL2CPP
global-metadata.dat(versions 29, 31 and 39), without Unity or a native analysis engine. Preserves the original implementation and author history from this PR; follow-up commits add composable queries, bounded delivery and lifecycle fixes. Closes #3784.Validation
Executed locally on Linux with pinned Node 24.18.0:
npm run check,npm run docs:check, 100 focused tests across 12 files on5f65d4adb, and the public CLI/MCP producer verifier. Earlier decoder/view/service/counter coverage passed 115 tests, plus 27 shared JSON-input/cancellation tests after integrating main7a0c47bfa. Test discovery found every file exactly once. Actual stdio SDK tests validate advertised schemas after conversion and each output.Real compiled CLI tests cover compact/default and complete delivery, retained reads after source removal, all four collections, filters/batches/fields, exclusive export, and POSIX symlink-parent export/readback with an unrelated decoy preserved. Controlled close faults on real files verify completed source Evidence, original cancellation reasons, retained descriptor ownership and Evidence after cleanup retry; failed reads fabricate no source facts. Codex review was unavailable because the repository review quota is exhausted. Greptile's export-selection and completed-source findings are corrected in this follow-up.
Public producer: Cpp2IL Simple_2022_3_35 at b5ad444, raw metadata v31, 1,892,268 bytes, SHA-256
2441635a7c234a1a34deccc6a9906d6f5abcbdab078a38b2bf488a52a4962c48. An independent raw-byte oracle matched every exposed field across 36 images / 2,468 types / 12,409 methods. Corresponding managed DLLs independently matched names and ownership for 35 images / 2,463 types / 12,406 methods; generated rows have no corresponding DLL and use the byte oracle. No target execution. Versions 29/39 have synthetic coverage here; the original author's five private Unity-build comparisons are historical evidence and were not repeated locally.Measured task costs
Actual compiled stdio SDK task: find
GameObject.SendMessageandTransform.GetChildin CoreModule, then retrieve both facts again after removing the owned input copy. Both paths assert equal facts, SHA and Evidence linkage. Baseline uses explicit summary and the smallest available range queries. Two alternating pairs, baseline original PR integrated at mainb4938aed5, follow-up integrated at main7a0c47bfa; concurrent main changes are included. Fresh processes, 2 CPUs, bounded heaps, compile caches disabled; OS caches and host load uncontrolled.055b8787af8fce575fIncludes discovery, schemas, protocol envelopes and output validation; build/install excluded. Actual model/host-rendered context tokens are unmeasured. Earlier pairs varied with host load; no consistent speed or memory improvement claimed. First source inspection/first retained view and warm retained queries are recorded separately; the final lookup succeeds without source access. The final header field is included in the measured schemas and replies.
After the boundary fixes and main
bf1eeee94integration, the complete five-call task passed again: 22,210 selected-declaration/call tokens, 240,379 all-input-declaration/call tokens, and 1,000,596 entire-protocol tokens (all tokenx estimates). One final run measured 6.69 s elapsed, 7.67 s process-family CPU and 713 MiB sampled peak RSS. The paired table pins its earlier revisions; this final correctness/cost probe includes the subsequent main changes and is not a speed comparison.Scope and limitations
Repository-operator authorization covers this static metadata slice and ready-for-review follow-up. No execution, injection, decryption, protected recovery, native address linking or disassembler integration. Fields/signatures/runtime loading and correspondence to
GameAssemblyremain unknown. Input guard 256 MiB; encoded retained report guard 64 MiB, separate from MCP transport capacity. Optional CLI export writes only the caller-selected Evidence output.The original author's initial readiness declaration is retained below; later pushes do not require another initial declaration. It is not an assertion of a new human review of these follow-ups.
Author readiness
Human owner: @8rulerstar