AL_MAIN appearance variants and allocation-through-selector integration
17 October 2026 - VERIFIED within the bounded scope and limitations below.
Overall completion: 10% estimated weighted whole-project milestones, not code coverage.
Goal active. Continue Sol High; no model switch or pause advised.

What changed
Three further integer-only AL_MAIN.BIN bodies are recovered as static C:
  0c904aea..0c904bbc: 105 instruction rows, palette/material variant.
  0c904bbc..0c904c5e: 81 instruction rows, material ID 158.
  0c904c80..0c904d22: 81 instruction rows, material ID 161.
Together: 267 byte-checked rows / 534 instruction bytes, 26 conditional outcomes
and no external calls. Descriptive names and field purposes are inferred.
Source: source/sa_overlay_object_variants.c
Direct wrapper: source/sa_overlay_object_variants_connected.c

The new bridge source/sa_overlay_object_initializer_connected.c connects the
existing initializer 0c90fde4, marker reset, empty helper and model selector to
the real object setup 0c904d22, recursive clone, preorder table walks and three
new variants. Heap allocation/release and forward byte copy are native. The
new wrapper observes nested calls exactly once and publishes an inner guard's
actual stop PC. Earlier source files, DLLs and reports remain preserved.
Existing bodies, the new guard and their reuse receive no new routine credit.

Observed material behavior
All three original node lists are [1,3,6,9,11,13,15,18,20,22,25,36,38], followed
by ffffffff. Each helper copies its list to the original stack frame, follows
entity+24c's selected object table, and visits every material in each selected
model. It writes a zero-extended ID at material+0c and ORs 00400000 into
material+10. Other material bytes and all unselected materials remain intact.
The variable helper reads appearance+192 as an unsigned byte. Values 0..3
select IDs 217,218,219,220 from the original table; any larger byte selects 217.
The other helpers use IDs 158 and 161 respectively. These are data-field
updates; no texture images or visible pixels are generated by these tests.

Object setup calls the palette variant if appearance bit 40 is set, then
chooses a tail variant by priority 04 over 08. It restores its stack/saved
registers and caller PR before its tail branch. The outer initializer later
selects its own tail by priority 40 over 04 over 08. Tests distinguish these
nested choices and preserve the original order and raw wide-FMOV effects.

Allocation-failure finding and guard
The original clone can leave a parent whose child failed to copy. A short tree
then leaves table slot 34 unset, while the original model selector tries to
store through that missing node at 0c905572. The valid-destination selector is
reused unchanged. New support source/sa_overlay_selector_guard.c handles an
invalid destination by executing the original 21-instruction prefix, then
returning -3 before the unsupported FMOV store. It preserves original reached
registers and FPU changes and reports PC 0c905572. It does not invent successful
initialization, repair the partial tree or deliver a hardware exception.

Root-copy failure still stops in the existing root walker at 0c9044f2, after
its original output-table write. PR=1 stops at object setup's FLDI0 0c904d5e.
Small heap capacities exercise root failure, missing descendants and actual
native heap release when a copied child's model allocation fails. These cases
are expected partial executions, not completed initialized objects.

Verification design
The focused material verifier executes unchanged original instructions and
compares all 16 MiB RAM, integer registers, SR, PR, PC and FPU state. Its
separate semantic check applies only the documented ID/OR updates and verifies
all neighboring/unselected materials. All 256 appearance bytes and all eight
FR/SZ/PR combinations are covered for the variable variant. Zero, one and
multiple materials, unsigned clamping, physical/cached/uncached entity aliases
and empty lists are checked. Empty-list cases modify data only; instruction
bytes are unchanged. Combined tests use unchanged shipped root/list data.

The selector-guard verifier compares both the unchanged normal selector and
its exact partial prefix against original instructions across all eight modes,
representative flag priorities and valid/invalid destination classes. Invalid
cases verify that no RAM write occurs before the guard.

The combined verifier executes the original whole initializer, recursive clone,
walks, material variants, selector, heap/free/copy and reset helpers. It compares
full RAM/CPU/FPU and ordered boundary states, including a digest of every heap
byte at every boundary. Independent checks verify the allocated object tree,
seven 39-node preorder tables, type-7/type-0 alias, all material changes before
selection, selected model/scale and preserved data, resets, copies, masks and
the exact nested and outer variant order. All eight shipped types, four legal
setup transfer modes, representative model flags and appearance combinations,
explicit missing/error services, PR guards and bounded heap failure cases are
included. This combines previously isolated recovered bodies in one native path.

