mirror of
https://github.com/Druthulu/BFM-decomp
synced 2026-09-26 13:33:34 -04:00
cc73951128
- diff_settings.py + progress.py/difficulty.py/dup_report.py: add the `resident` BINARIES entry (build/resident/, config/check.resident.sha, src/resident, asm/resident/nonmatchings, per-binary docs) - dup_report.py: degrade gracefully when the Ghidra sig (.run/sig.resident.jsonl) is absent — write a placeholder + exit 0 instead of crashing the whole `make report` (sig is a T4 export) - progress.py: scope linked_subsegs() to BINARY==main — PsyQ library linking is the EXE's layout (Phase 8, gated ifeq BINARY,main), so a second binary has 0 LINKED (was: listed main's libs) - Makefile expected: per-binary-safe — drop `rm -rf expected/build` (clobbered every sibling baseline); refresh only the active binary's image dir + merge-copy (cp never deletes siblings) - reports: resident = 0 REAL / 143 INCLUDE_ASM stubs / 100% stub (correct); main UNCHANGED (52 REAL / 959 LINKED / 50.24%); both expected/ baselines coexist (verified)
41 lines
2.3 KiB
Python
41 lines
2.3 KiB
Python
# asm-differ project config — BFM-decomp (SLUS_007.26, USA, PSX little-endian R3000).
|
|
#
|
|
# The matching oracle: diff one function's codegen in our build against the
|
|
# byte-identical `expected/` baseline. Object mode (-o) is the default workflow:
|
|
# .venv/bin/python tools/asm-differ/diff.py -mo <function> # -m rebuild, -o vs object
|
|
# Score 0 = matched (instruction-identical incl. regalloc); anything else = not matched.
|
|
#
|
|
# `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=<alias>).
|
|
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"),
|
|
"resident": dict(baseimg="expected/build/resident/resident.elf",
|
|
myimg="build/resident/resident.elf",
|
|
mapfile="build/resident/resident.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"] = _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)
|
|
config["source_directories"] = ["src", "asm", "include"]
|
|
config["objdump_executable"] = "mipsel-linux-gnu-objdump"
|
|
config["makeflags"] = []
|