Files
Thomas MartinandClaude Opus 5.5 0cfd512cf4 Add disc extractor, reverse-engineering tools and feasibility audit
- tools/extract.py: pure-Python extractor for SLES-54645 (ISO9660, SLZ chains,
  SLE decryption, module/overlay export with ELF segment validation, IRX, index)
- tools/slz.py: tri-Ace SLZ types 0-3 and SLE decryption, reimplemented from
  the game's own routines
- scripts/, ghidra_scripts/: exploration scripts used during the audit
- toolchain/Dockerfile: analysis container (binutils MIPS, Python)
- docs/AUDIT.md: phase 1 and 2 feasibility audit (GO for static recompilation)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-20 18:57:22 +02:00

25 lines
1.2 KiB
Python

"""Cross-check extractor output against the reference scan (work/parts from scan_parts.py)."""
import glob
import hashlib
import json
import os
out = "/work/out"
mods = json.load(open(f"{out}/modules.json"))
ref = {os.path.basename(p).rsplit("_", 1)[1][:10] for p in glob.glob("/work/work/parts/*.bin")}
got = {m["sha1"][:10] for m in mods}
print(f"extractor modules: {len(got)}, reference: {len(ref)}, identical: {len(got & ref)}, "
f"only extractor: {len(got - ref)}, only reference: {len(ref - got)}")
for m in mods:
data = open(f"{out}/modules/{m['file']}", "rb").read()
assert hashlib.sha1(data).hexdigest() == m["sha1"], m["file"]
print("module files match their recorded sha1")
print("sample:", json.dumps({k: mods[0][k] for k in ("file", "id", "load", "slots", "code_start", "text_size",
"bss_size", "matches_elf_segment")}))
named = [m["file"] for m in mods if m["name"]]
print(f"named overlays: {len(named)} e.g. {named[:4]}")
print("iop:", sorted(os.listdir(f"{out}/iop")))
print("iso:", sorted(os.listdir(f"{out}/iso")))
man = json.load(open(f"{out}/manifest.json"))
print("manifest:", {k: man[k] for k in ("chains", "parts_by_kind", "modules", "seconds")})