Files
BFM-decomp/tools
Drew T 3f7534c10a fix(tools): the alias scanner I added this morning had the §134 defect I documented this morning
asm_label_aliases scanned the RAW source with a greedy `[^;{}]*` that spans newlines. Byte-witnessed
on ov_SC07_006: a match STARTED inside a comment (`… -> MATCH (40 ins)`), ran through the `*/` and
two blank lines, and swallowed the real declaration below it — so the map recorded
`'MATCH': 'func_80146AFC'` while the actual alias `aF80146AFC` never appeared, and a
`register u8 *p __asm__("$6")` pin contributed `'void': '$2'`.

That is exactly the §134 multi-line-comment class whose project-wide answer is `cdecl._mask` (R33,
ONE masking oracle) — which I described in §139 this morning and then did not use. Sixth tool.

Two non-obvious things the fix had to get right:
 - REJECTING a bad match after scanning the source does not work: finditer resumes at the END of the
   match it yielded, so the greedy comment-spanning match CONSUMES the real declaration and
   rejecting it loses that declaration entirely (verified: aF80146AFC stayed invisible with a reject
   in place). The scan must run on the MASKED text so a match cannot start in a comment at all.
 - `_mask` blanks string content AND its quotes, so the scan pattern cannot require them. Added
   `_ALIAS_SCAN` (quotes optional) for the masked scan; the real symbol is read back from `src` at
   the same offsets, which is legal precisely because the mask is length-preserving.
`$N` targets are excluded — a hard-register pin is not a symbol alias.

Found because the R32 partition guard added earlier today REFUSED to rewrite the file rather than
silently dropping the function — the guard working as intended, on its first real encounter.
2026-08-04 19:50:11 -06:00
..