THE EXIT-COURSE ABORT: WHAT IT ACTUALLY WAS
run link60, lane LC1, base cons 3a5733c03
===============================================================================

0. THE ONE-LINE ANSWER
----------------------

The crash was never slot 0. The abort message was lying, in three independent
ways, and slot 0 -- the slot it named -- has been seated since lane L4
(885cd16c2) and could not have been the caller.

The real trap was _ZTV5Stage SLOT 3, Stage::CleanupResources, and the reason it
was reached is a ROM global the port takes out of its sentinel state and never
puts back: data_02092664, Scene::SetSceneToSpawn's pending-scene id.

Nothing in this lane seats slot 3. Slot 3's abort is CORRECT and stays. What is
fixed is the port asking for a Stage teardown the ROM never asks for.


1. THE REPORT
-------------

playlog play_20260816_210444.log, cons tip 3a5733c03, real play:

    [menu] open
    [menu] ExitLevel()
    [menu] ExitLevel()
    [menu] closed
    [lvl] change: level 4 -> 1, entrance 13, reason 1
    FATAL: Stage vtable slot 0 (InitResources) is not hosted

Seventeen minutes in level 4 (castle basement), pause, exit course, abort.


2. DEFECT ONE: THE SLOT NUMBER WAS NEVER RECORDED
-------------------------------------------------

hal/stage_bridges.cpp:95, before this lane:

    static int hal_stage_trap_slot;

Declared. Read twice, at :99 and :100. WRITTEN NOWHERE IN THE TREE -- a grep
over the whole worktree returns three hits, all in that file, none of them an
assignment. hal_fill_stage_vtable put ONE st_trap into all twenty slots, and a
single function cannot know which table entry dispatched it, so the variable
sat at its .bss zero and every trapped slot in the table aborted as slot 0.

The correct pattern was already in the tree. hal/sub_actors.cpp:418-419 had it
for two of its eighteen slots:

    int __fastcall sa_trap13(void *s, void *) { g_trap_slot = 13; return sa_trap(s, 0); }

one thunk per slot, each recording its own index before reporting.


3. DEFECT TWO: THE NAME LOOKUP WAS A BITMASK
---------------------------------------------

Same expression, hal/stage_bridges.cpp:100:

    hal_stage_slot_name[hal_stage_trap_slot & 19]

`& 19` is a bitwise AND standing where a bounds clamp was meant. 19 is 0b10011,
so it preserves bits 0, 1 and 4 and discards bits 2 and 3. Twelve of the
eighteen real slots therefore name the wrong function even when the number is
right:

    slot  4 -> "InitResources"          slot 10 -> "AfterInitResources"
    slot  5 -> "BeforeInitResources"    slot 11 -> "CleanupResources"
    slot  6 -> "AfterInitResources"     slot 12 -> "InitResources"
    slot  7 -> "CleanupResources"       slot 13 -> "BeforeInitResources"
    slot  8 -> "InitResources"          slot 14 -> "AfterInitResources"
    slot  9 -> "BeforeInitResources"    slot 15 -> "CleanupResources"

Slot 3 is one of the six the mask passes through unchanged, which is the only
reason the corrected message for this crash reads correctly.


3b. DEFECT THREE: THE DEFAULT VALUE WAS ITSELF A VALID SLOT INDEX
------------------------------------------------------------------

The reason defect one produced a CONFIDENT wrong answer rather than an obviously
broken one is that all three slot variables defaulted to 0, and 0 is a real
slot. An unrecorded trap and a genuine InitResources trap printed the same
line, so there was nothing in the message to distrust and no reason to suspect
the reporter rather than the port.

This is separable from defect one and outlives it. The thunks make the variable
always-written today, but a default of 0 means any future path that reaches a
reporter without passing through a thunk silently names an innocent slot again.
All three now initialise to -1, which the range tests turn into "the trap did
not record its slot -- fix the thunk".

Two of the three were given -1 in this lane's first pass and
hal/sub_actors.cpp's g_trap_slot was left at its bare declaration. Review
caught it, which is a fair demonstration of the point being made here.


4. THE SWEEP: THE SAME BUG CLASS, THREE SITES
----------------------------------------------

