# slice_w8a.txt -- lane-owned slice for the linkage campaign (run linkw,
# wave 8, lane w8-a: THE STAGE CLASS CLOSURE, first landed piece). One matched
# src TU per line, path relative to the repo root, comments with #. ONE OWNER
# (lane w8-a).
#
# ===========================================================================
# THESE NINE ARE COMPILED AND THEN DISCARDED. THAT IS THE POINT OF THE ENTRY,
# NOT A DEFECT IN IT.
# ===========================================================================
#
# Every TU below compiles into walk_window and is then stripped by /OPT:REF,
# because nothing in the link names it. linkage.py counts them out, correctly:
# the campaign's number is how much of the decomp RUNS, and a body with no
# caller does not run. Linkage at this tip is 4623, the same as the base.
#
# The first draft of this piece rooted the eight Stage bodies with eight
# /include: directives in hal/w8a_stage_faces.cpp and reported 4634. Review
# removed only those eight lines and re-measured: 4623 exactly. The whole +11
# was directive-manufactured. The directives are gone. What is left is
# groundwork -- the class's storage, its faces, and its bodies staged in the
# build -- and it is worth landing on its own terms, but it moves no number.
#
# What reaches them is the _ZTV5Stage seat in hal/stage_bridges.cpp, which
# this lane does not own, and which covers AT MOST FOUR of the eight Stage
# bodies here (slot 1 BeforeInitResources, slot 12 OnPendingDestroy, slots
# 16/17 the destructors). GraphCallback1, CanPause, IsPauseDisabled and
# UpdateMenuButtons are reached from the SceneRelated graphics block,
# Stage::Behavior and Stage::PS_Update/VE_Init/VE_Update/LC_Update
# respectively -- all still blocked. The header of hal/w8a_stage_faces.cpp
# has the full accounting, including why slot 12 will need a face or a
# __fastcall thunk even after the seat lands.
#
# ===========================================================================
# WHERE THE NINE COME FROM
# ===========================================================================
#
# A throwaway probe wired every src/_ZN5Stage* TU that no slice already names
# -- 29 files -- into walk_window and read the link:
#
#     walk_window.exe : fatal error LNK1120: 171 unresolved externals
#
# EIGHT of the 29 are the ones whose every external reference resolves, and are
# below with the one callee they drag that no slice already names. Seven need
# nothing beyond what today's link already provides; the eighth,
# Stage::UpdateMenuButtons, needs four globals from the storage batch
# (hal/w8a_stage_storage.cpp) that lands with it.
#
# THE OTHER TWENTY-ONE, each with the blocker that holds it out. No TU is held
# out for taste; several have more than one blocker and the first is named.
#
#   ov002 BSS the ov002 mount does not carry (the pause/VS sprite templates at
#   0x0210caf4..0x0210d420 and the OAM::PAUSE family) -- a row in
#   port/ov002_syms.txt, which this lane does not own:
#       Stage::LC_Render, Stage::PS_Render, Stage::RenderVsModeCountdown,
#       Stage::RenderVsModeNewStar
#
#   arm9 .rodata / .data, which wants REAL ROM BYTES through the romdata
#   emitter and NOT zero storage (data_020755b8, data_020755c0/c4/c8/cc,
#   data_02075610, data_020756d0/f0, data_0208ee3c/40, data_02092778):
#       Stage::PS_UpdateSaveMenu, Stage::PS_UpdateOptionsMenu,
#       Stage::PS_UpdateOkAndBackButtons, Stage::RenderNumber,
#       Stage::CleanupResources, Stage::PS_Update
#
#   data_020a0dea, byte +2 of the TouchInfo block hal/auto_bss.cpp already
#   hosts -- see the blocked note in hal/w8a_stage_storage.cpp:
#       Stage::LC_Update, Stage::VE_Update
#
#   a C-name face onto a matched TU that is itself unwired, plus that TU's own
#   closure (Sound::PauseMusic and Sound::UnpauseMusic reach data_0208e424 in
#   .data; G3X::SetFogTable reaches src/Copy32Bytes.c, which is ARM asm MSVC
#   cannot assemble; Message::DisplayVsExitText reaches func_020341a8, which
#   reaches data_0208f174 and data_02092818 in .data):
#       Stage::PS_Cleanup, Stage::PS_Init (.c and .cpp both), Stage::RenderFog,
#       Stage::VE_Init, Stage::Behavior, Stage::Render
#
#   NOT HOSTABLE AT ALL. Stage::GraphCallback2's whole body takes the address
#   of reg_G2S_DB_BG3PA and MSVC cannot put a global at 0x04001030.
#   hal/sub_actors.cpp's port_minimap_affine_update is its stand-in and says so:
#       Stage::GraphCallback2
#
#   THE FADER TABLE AND A COLOUR DESTRUCTOR. Stage::CleanupResources calls
#   FaderWipe::~FaderWipe, and that IS matched --
#   src/engine/fader/_ZN9FaderWipeD1Ev.cpp, 0x02017450 (config/arm9/delinks.txt),
#   already listed on the INERT slice_gate36.txt; _ZN9FaderWipeD0Ev.c exists
#   too. (An earlier draft of this file called it genuinely unmatched. That was
#   a search that did not descend into src/engine/fader/, not a fact about the
#   corpus. There is NO genuinely unmatched body in this arc.) What actually
#   blocks it is the storage the fader closure needs -- _ZTV9FaderWipe, the
#   table hal/fader_wipes.cpp stages by hand, and _ZN10FaderColorD2Ev -- the same
#   two the gate-36 note has carried since wave 4:
#       Stage::CleanupResources (also blocked above)
#
#   AND ONE HELD OUT FOR A REASON WORTH READING TWICE.
#   src/_ZN5Stage13UpdateMessageEv.cpp CLOSES against today's link with nothing
#   added -- and its object exports four EMPTY STUBS of real game functions
#   alongside the one it matched: ?UpdateWindow@Message@@SA_NXZ,
#   ?Update@Message@@SAXXZ, ?DisplaySaving@Message@@SAXG@Z and
#   ?SaveCurrentFile@SaveData@@SAXXZ, each a `{}` or `return 0` the matcher
#   wrote to isolate the function. Nothing references those manglings today, so
#   linking it is inert NOW and a silent wrong-binding the first time anything
#   does. Its dialogue arm already runs from hal/message_pump.cpp besides.

