Add semantic append INIT inspection

This commit is contained in:
gamer147
2026-07-24 09:45:40 -04:00
parent e23825a18b
commit 801a4fbfe0
9 changed files with 326 additions and 32 deletions

View File

@@ -239,6 +239,12 @@ scene-local numeric addressing mode.
mappings. Mounting an AAI therefore only makes its packed records addressable. Executing its AUTORUN
is the separate operation that materializes append data and registers append control flow.
Tooling can inspect one packed INIT fragment without claiming that AUTORUN has executed:
`extract_init.py EBINIT --packed-id 0x01000001` resolves the selector/index through the AAI catalog,
reads the bounded ALF payload in memory, and applies the base EBINIT geometry to its additive writes.
The separate `APPEND01-EBINIT` result preserves packed provenance and can be queried by unit id or name
with `init_table_profile.py --record`; it is not an ordered merged runtime image.
The base/loose script corpus contains no reference to packed id `0x01000000`. The shipped game must
therefore enter the append AUTORUN outside the visible base script call graph, but the exact native
launcher and its ordering relative to SYSTEM4/INIT2 have not yet been reversed. The current port can

View File

@@ -724,15 +724,21 @@ The v1 map labels *shapes and tables*; the next increments add *meaning*, cheape
known value in-game (take damage, gain XP), watch which global moves → definitive
`field@X = "HP"`. Reserve for the fields that matter; this is the last mile.
**Append semantic-coverage caveat (2026-07-24).** The current `paths.scripts()` corpus and
`extract_init.py` resolution path include DATA1 plus loose root overrides, but not selector-keyed AAI
records. Consequently generated `build/data/EBINIT.json` describes the base/loose EBINIT only. Installed
`$1$AUTORUN.BIN` calls additive append INIT fragments; `$1$EBINIT.BIN` adds unit rows 81 and 900..905 to
the same global schema, and `$1$CNINIT.BIN` supplies the companion names/voice families. A future append
semantic pass should enumerate packed scripts from the runtime catalog, preserve `(pack selector, raw
index)` provenance, extract each INIT fragment with the existing schemas, and merge base/append assignments
only after the native AUTORUN ordering is proven. The AAI format and verified internal call sequence are
canonical in `docs/asset-resolution-re.md`.
**Append semantic coverage (2026-07-24).** The ordinary `paths.scripts()` corpus still represents DATA1
plus loose root overrides, so generated `build/data/EBINIT.json` remains the base/loose table. For focused
inspection, `extract_init.py EBINIT --packed-id 0x01000001` now loads `$1$EBINIT.BIN` directly through its
AAI/ALF catalog coordinates and writes the separate `build/data/APPEND01-EBINIT.json`. It applies the
canonical base EBINIT geometry rather than re-inferring a misleading seven-row layout, preserves packed-id
and fragment-layout provenance, and gives all additive rows the existing EBINIT semantic field names.
`init_table_profile.py APPEND01-EBINIT --record ID_OR_NAME` renders one row as semantic
field/value/raw-coordinate triples. Regression coverage fixes the seven row ids (81 and 900..905) and
representative unit-81 level, stat, growth, and selector-keyed asset values.
This is deliberately a fragment view, not a synthesized boot image. `$1$CNINIT.BIN` supplies companion
display-name/voice-family writes, other INIT fragments may add related definitions, and native AUTORUN
ordering remains unresolved. Whole-pack enumeration and ordered base/append assignment merging should wait
until that engine-owned launch boundary is proven. The AAI format and verified internal call sequence are
canonical in `docs/asset-resolution-re.md`; command usage is canonical in `docs/tools-reference.md`.
Re-run `tools/global_map.py` after each increment; `sys4load` picks up the new labels
automatically (it reads `build/global-var-map.json` at load).

View File