Every trap reporter in the port was audited. There are three, and all three had
the recording defect; two had a bitmask where a bounds check belonged.

  hal/stage_bridges.cpp:95   hal_stage_trap_slot   never written   `& 19`
      20 slots, one bare st_trap in all of them.
      FIXED: st_trap0..st_trap19 + hal_stage_trap_thunk[20], real range test.

  hal/level_boot.cpp:3056    hal_player_trap_slot  never written   bounds OK
      31 slots (the Player, data_ov002_0210a83c), one bare ps_trap in all of
      them. Its `(unsigned)x < HAL_PLAYER_SLOTS ? ... : "out of range"` was
      already correct, so only the recording half was wrong.
      FIXED: ps_trap0..ps_trap30 + hal_player_trap_thunk[31].

  hal/sub_actors.cpp:378     g_trap_slot           16 of 18 bare   `& 17`
      sa_fill_shared installed a bare sa_trap in all eighteen and then
      overwrote 13 and 14 with self-recording thunks, so sixteen slots
      reported whatever g_trap_slot last held. And `kSlotName[g_trap_slot & 17]`
      (17 = 0b10001) mis-named even the two that DID record: slot 13 printed
      "BeforeInitResources" and slot 14 printed "InitResources".
      A second bare fill sat at :542 over _ZTV7dBase_c.
      FIXED: sa_trap0..sa_trap17 + sa_trap_thunk[18], real range test, both
      fills use the table, the now-redundant vt[13]/vt[14] lines removed, and
      g_trap_slot initialised to -1 -- it was the one of the three left at its
      bare declaration, i.e. at 0, i.e. still able to name InitResources.

"NO OTHER TRAP REPORTER EXISTS" WOULD BE OVERBROAD, so here is the measured
truth instead. 53 files in port/hal print "is not hosted". They fall in three
groups:

  3   the vtable trap reporters above: a name table indexed by a SHARED
      FILE-SCOPE slot variable. All three were defective, all three are fixed.
  49  actor_classes*.cpp. IMMUNE BY CONSTRUCTION, not by luck: each takes the
      slot as a FUNCTION PARAMETER handed in by per-slot thunks, and carries
      no name table to mis-index. There is nothing in them to get wrong.
  1   sub_screen.cpp:1227, which is not a vtable trap at all -- a one-shot
      notice that LoadFont3D was reached.

Swept port/hal for the two failure shapes specifically: a bitmask standing in
for a bounds clamp on a name table, and a shared slot variable that is read but
never written. ZERO LIVE INSTANCES REMAIN. The only surviving `& N]` text in
the tree is inside this lane's own comments describing the bug.

THE CLASS SWEEP IS COMPLETE AT ONE TABLE, which is worth stating because the
brief asked for "every stage vtable reachable by ExitLevel from every mounted
level". config/arm9/symbols.txt carries exactly one: _ZTV5Stage at 0x020921c0.
There is no per-level Stage subclass -- per-level behaviour comes from the
LVL_Overlay table at data_02092208, not from a derived class -- and the port
keeps ONE Stage object alive across every level change, so all 35 mounted
levels dispatch the same eighteen slots audited in section 5.

ONE THING THE SWEEP FOUND AND THIS LANE DID NOT CHANGE. _ZTV8dScene_c
(0x02092680, hal/stage_bridges.cpp:83) is declared as plain storage and is
never trap-filled, so it holds nulls rather than named traps. Stage::Stage
installs it transiently and _ZTV5Stage wins, so nothing dispatches through it
today -- but if anything ever did, the result would be a jump through a null
instead of the named abort the rest of the file is built around. Filling it
would be behaviour-neutral and is a one-line change; it is left alone here
because it is not on the reported path and this lane is already holding the
BMP-layout comparison still. Named so it is not rediscovered.


5. THE VTABLE, RE-DERIVED FROM config/arm9/relocs.txt
------------------------------------------------------

