Tooling
Extraction CLIs, the headless Ghidra workflow, runtime overlay capture, and the mednafen save-state automation toolkit. Each section below is a per-tool page with the full reference.
Pages
Extraction CLIs
Per-stage extraction binaries plus the top-level
legaia-extract orchestrator. Disc → ISO9660 → PROT.DAT → categorize → sub-asset extract → PNG.Ghidra in Docker
Headless Ghidra runs in a single Docker service. Setup, per-query invocations, the script catalogue, the LUI+ADDIU workaround.
Overlay capture
Static analysis hits a wall when code lives in RAM overlays at
0x801C0000+. Capture from mednafen save states, PCSX-Redux Lua dumps, or Duckstation .sav files.Static overlay pipeline
The static complement to overlay capture: extract each clean-copy runtime overlay straight from
PROT.DAT at its statically-recovered base, identity attached from the source entry. Solves the VA-aliasing identity problem; reproducible from the disc. Caught that the menu overlay is PROT 0899, not 0896.Mednafen automation
Scriptable substitute for mednafen's interactive memory-watchpoint debugger. Pairwise diffs, sequence bisection, declarative scenarios for blocked decompilation work.
PCSX-Redux automation
Closed-loop Lua probes layered on PCSX-Redux's breakpoint debugger. Save-state load → arm probes → capture N VSyncs → CSV / snapshot. Catalogue of committed probes.
Port catalog
Per-function status:
dumped × documented × ported × ignored. // PORT: and // REF: tags, BFS-from-roots feature views, ignore-list of statically-linked PsyQ infra, drift checker wired into the pre-commit hook, regenerable open-work dashboard.Determinism + replay
j-replay-v1 TOML format + legaia-engine record / replay subcommands + disc-free determinism cargo-test. Same input file run twice → bit-identical state-trace bytes; pad transitions captured from play-window's keyboard handler.Randomizer / disc patcher
Edits gameplay data on a user-supplied
.bin (monster drops, random-encounter formations, treasure-chest contents) via three new capabilities: an LZS encoder, Mode 2/2352 sector write-back (EDC/ECC re-encode), and a PROT-entry disc bridge. Same-size in-place edits; no Sony bytes committed.ROM patcher (in browser)
Run the randomizer client-side: supply your own disc image, toggle the drop / encounter / chest settings, and download a patched image. Nothing is uploaded - the patch runs in WASM in your browser.
Full extraction pipeline at a glance
The recommended end-to-end run:
./target/release/legaia-extract \
"/path/to/Legend of Legaia (USA).bin" --out extracted
--skip-png / --skip-verify skip the slow steps. Disc-gated tests (everything that touches a real .bin) run when LEGAIA_DISC_BIN is set; CI runs without disc data and the tests skip cleanly.