@@ -3328,3 +3328,23 @@ shared-profile registration.
**Next:** investigate the highest-use remaining auto-shaped row table, the stride-10 table at
`G[0x3ebe]` (21 references across CALCREVISE, CHMENU, DRAWTIP, GAMECLEAR, GAMESTART, IMPROVE, and
TUNE).
## Data-semantics sidebar: focused append EBINIT inspection (2026-07-24)
The static INIT surface now accepts a universal packed script id for focused append inspection.
`extract_init.py EBINIT --packed-id 0x01000001` locates selector 1's AAI catalog, bounds-checks and reads
`$1$EBINIT.BIN` from its ALF range, and parses the payload in memory. Because this script is an additive
fragment, extraction imports the base EBINIT name-array base, first id, and 1,000-row span rather than
misclassifying its sparse writes as an independent layout. The generated `APPEND01-EBINIT` artifact remains
separate from base EBINIT and records both packed-resource and base-layout provenance.
The fragment contains seven unit rows: 81 and 900..905. Their raw arrays and row-major cells project
through the existing, fully named EBINIT schema; selector-keyed graphics remain full packed ids. A new
`init_table_profile.py --record ID_OR_NAME` view prints a single unit's authored descriptions and
semantic-field/value/raw-coordinate table, with large resource values also rendered in hexadecimal.
Regressions cover packed loading, the complete sparse id set, inherited geometry, representative unit-81
level/base-stat/growth fields, and its packed battle-sprite id.
This closes the immediate “inspect an append unit semantically” need without asserting that the runtime
has executed `$1$AUTORUN.BIN`. Ordered whole-pack merging and natural port bootstrap still depend on the
unresolved native AUTORUN launch boundary documented in `docs/asset-resolution-re.md`.

View File

@@ -60,6 +60,30 @@ All opcode knowledge (ABI, semantics, provenance, `depends_on`) is hand-edited *
| `test_extract_init.py`, `test_init_table_profile.py` | Regression checks for sparse one-based, mixed selector-dispatched, CCINIT rule, SCINIT dispatch, RTINIT banked, ILINIT condition-matrix, CNINIT unit-name/voice-family, CGINIT gallery, ALINIT alchemy-recipe, AFINIT affinity/progression, CTINIT name-entry-palette, CVINIT character-voice, TRINIT training-action, CDINIT card-generation, CDINIT2 card-effect, BTANINIT/BTANINIT2 battle-animation, STINIT2 stage-definition, and MPINIT terrain-atlas extraction; RECOVER ABI validation; MES reconstruction/joins; footer-array accounting and semantic projection; EBINIT/SKINIT/OBINIT definition joins; STINIT object/enemy joins and tagged-payload behavior; overwrite/provider joins; and field/message/rule/dispatch/banked/map/training/card/battle-animation/stage profiling. | run each directly | — |
| `global_map.py` | Build the partial global-variable name map from static evidence. | `global_map.py` | corpus + `build/data/``build/global-var-map.{json,md}` |
For selector-keyed append INIT fragments, pass the universal packed script id:
```powershell
py -3.11 -X utf8 tools/extract_init.py EBINIT --packed-id 0x01000001
```
The extractor finds the mounted AAI by the packed id's high-byte selector, bounds-checks and reads the
indexed ALF payload, and parses it without materializing an extracted `.BIN`. Packed EBINIT fragments reuse
the base EBINIT table geometry so their additive writes retain the same semantic field names. Output is
kept separate as `build/data/APPEND<selector>-<TABLE>.json` and records `packed_id`,
`source`, and `fragment_layout_source`; it is not an inferred base/append merge. Matching base MES data is
not joined to a packed fragment.
Use the profiler's focused record view to inspect a unit by integer id, exact name, or name regex:
```powershell
py -3.11 -X utf8 tools/init_table_profile.py APPEND01-EBINIT --record 81
py -3.11 -X utf8 tools/init_table_profile.py APPEND01-EBINIT --record "紫色の珍獣/BOSS"
```
`--record ID_OR_NAME` prints the INIT description strings and a semantic-field/value/raw-provenance table;
packed asset values are shown in both decimal and hexadecimal. It is mutually prioritized over
`--message-query` for console rendering, while `--build` may still be used to write the complete profile.
`extract_init.py` also has name-mode specializations for VIINIT's sparse 200-row glossary table,
CNINIT's 277 EBINIT-keyed display-name/voice-family rows within parallel 1,000-cell arrays,
CIINIT's 24 populated character-information profiles within four reserved 100-cell columns, MAINIT's