Not copied from the file's own comment. Read back from the relocation table,
_ZTV5Stage at 0x020921c0, one `kind:load module:main` per word:

    slot  0  0x0202cc0c  Stage::InitResources        SEATED  (st_init)
    slot  1  0x0202ddc8  Stage::BeforeInitResources  SEATED  (veneer target)
    slot  2  0x0202e62c  Scene::AfterInitResources   SEATED  (face)
    slot  3  0x0202c9a8  Stage::CleanupResources     TRAPPED <-- THE CRASH
    slot  4  0x0202e5f0  Scene::BeforeCleanupRes.    SEATED
    slot  5  0x0202e5d0  Scene::AfterCleanupRes.     SEATED
    slot  6  0x0202bbbc  Stage::Behavior             SEATED  (host occupant)
    slot  7  0x0202e3d4  Scene::BeforeBehavior       SEATED  (ROM body)
    slot  8  0x0202e3c8  Scene::AfterBehavior        SEATED  (face)
    slot  9  0x0202b8a4  Stage::Render               SEATED  (host occupant)
    slot 10  0x0202e3a4  Scene::BeforeRender         SEATED
    slot 11  0x0202e398  Scene::AfterRender          SEATED  (face)
    slot 12  0x0202b8a0  Stage::OnPendingDestroy     SEATED  (ROM body)
    slot 13  0x0204357c  ActorBase::Virtual34        SEATED
    slot 14  0x0204349c  ActorBase::Virtual38        SEATED
    slot 15  0x02043494  ActorBase::OnHeapCreated    SEATED
    slot 16  0x02023688  ~Stage (D1)                 TRAPPED (by design)
    slot 17  0x020236f0  ~Stage (D0)                 TRAPPED (by design)

0x020921c0 + 18*4 = 0x02092208, whose reloc goes to 0x02111210 module:overlays
-- the per-level LVL_Overlay pointer table. The vtable is EIGHTEEN words, not
twenty; host slots 18 and 19 are spares and stay trapped.

THE BODIES ARE REAL, checked by disassembly rather than by name, because a
recovered-from-vtable-slot name tells you nothing about the body. Read out of
extracted/arm9_dec.bin at base 0x02004000:

    Stage::InitResources     0x0202cc0c  e92d4ff0   push {r4-r11,lr}
    Stage::CleanupResources  0x0202c9a8  e92d41f0   push {r4-r8,lr}
    Stage::Behavior          0x0202bbbc  e92d4010   push {r4,lr}
    Stage::OnPendingDestroy  0x0202b8a0  e12fff1e   bx lr      (empty override)
    ~Stage D1                0x02023688  e92d4010   push {r4,lr}
    ~Stage D0                0x020236f0  e92d4010   push {r4,lr}

All six are real ARM functions. Slot 12's `bx lr` is the empty override
port/stage_lifecycle_map.txt section 9 describes, which is the confirmation
that the map's reading of that slot was right.

(A note for the next reader: extracted/dsd/arm9/arm9.bin does NOT decode at
these addresses -- it gives garbage at base 0x02004000 and at 0x02000000 --
while extracted/arm9_dec.bin does, which is what hal/stage_bridges.cpp's own
comment says it used. Whatever the general rule about which image to trust,
for arm9 .text at these addresses arm9_dec.bin is the one that reads.)


6. WHY SLOT 3 WAS REACHED
--------------------------

_ZTV5Stage slot 7 is Scene::BeforeBehavior, the ROM's own matched body
(src/_ZN8dScene_c14BeforeBehaviorEv.cpp), dispatched on the Stage every frame
since lane L4 put the Stage on the behaviour list. It contains:

    if (data_02092664 != 0x187) {
        if (data_0209f5bc->IsAtStart())    data_0209f5bc->SetForwardTime(0x1e, 0);
        else if (data_0209f5bc->IsAtEnd()) ActorBase::MarkForDestruction(self);
        return 1;
    }

`self` is the Stage. MarkForDestruction is not deferred bookkeeping: it sets
shouldBeKilled at +0x0f and calls OnPendingDestroy through the vptr. +0x0f is
what func_02043880 reads as its dirty flag, so phase 1 moves the Stage onto
data_020a4ba8 and the cleanup Process dispatches slots 4, 3 and 5. Slot 3 is
trapped. Abort.

port/stage_lifecycle_map.txt section 9 predicted this exact chain and ends
"AND SLOT 3 IS THE NEXT TRAP IN THE SAME CHAIN". It also said the correct
outcome is "a named abort NAMING THE SLOT". The abort did not name the slot;
sections 2 and 3 above are why.

WHERE THE MAP GUESSED WRONG, and it matters because the wrong guess is the
harder path. Section 9 blamed HitDeathPlane: it calls Scene::StartSceneFade(8,
0, 0) and "nothing in a level run spawns scene 8". Measured here, that branch
is behind `data_0209f2f4[0] != 0 || arg == 0` and data_0209f2f4[0] is LIVES, so
the StartSceneFade leg is the GAME-OVER leg and an ordinary death never takes
it. Driven directly through the ROM's own path (SM64DS_SELFTEST_OOB=200, level
6), HitDeathPlane took the SetNextLevel branch, wrote no pending scene, and the
run completed clean both before and after this lane's fix.

