Skip to content

Keep generated declarations and the Intersect pragma above function annotations - #1807

Merged
foxtacles merged 1 commit into
isledecomp:masterfrom
foxtacles:fix-overlay-seats-above-annotations
Oct 26, 2026
Merged

foxtacles merged 1 commit into
isledecomp:masterfrom
foxtacles:fix-overlay-seats-above-annotations

Conversation

@foxtacles

Copy link
Copy Markdown
Member

In the source that ReproBit generates (the source view in the CI artifact and the one reccmp reads), two inserted lines landed between a function's // FUNCTION: annotations and the function itself:

  • vectorlength.inl.h: class MxUnkRecordZ0400; / class MxUnkRecordZ0401; above Vector4::NormalizeQuaternion
  • legoroi.cpp: #pragma optimize("y", off) above LegoROI::Intersect

Both now sit above the annotations. The compiler still sees the same code on the same line numbers, so the binaries don't change. A cold rbit verify still matches all three retail files, authenticity is clean, and the intervention cost is unchanged (58,553).

Why it happened

ReproBit doesn't choose these positions when it generates the source. Each inserted line has a saved position in reprobit/interventions/shared-lego1.json. That position is the code around it, plus the exact text of the line just before and just after the insertion. Comments don't count as code, so every line break between #include "vector4d.inl.h" and int Vector4::NormalizeQuaternion() is the same place to the compiler. The saved line pair happened to name the break directly above the function. That choice came over from the older tooling when the function moved into this file. The pragma was saved as "right before the next piece of code", and a position like that always ends up below any comments. I scanned the whole generated tree, and these were the only two cases.

How it was fixed

  1. In reprobit/interventions/shared-lego1.json, only the two saved positions change. The neighbouring lines are stored as the sha256 of the line text without its newline:
    • vectorlength.inl.h: line_before = the empty line, line_after = // FUNCTION: LEGO1 0x10002b70. The old pair was the BETA10 annotation line and the function's first line. ctx (the surrounding code) stays the same.
    • legoroi.cpp, the pragma_optimize op with "state": "off": drop "at": "before_token" and add the same kind of line pair (line_before = the empty line, line_after = // FUNCTION: LEGO1 0x100a9410). The closing #pragma optimize("", on) already uses this form.
  2. rbit source regenerate . --apply updates the stored digests of the generated text: the two files' effective digests, plus legoroi.cpp's source digest in its TU record and in build-plan.json.
  3. rbit validate ., rbit source export . to look at the result, then a cold rbit verify ..

rbit repair isn't needed. It handles edits to source files, and no source file changed here.

🤖 Generated with Claude Code

https://claude.ai/code/session_01C6Mx18sFGvm5XSSK9oSu7q

…nnotations

The saved seats for the vectorlength.inl.h declaration carrier and the
opening pragma_optimize directive in legoroi.cpp resolved to the line break
directly above the function, splitting it from its // FUNCTION: annotations
in the generated source. Re-seat both on the blank line above the annotation
block; the token context is unchanged, so every compiled token keeps its line
and the output stays byte-identical. Digests re-derived with
rbit source regenerate --apply.
@foxtacles
foxtacles merged commit 3a40ab4 into isledecomp:master Oct 26, 2026
13 checks passed
@foxtacles
foxtacles deleted the fix-overlay-seats-above-annotations branch October 26, 2026 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant