Decode SCINIT scene dispatch registry

This commit is contained in:
gamer147
2026-07-23 13:08:48 -04:00
parent f5b986e9f1
commit 9948f23a97
14 changed files with 359 additions and 40 deletions

View File

@@ -1,8 +1,8 @@
#!/usr/bin/env python3
"""Static decoder for SCJUMP.BIN's progression decision logic. Guarded DFS over its acyclic CFG
extracts, per decision site, the (chapter_mode, path-condition guards) -> decision value rule.
Decision->scene resolution is native (u00428010) and out of scope. See
docs/superpowers/specs/2026-07-07-scjump-decision-decode-design.md.
Decision->scene resolution is the SCINIT registry at G[0x87a57], consumed by
SYSTEM4 and related scripts. See docs/scjump-progression.md.
(no flag) -> build/scjump-decisions.json + build/scjump-decisions.md
--verify synthesize a witness per decision, run SCJUMP in vm0, assert emitted 0x62ccf matches"""
from __future__ import annotations
@@ -187,7 +187,7 @@ def emit_json(decs, names) -> str:
by_chapter = collections.defaultdict(list)
for d in out_decs:
by_chapter[d["chapter"]].append(d["decision"])
meta = {"note": "GENERATED by tools/scjump_decode.py do not edit. Decision->scene is native (u00428010), not resolved here.",
meta = {"note": "GENERATED by tools/scjump_decode.py; do not edit. Join decision ids to build/data/SCINIT.json for scene script resources and authored chapter metadata.",
"decision_sites": len({d["site_offset"] for d in decs}),
"distinct_decisions": len({d["decision"] for d in decs})}
return json.dumps({"meta": meta, "decisions": out_decs,
@@ -199,8 +199,8 @@ def emit_md(decs, names) -> str:
L = ["<!-- GENERATED by tools/scjump_decode.py — do not edit -->",
"# SCJUMP progression decisions (generated)", "",
f"{len({d['site_offset'] for d in decs})} decision sites. Each rule: guards (all true along the "
"path) -> decision value written to `0x62ccf`. Decision->scene is native (`u00428010`), see "
"`docs/scjump-progression.md`.", ""]
"path) -> decision value written to `0x62ccf`. `build/data/SCINIT.json` joins decisions "
"to scene scripts and authored chapters; see `docs/scjump-progression.md`.", ""]
by_ch = collections.defaultdict(list)
for d in decs:
by_ch[d["chapter"]].append(d)