THE PATH THAT ACTUALLY FIRES IS THE DEBUG MENU'S LEVEL SELECT.
port_title_select (hal/level_change.cpp) runs dScTitle_c::Behavior's confirm
branch verbatim, and that branch ends in Scene::StartSceneFade(4, 0, 0) -- hand
off to the star select. In the owner's 26850-frame log the line

    [title] row 4 -> level 4 entrance 0, scene fade to 4 (white)

at line 1551 is the FIRST write of data_02092664 in the whole session. The
evidence that this is the trigger is in the same log: the reason-1 change at
line 885 (level 6 -> 2, entrance 8) SUCCEEDED, and it happened BEFORE that
line. The reason-1 change at line 1648 aborted, and it happened after.

WHY THE ARMING CHANGE ITSELF DOES NOT ABORT, which the log invites as an
objection: line 1554 is a level change (1 -> 4) that runs three lines AFTER the
latch is set and completes normally. The branch needs the INSTALLED FADER to
read at-end at the moment Scene::BeforeBehavior runs on the Stage, and at the
arming change it cannot. port_title_select starts a fresh 16-frame colour fade
in the same breath as the StartSceneFade, and walk_window HOLDS the change until
that fade has covered (scene_fade != 1, walk_window.cpp:5031); the change then
applies on the very frame the cover completes. Across that whole window the
fader is in motion, not parked, so no frame between the write and the teardown
offers an at-end reading. The exit change has no such gate -- ExitLevel is one
of the paths that "applies the frame it is pending" -- and by then the fade-in
has finished and left the fader parked at an end, so the first
Scene::BeforeBehavior of the teardown marks the Stage. Reproduced in this lane's
own runs: the first change is clean on the base binary and the second aborts.

AND THE MARK LANDS INSIDE THE TEARDOWN, not before it. port_level_teardown runs
port_actor_tick within its own rounds loop (hal/level_change.cpp:581-595), so
round 0's behaviour pass is what marks the Stage, phase 1 moves it onto the
cleanup list, and the next round's cleanup pass dispatches slot 3. That is why
the FATAL prints with no teardown output ahead of it and why the whole failure
fits between the "[lvl] change:" line and the next line that would have been
logged.


7. THE ACTUAL DEFECT: A SENTINEL THE PORT NEVER PUTS BACK
----------------------------------------------------------

data_02092664 is the pending-scene id and 0x187 is its "nothing pending"
sentinel, its value in the ROM's .data. Two functions take it out of that state
and one puts it back. The pair that matter here are both matched src in this
tree:

    Scene::SetSceneToSpawn(id, param)   data_02092664 = id
        src/_ZN8dScene_c15SetSceneToSpawnEjj.cpp
    Scene::SpawnIfNecessary()           spawn the scene, THEN
                                        data_02092664 = 0x187
        src/_ZN8dScene_c16SpawnIfNecessaryEv.cpp

THE THIRD WRITER, named because it is a live tripwire for whoever slices in the
boot spine. Scene::PrepareToSpawnBoot (0x0202e300,
src/_ZN8dScene_c18PrepareToSpawnBootEv.cpp) also writes data_02092664 -- to 0 or to
0x168, never to the sentinel -- and clears data_02092660 with it. It is
UNREACHABLE TODAY: its only caller is func_0201a054 (src/func_0201a054.c:75),
which is on the unsliced boot spine, and neither symbol appears in
walk_window.map. Checked, not assumed.

THE WARNING THAT GOES WITH IT: the day that spine is sliced in, the sentinel is
poisoned FROM BOOT rather than from a menu action, and port_scene_request_release
would then quietly release a request the ROM genuinely intends SpawnIfNecessary
to consume. The release is correct only while the port declines every scene
spawn. A lane that gives the port a real scene spawner must revisit this
function, not inherit it.

THE PORT RUNS THE FIRST HALF AND NOT THE SECOND, ON THE LEVEL PATH. It has no
spawner for the ov003 scenes -- hal/level_change.cpp's StartSceneFade block
documents why at length (ov003's .text is not mounted, the star grid's 2D
resources are not staged) -- so nothing in a level run consumes the id and it
stays where the writer left it for the rest of the session. The port records
the request in a HOST variable, g_scene_fade_scene, and port_scene_fade_clear
clears only that host variable. The ROM global was never touched again.

