"""Recover the ISL interpreter's 1023-slot command table from sub_822FE040. The builder fills every slot with a default, then overwrites individual slots. Each write is `stw rX, off(r1)` (a two-word stack pair) followed by `ld r9, off(r1)` and `std r9, N(r31)`, where slot = (N - 32) / 8. """ import duckdb, re, sys def _resolve_db(): """`$SYLPHEED_DB`, else `$SYLPH_XEXDB`, else `/sylpheed.db`. `SYLPHEED_DB` is the documented contract -- `docker/decoder/sylph-decoder` sets it and `docs/agents/CONTAINER-NOTES.md` lists it -- but no reader honoured it: this script hardcoded `/work/xenia-rs/sylpheed.db`, a path that has not existed anywhere since `/work` became a clone, so it failed on every machine. """ import os, pathlib for var in ('SYLPHEED_DB', 'SYLPH_XEXDB'): v = os.environ.get(var) if v: p = pathlib.Path(v).expanduser() if not p.is_file(): sys.exit(f'${var} is set but is not a file: {p}') return str(p) p = pathlib.Path(__file__).resolve().parents[2] / 'sylpheed.db' if p.is_file(): return str(p) sys.exit(f'no database: set $SYLPHEED_DB, or build {p} with ' 'sylph-xexdb dis --db sylpheed.db --analyze sql --quiet') con=duckdb.connect(_resolve_db(), read_only=True) rows=con.execute("select address, coalesce(ext_disasm,disasm) from instructions " "where address>=? and address %s %s" % (s, '%08X'%hi if hi else 'None', '%08X'%lo if lo else ''))