diff --git a/diff_settings.py b/diff_settings.py index e44e923ff..fc6cffd32 100644 --- a/diff_settings.py +++ b/diff_settings.py @@ -8,11 +8,27 @@ # `expected/` is a snapshot of a SHA1-GREEN build (= the original bytes, since the # all-INCLUDE_ASM build is byte-identical). Re-snapshot it ONLY after a green build # (`make expected`) — a stale baseline causes phantom matches/regressions (SETUP.md §6.4). +import os + +# Per-binary asm-differ images (Phase 9). asm-differ calls apply(config, args) with a fixed +# signature we don't control, so the active binary is selected via the BFM_BINARY env var +# (default main = the retail EXE; a Gen2 binary adds an entry + sets BFM_BINARY=). +BINARIES = { + "main": dict(baseimg="expected/build/us/SLUS_007.26.elf", + myimg="build/us/SLUS_007.26.elf", + mapfile="build/us/SLUS_007.26.map"), +} + + def apply(config, args): + _bin = os.environ.get("BFM_BINARY", "main") + if _bin not in BINARIES: + raise SystemExit(f"diff_settings: unknown BFM_BINARY={_bin!r} (known: {', '.join(BINARIES)})") + _cfg = BINARIES[_bin] config["arch"] = "mipsel" # little-endian MIPS, R3000 (PSX CPU) - config["baseimg"] = "expected/build/us/SLUS_007.26.elf" # image-mode target (byte-identical baseline) - config["myimg"] = "build/us/SLUS_007.26.elf" # image-mode current build - config["mapfile"] = "build/us/SLUS_007.26.map" # GNU ld -Map: symbol -> object + address + config["baseimg"] = _cfg["baseimg"] # image-mode target (byte-identical baseline) + config["myimg"] = _cfg["myimg"] # image-mode current build + config["mapfile"] = _cfg["mapfile"] # GNU ld -Map: symbol -> object + address config["map_format"] = "gnu" config["expected_dir"] = "expected/" # -o: expected path = expected_dir + objpath config["build_dir"] = "build/" # (objpath "build/src/800.o" -> expected/build/src/800.o) diff --git a/phase-ends/CURRENT_PHASE.md b/phase-ends/CURRENT_PHASE.md index bbadf5893..29280e65a 100644 --- a/phase-ends/CURRENT_PHASE.md +++ b/phase-ends/CURRENT_PHASE.md @@ -31,8 +31,8 @@ - [x] **T6** — `dup_report.py` + `difficulty.py` [B2+B3]: argparse `--binary` (default main) + BINARIES table; Makefile `report` threads `--binary $(BINARY)`. DONE: progress.md + duplicates.md UNCHANGED (pure no-op); difficulty.md old-code==new-code output (proven) ⇒ its 12/12 diff is the **Phase-8 deferred regen** (9 harvested fns left the queue) — regenerated + committed here (resolves the Phase-8 deferral). Build untouched (report-only). - [x] **T7** — `ld_interleave.py` [C3]: argparse `--front`/`--tail`/`ld` (EXE defaults, transitional); `extract` recipe gates the call under `ifeq ($(BINARY),main)` + passes `--front 53198.data.o --tail 6324C.data.o`. DONE: positive (extract path) ⇒ `143dbb89` (tail_data=1 from the flag); negative `--tail BOGUS.data.o` ⇒ "tail data object not found" exit=1 (threaded); restore ⇒ `143dbb89`. - [x] **T8** — DONE (two commits). **T8a** [C1/C2/E1/D]: make_snd_used/make_apicard_used/gen_lib_subsegs (`--vram-base`/`--exe`) + split_src_region (`--symbols`) de-defaulted, thread to pipeline; curated dirs regenerate BYTE-IDENTICAL; gen_lib_subsegs libgte=22 blocks. **T8b** [no-EXE-default end state]: removed transitional EXE/VRAM_BASE globals + all `=VRAM_BASE`/`=EXE` param defaults across psyq_link/identify/link_region/link_lib/integrate → `--vram-base`/`--exe`/`--symbols` REQUIRED. PROOF: `psyq_link.py ` (no flags) ⇒ argparse "required: --vram-base, --exe" (loud); with-SDK + without-SDK builds ⇒ `143dbb89`; wrong base ⇒ `cae22f7e`; curation regen identical. -- [ ] **T9** — `diff_settings.py`: `BFM_BINARY` env-var selector + BINARIES table. Gate: asm-differ scores 0 on a known match. ← **CURRENT** -- [ ] **T10** — Docs (SETUP/cookbook/psyq-worklist/README; R16/R21) + `make expected` refresh + final both-ways milestone proof + negative control demonstrated/reverted. +- [x] **T9** — `diff_settings.py`: `BFM_BINARY` env-var selector + BINARIES table (asm-differ owns apply() signature; env var is the seam). main = current EXE images. DONE: apply() unit test (main→EXE paths; bogus BFM_BINARY→loud error); `make expected` baseline set; asm-differ `-o func_80018F20 --format json` ⇒ current_score=0 (MATCH). +- [ ] **T10** — Docs (SETUP/cookbook/psyq-worklist/README; R16/R21) + `make expected` refresh + final both-ways milestone proof + negative control demonstrated/reverted. ← **CURRENT** ## Transitional-default technique (T2–T8) — keeps every commit green despite in-process coupling `psyq_integrate`/`psyq_link_region` import `VRAM_BASE` + `recover_sym_addrs`/`classify`/`placement` from