mirror of
https://github.com/Druthulu/BFM-decomp
synced 2026-10-01 15:43:06 -04:00
feat(phase-13): T0 — overlay splat template + overlays.mk indirection
- config/splat.us.overlay.template.yaml: reusable flat-blob splat template for location overlays (@TOKEN@ placeholders), modeled on splat.resident.yaml; code at file 0x0 (no leading-rodata trick), stacks symbols.resident.txt (overlays call the engine), vram 0x80128158 - Makefile: -include config/overlays.mk + BINARIES := main resident $(OVERLAY_BINARIES); the generated overlays.mk keeps new_overlay.sh out of the hand-maintained Makefile body; silent when absent (fresh-clone-safe) - GATE T0: clean rebuild main 143dbb89 + resident 8e17e02f BYTE-IDENTICAL (indirection proven a no-op) - phase-ends/CURRENT_PHASE.md: Phase-13 task log (plan approved gate 1)
This commit is contained in:
@@ -30,7 +30,14 @@ MASPSX := tools/maspsx/maspsx.py
|
||||
# .run/sig.<bin>.jsonl) is documented now but first INSTANTIATED by Phase 10's second
|
||||
# binary. Select with `make build BINARY=<alias>`; defaults to the EXE.
|
||||
# -----------------------------------------------------------------------------
|
||||
BINARIES := main resident
|
||||
# Overlay binaries (Phase 13): each location overlay is registered as an alias in the
|
||||
# GENERATED config/overlays.mk (it defines OVERLAY_BINARIES + the per-<ov> var blocks),
|
||||
# kept out of this hand-maintained file so tools/new_overlay.sh never edits the Makefile
|
||||
# body. The `-include` is silent when absent (fresh clone / no overlays onboarded yet) ->
|
||||
# OVERLAY_BINARIES expands empty -> BINARIES stays `main resident` and every byte-locked
|
||||
# build is unchanged. Must precede the `:=` BINARIES line (simply-expanded -> read now).
|
||||
-include config/overlays.mk
|
||||
BINARIES := main resident $(OVERLAY_BINARIES)
|
||||
BINARY ?= main
|
||||
$(if $(filter $(BINARY),$(BINARIES)),,$(error BINARY='$(BINARY)' not in BINARIES='$(BINARIES)'))
|
||||
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
# splat config TEMPLATE — Brave Fencer Musashi location overlays (SCxx.CD/FILE_nnn/0.4.dec)
|
||||
# =============================================================================
|
||||
# Phase 13: the reusable flat-blob splat config for a LOCATION OVERLAY. ~134 overlays
|
||||
# all stream into the SAME RAM slot (vram 0x80128158) and chain into the resident engine
|
||||
# (0x800CEDF8) + the EXE. This is a TEMPLATE: the @TOKEN@ placeholders are substituted to
|
||||
# produce config/splat.<alias>.yaml — by tools/new_overlay.sh (Phase 13 T4), or by hand
|
||||
# (Phase 13 T1a for the first overlay). It is NOT a valid splat config until instantiated.
|
||||
#
|
||||
# Placeholders:
|
||||
# @ALIAS@ binary alias, ov_<SCxx>_<nnn> e.g. ov_SC01_077
|
||||
# @DEC_PATH@ extracted 0.4.dec payload path e.g. extracted/retail/SC01.CD.dir/FILE_077.dir/0.4.dec
|
||||
# @SHA1@ sha1 of the 0.4.dec (the build-identity target; also -> config/check.<alias>.sha)
|
||||
# @VRAM@ load vram (the shared overlay slot) e.g. 0x80128158 (constant across overlays today;
|
||||
# parameterized so a future non-0x80128158 overlay needs no template edit)
|
||||
# @CODE_END@ file offset where code ends -> data tail begins (iterated vs the byte check, T1b)
|
||||
# @EOF@ file size in bytes (the EOF marker; = the 0.4.dec length)
|
||||
#
|
||||
# Modeled on config/splat.resident.yaml (the Phase-10 flat-blob recipe), with overlays'
|
||||
# differences: (1) code at file offset 0x0 (overlays open with a function prologue, NOT a
|
||||
# leading data word like the resident — so NO leading-rodata trick by default; see the
|
||||
# commented `head` slot for the rare pre-code-data overlay); (2) symbol_addrs_path ALSO
|
||||
# stacks config/symbols.resident.txt because overlays reference resident engine globals;
|
||||
# (3) vram is the overlay slot. Everything else matches the resident options verbatim.
|
||||
#
|
||||
# Byte-match is robust to the exact text/data split (splat round-trips the bytes — the
|
||||
# resident precedent); iterate @CODE_END@ against `make check BINARY=@ALIAS@` (Phase-5/10
|
||||
# precedent). LZSS is NOT in the verify path — we match the DECOMPRESSED 0.4.dec (repack is Gen3).
|
||||
name: "@ALIAS@"
|
||||
sha1: "@SHA1@"
|
||||
options:
|
||||
basename: "@ALIAS@"
|
||||
target_path: "@DEC_PATH@"
|
||||
elf_path: build/@ALIAS@/@ALIAS@.elf
|
||||
# base_path is resolved relative to THIS yaml's dir (config/), so `..` = repo root
|
||||
base_path: ..
|
||||
platform: psx
|
||||
compiler: PSYQ
|
||||
|
||||
asm_path: asm/@ALIAS@
|
||||
src_path: src/@ALIAS@
|
||||
# build_path = build (NOT build/<alias>): splat writes the .ld's object paths under
|
||||
# $(build_path), and the Makefile's pattern rules build them at build/asm/** + build/src/**.
|
||||
# Only the elf/ld/output live in build/<alias>/.
|
||||
build_path: build
|
||||
ld_script_path: build/@ALIAS@/@ALIAS@.ld
|
||||
ld_dependencies: True
|
||||
|
||||
# Per-binary undefined-symbol outputs (under build/<alias>/), so `make clean`'s `rm -rf build`
|
||||
# covers them and binaries never share a stale file.
|
||||
undefined_syms_auto_path: build/@ALIAS@/undefined_syms_auto.txt
|
||||
undefined_funcs_auto_path: build/@ALIAS@/undefined_funcs_auto.txt
|
||||
|
||||
find_file_boundaries: False
|
||||
# NO gp_value: overlays are -G0 (verify zero ($gp)/%gp_rel in the disasm). Omitting it -> no _gp.
|
||||
|
||||
o_as_suffix: True
|
||||
use_legacy_include_asm: False
|
||||
|
||||
section_order: [".rodata", ".text", ".data", ".bss"]
|
||||
|
||||
# Stacked symbols: shared engine globals (symbols.us.txt) + resident engine globals the overlay
|
||||
# calls (symbols.resident.txt) + the overlay-local names/boundaries (symbols.<alias>.txt, seeded
|
||||
# T1c from sig_image + duplicates.cross.md; R13/R15-tagged, overlay-region only).
|
||||
symbol_addrs_path:
|
||||
- config/symbols.us.txt
|
||||
- config/symbols.resident.txt
|
||||
- config/symbols.@ALIAS@.txt
|
||||
|
||||
subalign: 2
|
||||
|
||||
string_encoding: ASCII
|
||||
data_string_encoding: ASCII
|
||||
rodata_string_guesser_level: 2
|
||||
data_string_guesser_level: 2
|
||||
|
||||
# Enable if maspsx reorders INCLUDE_ASM output in c-mode (unused for the EXE/resident):
|
||||
# include_asm_macro_style: maspsx_hack
|
||||
|
||||
segments:
|
||||
- name: "@ALIAS@"
|
||||
type: code
|
||||
start: 0x0
|
||||
vram: "@VRAM@"
|
||||
# align 4 (not the code default 16): MIPS is word-aligned; mirrors the EXE/resident choice.
|
||||
align: 4
|
||||
subsegments:
|
||||
# OPTIONAL leading pre-code data/rodata island (rare): if an overlay begins with a data
|
||||
# word BEFORE its first function (the resident's case), uncomment a `head` subseg here and
|
||||
# shift the code start. Mark it `rodata` (section_order places .rodata first) so it lands at
|
||||
# @VRAM@ ahead of the code, a 1-word analogue of main's rodata-island (no ld_interleave).
|
||||
# - [0x0, rodata, head]
|
||||
- [0x0, c, "@ALIAS@"] # code: starts at file 0x0 (overlays open with a prologue)
|
||||
- ["@CODE_END@", data, tail] # data tail: pointer tables + packed data to EOF (split iterated, T1b)
|
||||
- ["@EOF@"] # EOF marker = the 0.4.dec byte length
|
||||
@@ -0,0 +1,39 @@
|
||||
# CURRENT_PHASE — Phase 13: Representative location overlays (end-to-end + fleet runbook)
|
||||
|
||||
> Gen2 phase 6 (8→9→10→11→12→**13**→14→15). Effort: **Max** (template/first overlay). Plan approved by Drew 2026-06-16 (gate 1). Full plan: `~/.claude/plans/plan-mode-enabled-max-hazy-hamming.md`.
|
||||
> **Crash-recovery task log (P3/P5).** Update after every task. The PhaseEnd absorbs+archives this at close (R19).
|
||||
|
||||
## Owner decisions (this session)
|
||||
- **Scope = "Representative + credit"** — match SC01/077 end-to-end, collapse dup pair SC01/005≡006, add free-roam SC03/001, ship the fleet runbook. Bank the shared bodies SC01/077 *exercises*; full 134-sweep is Phase 15.
|
||||
- **Import the representative overlays into Ghidra** (decompiler assist for unique fns); Ghidra-free for the eventual fleet.
|
||||
|
||||
## Invariants (never regress)
|
||||
- main `143dbb89f34491258bbc27810d0a12ec8b43a8dd` + resident `8e17e02ff8954d07c979449198f7e1645046b353` stay BYTE-IDENTICAL through every task.
|
||||
- Byte-checks from a CLEAN rebuild (R22). Default build links no non-matching C (G4). MCP verified before any RE (G2). Stop+verify Ghidra before any DB commit (R23).
|
||||
|
||||
## Representative overlays (byte facts, verified R14)
|
||||
| Alias | `0.4.dec` path (extracted/retail/) | Size | SHA1 |
|
||||
|---|---|---|---|
|
||||
| ov_SC01_077 | SC01.CD.dir/FILE_077.dir | 731,607 | d19c9580a02dc63ba1f0e7e0c770f3b10de35635 |
|
||||
| ov_SC01_005 | SC01.CD.dir/FILE_005.dir | 679,689 | 56760dbec7757f12d18d7e40242a0b05280ff444 |
|
||||
| ov_SC01_006 | SC01.CD.dir/FILE_006.dir | 679,689 | 56760dbec7757f12d18d7e40242a0b05280ff444 |
|
||||
| ov_SC03_001 | SC03.CD.dir/FILE_001.dir | 815,887 | f8fd92f59c6871577c61cb626cb9ddb0db5ba884 |
|
||||
|
||||
All load @ vram 0x80128158. SC01/077 starts with CODE at offset 0x0 (no leading data word).
|
||||
|
||||
## Tasks
|
||||
- [x] **T0** — Overlay splat template (`config/splat.us.overlay.template.yaml`) + Makefile `-include config/overlays.mk` indirection. ✅ GATE: clean rebuild main `143dbb89…` + resident `8e17e02f…` BYTE-IDENTICAL (indirection proven a no-op; `overlays.mk` absent → silent `-include` → `BINARIES` unchanged).
|
||||
- [ ] **T1** — SC01/077 end-to-end. T1a scaffold · T1b all-asm byte-match (`d19c9580…`, milestone) · T1c seed boundaries + Ghidra import · T1d dedup-credit · T1e unique-remainder harvest (Ultracode §12 — prompt R26).
|
||||
- [ ] **T2** — Dup-pair collapse SC01/005≡006 (both `56760dbe…` from one shared source).
|
||||
- [ ] **T3** — Free-roam SC03/001 (`f8fd92f5…`); recipe scales to a large overlay.
|
||||
- [ ] **T4** — `tools/new_overlay.sh` one-command onboarding (gen `overlays.mk`; sentinel-insert 4 dicts; idempotent). GATE: onboard a fresh overlay in one command.
|
||||
- [ ] **T5** — `make build-all`/`check-all` (recursive `$(MAKE) BINARY=<b>`, aggregate PASS/FAIL).
|
||||
- [ ] **T6** — Docs (cookbook §13 runbook, SETUP R21, gen2-roadmap status, per-ov digests) + PhaseEnd (Tier-1).
|
||||
|
||||
## Current task
|
||||
→ **T1** (in progress). T0 done (template + indirection no-op proven). Next: T1a scaffold `ov_SC01_077` (instantiate the template; `overlays.mk` block; 4 Python dicts; check.sha=`d19c9580…`; empty symbols), then T1b iterate the code/data split to byte-identical.
|
||||
|
||||
Harness task list built (T0–T6; T0 completed, T1 in_progress) for Drew's monitoring — new standing preference saved to memory (`build-tasklist-after-plan-approval`).
|
||||
|
||||
## Blockers
|
||||
(none)
|
||||
Reference in New Issue
Block a user