Build and tests actually passed
- Strict Clang -O2 -Wall -Wextra -Werror build passed for the combined DLL.
- 2,177 focused material comparisons passed: all 267 rows / 26 outcomes,
  47,438 material updates independently checked, zero external game services.
- 384 guarded-selector comparisons passed: 192 normal / 192 expected -3 stops.
  All eight transfer modes and valid/invalid destinations match full state;
  invalid cases stop after 21 original instructions with no RAM writes.
- 432 combined initializer comparisons passed: 368 completed tested caller
  paths / 64 exact partial states (14 missing services, 14 injected errors,
  four PR guards and 32 invalid-node guards). Every completed case passes the
  independent tree/material/selector/reset/order checks.
- 220,980 ordered boundary comparisons passed; 865 native rows, 61 outcomes
  and 40 call sites were reached in combined tests. This is integration-path
  coverage, not exhaustive coverage of every reused body or full-game code.
- All eight original appearance types and four legal setup modes pass. Both
  narrow and wide missing-node prefix guards are tested in both FPU banks.
  The combined chain calls native free eight times in descendant model-failure
  tests; the earlier object suite remains the broader allocation-cleanup proof.
- Generator source/manifest and dependency inventory reproduce byte-for-byte.
  All 10 translation / 19 material / 12 guard / 64 combined / 11 dependency-
  inventory pinned inputs match. Six Python and four PowerShell scripts parse.
  Repeat registration adds no duplicates and leaves registry bytes unchanged.
- Dispatcher mapping passes 658 pointer loads, 80 spans and 83 selectors.
  Audits: 1,105 entries / 1,102 unique pairs, 1,053 matches in 10,875 snapshot
  candidates, zero evidence errors, zero stale source reports. 211 non-texture
  binaries still have no function index. These are candidate snapshots only.
The complete historical aggregate was not rerun. Focused build/tests, new
registration, dispatcher checks and the two project audits were run.

The earlier integration attempt exposed the incomplete-tree failure rather
than a valid full clone. The final suite tests the new original-boundary guard
and the normal path separately; a failed copy is never counted as initialized.
The callback observer also recognizes copy-loop iterations separately from
actual call entries. Final successful reports use the final source and DLL.

Remaining explicit dependencies
Four initializer helpers still have state-mutating test stand-ins:
  0c90bd40, 0c90853e, 0c904e80, 0c9048ec
Three outer tail-state helpers also remain stand-ins:
  0c90fb82, 0c90fca0, 0c90fd42
There are no remaining variant stand-ins INSIDE object setup in the new combined
bridge. Earlier frozen standalone verifiers retain their historical fixtures.
Complete scenes, scheduling, draw calls, GPU pixels, audio/input, gameplay and
playable ports are not established. Existing bounded object-recovery exclusions
remain documented in OVERLAY_OBJECT_SETUP.txt. No full-game claim is made.

Next task
Seven remaining exports were byte-checked (1,510 rows), with zero recovered
credit. Inventory: analysis/overlay_initializer_dependencies_inventory.json;
reproduce with inventory_overlay_initializer_dependencies.py and read-only
ghidra/export_overlay_initializer_dependencies.ps1. The 813-row 0c904e80 draft
has floating-point mode and unreachable-block warnings; it remains analysis.
Recover the remaining initializer dependencies, starting with 0c904e80, then
connect object draw helper 0c905666 to the existing bounded native renderer.
Continue Sol High for reverse engineering. Luna Low can handle documentation-
only work, but a switch is not recommended for the next dependency.

How to check
Read this guide and SOURCE_HANDOFF.txt. All recovered C is available in source/.
Evidence:
  analysis/overlay_object_variants_translation.json
  analysis/overlay_object_variants_verification.json
  analysis/overlay_selector_guard_verification.json
  analysis/overlay_object_initializer_verification.json
To reproduce this focused checkpoint from PowerShell in the project folder:
  python -B recover_overlay_object_variants.py
  ./build_overlay_object_initializer.ps1
  python -B verify_overlay_object_variants.py
  python -B verify_overlay_selector_guard.py
  python -B verify_overlay_object_initializer.py
  python -B register_overlay_object_initializer.py
Read-only original export: ghidra/export_overlay_object_variants.ps1.
The aggregate build_and_verify.ps1 includes these stages before registry audits.