# ---- the Stage bodies (8) -------------------------------------------------

# _ZTV5Stage slot 1. Its whole body is Scene::ResetFadersAndSound plus two
# flag stores; both are already in the link. One of the four the vtable seat
# will reach.
src/_ZN5Stage19BeforeInitResourcesEv.cpp

# _ZTV5Stage slot 12. Reachable by the seat, but its object publishes ONLY
# ?OnPendingDestroy@Stage@@QAEXXZ (__thiscall) and never the C name, so the
# slot needs a face or a __fastcall thunk on top of the table fill.
src/_ZN5Stage16OnPendingDestroyEv.cpp

# _ZTV5Stage slots 16 and 17 -- ~Stage (D2/D1) and the deleting ~Stage (D0).
# Between them they name _ZTV5Stage, _ZTV8dScene_c, MeshCollider::~MeshCollider,
# Model::~Model, Particle::SysTracker::~SysTracker, ActorBase::~ActorBase and
# Memory::Deallocate. Every one of those already resolves, which is why these
# two close with nothing added.
src/_ZN5StageD1Ev.cpp
# RETIRED at SLICE1: body now in src/_ZN5StageD1Ev.cpp. MSVC folds the ROM destructor variants into one symbol, so only one of a class two per-function destructor TUs can be compiled.
#src/_ZN5StageD0Ev.cpp

# The Stage's SceneRelated graphics block, slot 1: Particle::RenderAll. NOT a
# _ZTV5Stage entry -- func_02019144 dispatches it, and the port does not run
# that beat.
src/_ZN5Stage14GraphCallback1Ev.cpp

# Stage::Behavior's two pause gates -- reached from Behavior, not from the
# vtable. IsPauseDisabled's only callee is func_ov002_020bd8ac, below.
src/_ZN5Stage8CanPauseEv.cpp
src/_ZN5Stage15IsPauseDisabledEv.cpp

# The pause / VS / level-clear menu button rows, reached from Stage::PS_Update,
# VE_Init, VE_Update and LC_Update. This is the one body in the slice that
# needs the storage batch: data_0209f244, data_0209f2b4, data_0209f2e0 and the
# four-slot data_0209f360[0..3], all hosted by hal/w8a_stage_storage.cpp in
# this same piece.
src/_ZN5Stage17UpdateMenuButtonsEb.cpp

# ---- the one callee those eight drag that no slice already names (1) ------

# Stage::IsPauseDisabled's only callee.
src/actors/Player.cpp
