mirror of
https://github.com/Druthulu/BFM-decomp
synced 2026-09-26 21:36:06 -04:00
a8872fa169
First attempt on the game's largest unmatched function. No match (never the goal); the deliverable is the map, and every claim is byte-verified against the target .s. - STRUCTURE: an actor state machine, not a straight-line giant. 21-case switch via jtbl_801F4CE4 (sltiu 0x15); 359 jals to only 37 DISTINCT callees (verified); 48-ins preamble + 19-ins shared tail. - THE FINDING: it decomposes into repeated templates, not 5122 unique instructions — 35 instances of one "spawn-effect" packet (~1400 ins, crack one -> 34 free), 7 "wait/countdown" (already reproduced at 0 skeleton diffs), 12 "HUD/text", plus twin cases (0≈3, 1≈4). Only 3 cross-jump edges couple anything. - TWO GENERAL LAWS FOR GIANTS, measured: (1) register pressure is GLOBAL, so a partial draft gets 10 callee-saved regs instead of 8 and a matching PREFIX is structurally unavailable — write all cases coarsely first, then refine; (2) match_one's global number is meaningless on a partial giant (666 vs 5122) — measure REGION-ALIGNED instead. - NEW REUSABLE TOOL: .run/giants/s18_regions_comparator.py (region-aligned skeleton comparator, works on any giant). Caveat travels with it: masks register numbers + jal targets, so it proves STRUCTURE, never closeness; finish on the whole-binary gate (G3/P9). - 2 idioms cracked in passing (the D_x[t+K] constant-fold needing a separate index statement; the (s16)*(u16*)p + /455 magic-0x90090091 form). - VERDICT: tractable but a ~2000-line WRITE, not a hard puzzle — no scheduler wall, no unsteerable regalloc. Recipe for the next attempt recorded. - artifacts preserved under the tracked .run/giants/ path (.gitignore now allowlists *.py there).