"NEVER RUNS" WOULD BE TOO STRONG, and the exception is worth knowing:
port_scene_boot (hal/scene_boot.cpp:1990, the SM64DS_SCENE harness) calls
Scene::SpawnIfNecessary for real, right after its own SetSceneToSpawn, and the
battery's scene selftests go through it. That path consumes the id the way the
ROM does and needs nothing from this lane. It is the LEVEL path -- the one a
player is on -- that has no consumer.

So: use the debug level select once, then exit any course, and the Stage is
marked for destruction on the way out. One menu action poisons every later
level change in the session.

THE FIX IS THE HALF OF THE ROM'S OWN TRANSITION THE PORT WAS MISSING. Once the
port has done everything it is going to do about a pending scene request, it
completes SpawnIfNecessary's state change -- the sentinel goes back -- without
the spawn it has already declined. port_scene_request_release, defined in
hal/level_change.cpp beside the block that explains the decline, called from
two places:

  * port_scene_fade_clear -- the title-select path's own consume point: the
    fade has covered, the level behind it is up, the request has had every
    effect the port can give it.
  * the top of port_level_change_apply, BEFORE port_level_teardown. That
    ordering is the fix for any writer that never arms a host fade request:
    releasing on the far side would let that very teardown dispatch slot 3.

It does NOT invent a scene. It deliberately does NOT touch data_02092660,
SpawnIfNecessary's "already spawned" latch, because writing that would claim a
spawn that did not happen. On a session that never arms a scene fade the
function never fires.

SM64DS_SCENE_LATCH=1 declines the release and restores the pre-fix behaviour
exactly, which is how the abort is reproduced from a fixed binary.


8. WHAT THIS LANE DELIBERATELY DID NOT DO
------------------------------------------

IT DID NOT SEAT SLOT 3, and that is a decline with evidence. Section 5 of
port/stage_lifecycle_map.txt measures Stage::CleanupResources at seven pieces
(Sound::ResetPlayerVoiceGroup, Message::ResetAllGlobals, FaderWipe::~FaderWipe,
data_020756f0, func_01ffb0c8 in ITCM, plus the UnloadArchive /
UnloadLevelOverlays host bodies), and section 7 names "a Stage teardown (slots
3, 12, 16, 17 as one job)" as explicitly out of scope for a single lane.

More to the point, the abort is RIGHT. A port whose Stage is being torn down
has lost the scene root, the level collider and the level model. Seating slot 3
with anything other than its ROM body would be hand-faked game logic, and
seating the ROM body without the rest of the teardown would trade a named abort
for a silent one. The defect was upstream of the refusal, and that is where it
is fixed.

Slots 16 and 17 stay trapped for the same reason and are now correctly named if
they ever fire.


9. THE RESIDUAL, NAMED RATHER THAN LEFT TO BE REDISCOVERED
-----------------------------------------------------------

ONE PATH CAN STILL LATCH THE SENTINEL WITH NO LEVEL CHANGE TO RELEASE IT: the
game-over leg of HitDeathPlane (hal/star_flow.cpp:124-128), which fires when
data_0209f2f4[0] -- lives -- is 0 and arg is nonzero. It calls
StartSceneFade(8, 0, 0) and StartExitFaderWipe(6) and requests no level change,
so neither release point is reached and Scene::BeforeBehavior can mark the
Stage during ordinary play.

NOT PAPERED OVER ON PURPOSE. Scene 8 is the game-over scene and the port does
not host it; releasing the sentinel there would silently swallow game-over
instead of refusing it, and a named abort is the more honest answer until the
port has that scene. It needs lives to reach 0 to be reached at all, it is not
the reported crash, and it wants a different fix from this one. Flagged for
whoever takes the scene work.


10. VERIFICATION
-----------------

BUILD IDENTITY. Own worktree C:/tmp/lc1, own build dir C:/tmp/lc1/build/port,
CMakeCache CMAKE_HOME_DIRECTORY = C:/tmp/lc1/port, own extracted/ (copied, not
linked), own asset catalog generated from the local ROM.

GATES.

  opening  3a5733c03, tree clean
           linked 5831 / 11250 (51.8%), unlinked 5419
           battery ALL GREEN, skips []
           verdict GREEN

  closing  same tree plus this lane's four files
           linked 5831 / 11250 (51.8%), unlinked 5419   delta 0
           battery ALL GREEN, skips []
           verdict GREEN
           exe sha256 f61f33e9f8b5367c270add344eb59213c727d9250051d13aba06370a416f1a7b
           map 4059327 bytes, 37488 symbol rows (base: 4052685, 37411)

THE GATE WAS RUN TWICE, and the second run is the one quoted. Review's
amendments added one code line (g_trap_slot = -1, section 3b) and it landed
after the first closing gate, so that gate was measuring a tree that had moved
under it and its numbers are not quoted here. The re-gate above is a clean run
on the settled tree.

THE AMENDMENT DID NOT MOVE THE MAP BEYOND ITS OWN LITERAL, which is the thing
worth checking about it: `int g_trap_slot;` to `int g_trap_slot = -1;` moves the
symbol from .bss into .data and changes nothing else. Map size 4059327 bytes and
37488 symbol rows BOTH IDENTICAL across the two links, .dsstate base and span
unchanged, and the level 1 / level 6 BMPs and the landing BMP all still hash
exactly as they did before it.

Delta zero is expected and is not a null result: this lane seats no new body
and references no previously-dropped TU. It changes which pointer goes into a
trap slot, adds one host function, and fixes two report strings. Nothing was
recorded with --record: the baseline stands at the opening measurement and the
closing run is a plain read against it.

EVERY MEASUREMENT BELOW WAS TAKEN OFF THE GATED BINARY, sha256 f61f33e9...,
re-run after the gate relinked rather than carried over from an earlier build.
The landing BMP hash is identical across all three links this lane produced,
which is the determinism check.

THE THUNKS ARE NOT FOLDED, and this is the check that matters most for the
mechanism: /OPT:ICF merges identical COMDATs, and 69 trap thunks that differ
only in one immediate are exactly the shape it eats. If it had folded them the
recording would silently go back to reporting one wrong slot for everything --
the original bug, restored invisibly. Counted in walk_window.map:

    st_trap0..19    20 symbols, 20 distinct addresses   stage_bridges.cpp.obj
    ps_trap0..30    31 symbols, 31 distinct addresses   level_boot.cpp.obj
    sa_trap0..17    18 symbols, 18 distinct addresses   sub_actors.cpp.obj

69 for 69, on two separate links.

THE +77 SYMBOL ROWS, ITEMISED PROPERLY. An earlier draft of this file waved at
the number with a list that only came to 73; the map diff gives 80 added and 3
removed, and the itemisation matters because it is the real delta-0 argument --
every added row is this lane's own scaffolding and none of it is a game body:

    added, 80
      67  new thunks: 20 st_trap + 31 ps_trap + 16 sa_trap. SIXTEEN, not
          eighteen, because sa_trap13 and sa_trap14 already existed -- they
          were the two slots sub_actors.cpp had already got right.
       3  the thunk tables
       1  port_scene_request_release
       1  its `keep` static
       6  string literals
       2  filler
    removed, 3
       1  the old "out of range" literal
       2  filler

80 - 3 = 77, which is 37488 - 37411. Nothing here resolves a previously dropped
TU, which is why linked stays at 5831.

.dsstate LAYOUT, base AND span, read off both maps -- the precondition for any
BMP comparison to mean anything:

    base build   _dsstate_lo 0x00bb0000   _dsstate_hi 0x00c9ab30
    fixed build  _dsstate_lo 0x00bb0000   _dsstate_hi 0x00c9ab30

Identical. The trap thunks and the release function land in .text/.rdata/.data,
outside the captured section, and no hosted global moved.

SELFTEST BMPs, 300 frames, against this lane's OWN base build:

    level 1  9129ce6cf3a229d4eb650927c5a68e6f8af3c2cd4af5cfbf8a134c063e4771f4
             base and fixed IDENTICAL
    level 6  d59e09f133c053b307077363ce2efd0cc91513cf80b30836a1d65763f7cef20f
             base and fixed IDENTICAL

THE REPRODUCTION, on the untouched base binary, using only hooks that were
already in the tree and only the game's own functions:

    SM64DS_WINDOW_SELFTEST=600 SM64DS_LEVEL=1 \
    SM64DS_MENU_WARP_TEST=4,60 SM64DS_LEVEL_CYCLE=1,300 walk_window.exe

SM64DS_MENU_WARP_TEST runs the MENU_LEVEL enter branch verbatim -- the same
port_title_select the player's menu calls -- and SM64DS_LEVEL_CYCLE calls the
game's own ExitLevel(), the same function walk_window.cpp:3830 calls from the
menu. Result, byte-identical to the owner's report:

    [lvl] change: level 4 -> 1, entrance 13, reason 1
    FATAL: Stage vtable slot 0 (InitResources) is not hosted            exit 127

300 frames instead of seventeen minutes.

THE CONTROL THAT ISOLATES THE CAUSE. Same binary, same ExitLevel, same level 4,
same destination -- only the menu select removed, so nothing latches:

    SM64DS_WINDOW_SELFTEST=600 SM64DS_LEVEL=4 SM64DS_LEVEL_CYCLE=1,300

    [lvl] change: level 4 -> 1, entrance 13, reason 1
    [lvl] level 1 up. heap free: 220140 before, 239072 torn down, 182600 after
                                                                        exit 0

The exit path was never broken. The latch was.

THE TRUE SLOT, from the fixed binary with the latch held open:

    SM64DS_SCENE_LATCH=1 ... same command as the reproduction

    [lvl] change: level 4 -> 1, entrance 13, reason 1
      [scene] pending scene 4 KEPT (a level change is being applied): ...
    FATAL: Stage vtable slot 3 (CleanupResources) is not hosted         exit 127

AFTER, default:

    [lvl] change: level 4 -> 1, entrance 13, reason 1
    [lvl] level 1 up. heap free: 220140 before, 239072 torn down, 182600 after
                                                                        exit 0

The heap triple is identical to the never-latched control, which is the
statement that the fix restores the un-poisoned path rather than a new one.

RUN-OUT. 900 frames, 600 of them past the change. The player is alive at
(-1198.5, 667.6, 1954.2) on the castle grounds, animation advancing (cur 10
through 15 over the last six frames), camera tracking, heap 207812 free at
frame 900. Landing frame captured:

    build/port/walk_window_selftest.bmp, saved as
    final_landing_level1_ent13.bmp
    sha256 b867e9928236e4581d531cd4169443ef9bf2222cf8910cab30556f2557b93f18
    .dsstate base 0x00bb0000, span 0x000eab30 (equal to base, as above)

    The same hash came off the pre-gate build and the gated one, so the
    landing frame is deterministic rather than a single sample.

MENU-EXIT FROM FIVE LEVELS, each run twice, fixed and latched:

    row/level                     fixed          latched
     4  castle basement    ->  1  exit 0         slot 3, exit 127
     6  Bob-omb Battlefield->  1  exit 0         slot 3, exit 127
     7  Whomp's Fortress   ->  1  exit 0         slot 3, exit 127
    10  Cool Cool Mountain ->  1  exit 0         slot 3, exit 127
    12  Big Boo's Haunt    ->  3  exit 0         slot 3, exit 127

Every fixed run booted its destination level. Row 12 exits to level 3 entrance
0 rather than level 1 entrance 13 because Big Boo's Haunt is entered from the
castle garden; that is the game's own destination and it exercises the fix on a
non-castle-grounds exit.

DEATH PLANE, the ROM's own HitDeathPlane path (SM64DS_SELFTEST_OOB=200, level
6), fixed and latched: both exit 0, both boot level 1 entrance 13 reason 2, no
`[scene]` line in either -- nothing pending, as section 6 says.

THE AB1 HEAP-TEARDOWN DEFECTS WERE NOT REACHED. ExpandingHeapAllocator::
DeallocateAll and HeapAllocator::Remove (hal/lk4_eh_dtor_seat.cpp) were watched
for across every run above; nothing in this lane's path faulted in them and
nothing here touches that file. This lane REMOVES pressure from that area
rather than adding it -- the aborting runs were the ones tearing the Stage
down, and a Stage teardown is what would drive _ZTV13ExpandingHeap slot 5
hardest. Left for the lane that takes the full set.


11. FILES
----------

  port/hal/stage_bridges.cpp   per-slot trap thunks, -1 default, real bounds
                               test, the account of all three defects
  port/hal/level_boot.cpp      per-slot Player trap thunks, -1 default
  port/hal/sub_actors.cpp      per-slot trap thunks for both fills, -1 default,
                               real bounds test, redundant vt[13]/vt[14] removed
  port/hal/level_change.cpp    port_scene_request_release + its two call sites
  port/exitlevel_seat.txt      this file

No src/ TU was edited. No matched code was touched.
