# slice_w1l5.txt -- lane-owned slice for the linkage campaign (run linkw).
# One matched src TU per line, path relative to the repo root, comments with #.
# THIS FILE HAS ONE OWNER (lane l5); other lanes never touch it, which is what
# keeps five parallel seat lanes out of CMakeLists.txt and each other.
#
# Lane l5 is the PLAYER family: Player methods, the St_ state bodies, the
# state dispatcher's targets, and the ov002 helpers the player module calls.
#
# READ THIS BEFORE ADDING A LINE. A slice line COMPILES a TU; it does not put
# it in the binary. walk_window links Release with /INCREMENTAL:NO, so /OPT:REF
# strips every object nothing references, and port/tools/linkage.py counts a TU
# as linked only when its .obj survives into walk_window.map. So a seat only
# moves the number when something already in the binary REACHES it. For this
# family that reach is hal_call_state_fn in port/hal/player_bridges.cpp: the
# ROM's state records hold DS code addresses, the dispatcher switches on them,
# and a case there is what makes a St_ body live. Everything below is split
# along exactly that line, because a seat with no reach reads like progress and
# is not.

# ---------------------------------------------------------------------------
# WIRED. Each of these is reached by a hal_call_state_fn case added in
# port/hal/player_bridges.cpp, at the address config/arm9/overlays/ov002/
# symbols.txt gives it. These are the last three ov002 St_ addresses the
# generated player_states.inc did not carry.
src/actors/Player.cpp
src/_ZN6Player19St_SwingPlayer_InitEv.cpp
src/_ZN6Player22St_SwingPlayer_CleanupEv.cpp

# ---------------------------------------------------------------------------
# SUPPLY SEATS. Every line below compiles clean against the port headers and
# links clean into walk_window, and every one is then stripped, because its
# only callers in src/ are themselves unlinked. They are here as the resolved
# side of a link: the caller named after each one is the TU that lights it up,
# and most of those callers belong to other lanes' overlays, so a lane that
# seats func_ov077_02126640 or Tornado::Behavior will not stall on a missing
# ov002 player-module symbol. Each has been link-verified in this lane, which
# is the part that is expensive to redo.
#
# NOTE ON FORMAT: the CMakeLists foreach takes the WHOLE line as the path, so
# a trailing `# ...` note on a source line becomes part of the filename and
# breaks configure -- and closestplayer_guard then skips the line as a
# non-existent file, which is the quiet half of that mistake. Notes go above.
#
# ov002 player-module helpers. The caller each one waits on:
# (WAVE-2 RECONCILIATION: the "blocked" notes on 020c3148/020c3160 and the
# wave-1 unseatable rulings on 020c3bdc/020c3d1c/020c2fec/020c38a0 below are
# SUPERSEDED -- the wave-2 mount lane mounted their data, this file seats all
# of them, and the dispatcher case in hal/player_bridges.cpp is the edge
# that lights the chain. Wave-1 prose kept for the derivation record.)
#   020c3148  func_ov002_020c38a0 (blocked, see below)
#   020c3160  func_ov002_020c2fec (blocked, see below)
#   020c37a4  func_ov002_020c38a0, func_ov002_020c3a48
#   020c3a48  _ZN6Player17St_EndingFly_MainEv
#   020c3cf0  func_ov002_020c3a48, func_ov002_020c3bdc
#   020c3dbc  func_ov089_02131dcc
#   020c51d0  func_ov034_02111a64
#   020c56f0  func_ov060_021145d4
#   020c5cd8  func_ov032_021113fc
#   020cc16c  func_ov102_0214cbec
#   020cfd84  no caller anywhere in src/ yet
#   020d5f98  func_ov002_020ec9c4
#   020d6048  func_ov002_020ec9c4
#   020db674  func_ov077_02126640
#   020de328  func_ov092_02131010, _ZN7Tornado6State1Ev
#   020de33c  _ZN7Tornado8BehaviorEv
#   020ee5d0  _ZN10dBgActor_c20UpdateKillByMegaCharEsss5Fix12IiE
src/func_ov002_020d5f98.cpp
src/func_ov002_020d6048.cpp
src/func_ov002_020db674.c
src/func_ov002_020de328.c
src/func_ov002_020de33c.c
src/actors/dBgActor_c.cpp
#
# Player methods, same story -- none of them is a state function, so none has
# a dispatcher address; they come alive when their real callers land:
#   GetHurtState     ov073/ov077 damage readers
#   Shock            _ZN7daBrq_c21HandlePlayerCollisionEv, _ZN16BowserShockwaves8BehaviorEv
#   BlowAway         _ZN21SnowmanBreathParticle9HitPlayerEv, func_ov091_021339fc
#   EnterWhirlpool   no caller anywhere in src/ yet
#   JumpIntoBooCage  no caller anywhere in src/ yet
#   CanPause         no caller in src/ yet (the arm9 pause menu calls it)
src/_ZN6Player12GetHurtStateEv.cpp
src/_ZN6Player5ShockEj.cpp
src/_ZN6Player8BlowAwayEs.cpp

# ---------------------------------------------------------------------------
# WAVE 2 / LANE w2-e: ov002's REAL St_EndingFly_Main and everything under it.
#
# Wave 1 left 0x020c3d1c as a suspicion: ov002 and ov007 both have a function
# there (they share base 0x020ad660 and the DS only ever loads one), ov007's
# is named func_ov007_020c3d1c by the community config, and ov002's
# is the anonymous _ZN6Player17St_EndingFly_MainEv. Pattern evidence pointed at ov002 and
# was not enough to act on.
#
# The ROM settles it. __sinit_ov002_021019d0 is the constructor for every
# Player::State object, and it builds each one from a pair of 8-byte PMF cells
# in ov002 .data, Init cell first, then Main, then the State's own bss address.
# Read straight out of config/arm9/overlays/ov002/relocs.txt:
#     0x02106dac -> cell 0x0210a51c -> 0x020c3d6c  _ZN6Player17St_EndingFly_InitEv
#     0x02106db0 -> cell 0x0210a0bc -> 0x020c3d1c  _ZN6Player17St_EndingFly_MainEv
#     0x02106db4 ->      0x02110804               (a pool argument word; the
#     EndingFly State object itself is 0x0211058c -- the reviewer's full
#     81-state reconstruction of the sinit store sequence settled that)
# The same triple shape names OpeningWakeUp, LongJump, PunchKick and
# GroundPound correctly two cells earlier, so the pairing is the sinit's, not
# a guess. _ZN6Player17St_EndingFly_MainEv IS Player::St_EndingFly_Main; ov007's body at
# the same address is a leaf helper reached by 86 arm_calls inside ov007 and
# never by a PMF cell, which is not the shape of a state function at all.
#
# So the seat is ov002's body, and the reach is one hal_call_state_fn case at
# 0x020c3d1c -- port/hal/player_bridges.cpp, which this lane does not own, so
# that line is a handoff and these five are the prepared side of it. Until the
# case lands /OPT:REF strips all five, exactly like the supply seats above.
#
#   020c3d1c  St_EndingFly_Main; calls 020c3bdc, 020c3a48 (seated), 020c38a0
#   020c3bdc  calls func_0200eec8 and func_ov002_020c3cf0 (seated)
#   0200eec8  arm9; RunKuppaScript(data_02088610)
#   020c38a0  calls func_ov002_020c2fec, plus 020c3148/020c37a4 (both seated)
#   020c2fec  walks data_ov002_0210a8b8, mounted for this in port/ov002_syms.txt
src/func_0200eec8.c

# ---------------------------------------------------------------------------
# NOT SEATABLE, and why. None of these is a wiring problem this lane can fix.
#
# (a) A host definition of the same symbol is already in the build, so the seat
#     would be a duplicate. Each host is a PMF-dispatch or calling-convention
#     seam, not scaffolding a slice line retires:
#       _ZN6Player8BehaviorEv           port/unmatched/Player_Behavior.cpp
#       _ZN6Player11ChangeStateERNS_5StateE  port/unmatched/Player_ChangeState.cpp
#       _ZN6Player16CleanupResourcesEv  port/unmatched/Player_CleanupResources.cpp
#       _ZN6Player13InitResourcesEv     -- NO LONGER A HOST COPY (wave 6, w6-C
#         item 3): the matched source hosts itself through hostgen ASM_EXCISION
#         out of HOSTABI_RETIRE_SYMS. port/unmatched/Player_InitResources.cpp
#         is retired and bannered. The symbol is still not a slice line here --
#         it needs --extern-data, which a slice line cannot carry.
#       _ZN6Player12St_Jump_MainEv      port/unmatched/Player_St_Jump_Main.cpp
#       _ZN6Player17St_NoControl_InitEv port/unmatched/Player_St_NoControl_Init.cpp
#       _ZN6Player16St_WallJump_MainEv  port/unmatched/Player_St_WallJump_Main.cpp
#       _ZN6Player12St_Swim_MainEv      port/unmatched/Player_SwimMain.cpp
#       func_ov002_020cef84             port/unmatched/Player_HeadBonk.cpp
#       func_ov002_020e5948             port/unmatched/TexSeq_Caller_ov002_020e5948.cpp
#       func_ov002_020eeeb8             port/unmatched/Actor_OnKickedDispatch.cpp
#     func_ov002_020cef84 is the one of those that linkage.py still calls
#     UNDOCUMENTED queue -- retiring it means dropping the host copy from
#     CMakeLists.txt, which is not a file this lane owns.
#
# (b) The name is a community symbol for ANOTHER overlay's bytes at a shared
#     address, so seating it would put a second body of a function the port
#     already dispatches correctly into the tree, under a name a future caller
#     could pick by mistake. That is the WRONG TARGET failure mode from the
#     header essay in hal/method_faces.cpp, bought for nothing:
#       func_ov006_020d6084  ov006's 0x020d6084; the .inc
#         dispatches that address to _ZN6Player23St_InYoshiMouth_CleanupEv.
#       func_ov006_020cac30         ov006's 0x020cac30; same shape.
#       func_ov006_02110244                 an ov006 class, not a Player member
#         at all -- see the note in the src file.
#
# (b1) _ZN6Player18St_LevelEnter_MainEv is left out for the PMF STRIDE, not
#     for a shared address, and it sat under (b) with the polarity inverted.
#     ov002/symbols.txt names 0x020c6f3c with this exact symbol (size 0xa8)
#     and src/actors/Player.cpp defines the ov002 body, so
#     the name is this overlay's own rather than another's. It stays out
#     because that body dispatches through data_ov002_0211075c, whose records
#     are eight bytes and which MSVC's one-word pointer-to-member would stride
#     by four. 0x020c6f3c is dispatched to
#     port/unmatched/func_ov002_020c6f3c.cpp instead, a host copy whose name
#     is the port's own and is in no symbols.txt. The symbol that DOES name
#     another overlay's bytes here is ov006's func_ov006_020c6f3c (size 0x34),
#     which is not a Player symbol and was never a seating candidate.
#
# (b2) _ZN6PlayerD0Ev is matched and links clean, and it is still left out: it
#     is vtable slot 17, which hal/level_boot.cpp traps ON PURPOSE. The ROM's
#     teardown never dispatches the deleting destructor -- AfterCleanupResources
#     calls slot 16 and does the Memory::Deallocate itself -- so a call landing
#     in slot 17 means something reached the Player through `delete`, and the
#     trap is the bug report. Seating a body for a slot the port deliberately
#     wants to abort on is the wrong direction, however cheap the line is.
#
# (c) MSVC rejects the TU outright. src/func_ov002_020e3e00.cpp redeclares
#     func_0203c178 / MulMat3x3Mat3x3 / func_02016acc and its own
#     func_ov002_020e3e00 at C linkage with types that disagree with
#     include/decl_common.h, which is error C2733 (two C-linkage functions of
#     one name cannot differ). Fixing it means editing src/ or the shared
#     header. This blocks _ZN6Player6RenderEv too, which calls it.
#
# (d) Cross-subsystem externs. Each of these compiles clean and fails only at
#     link, on a symbol from an overlay this lane does not own. Seating the
#     missing side belongs to the lane that owns it:
#       func_ov006_020e17f8   ov004 020afdd0, ov006 data 0213c2e4
#       func_ov007_020c3d1c  ov007 data 02103254
#       _ZN6Player29TryExitCharacterDoorWithIntroEv   ov006 020cd6f4
#       func_ov002_020c3bdc              arm9 func_0200eec8
#       _ZN6Player17St_EndingFly_MainEv              via func_ov002_020c3bdc
#       func_ov002_020c2fec              data_ov002_0210a8b8, which is not in
#                                        port/ov002_syms.txt, so the overlay's
#                                        data image does not seat it
#       func_ov002_020c38a0              via func_ov002_020c2fec

# ---- LANE w4-e (run linkw, wave 4): THE BOUNCING ARROW -----------------------
# SEATED (w6-c, wave 6, the three-edit recipe w4-e banked here). The template
# was mounted in wave 4 -- port/ov001_syms.txt names _ZN3OAM14BOUNCING_ARROWE
# at 0x020abd88, sized 16 bytes, with the ROM's own OamAttr terminator agreeing
# with the config symbol boundary to the byte (the derivation is in that file).
# hal/sub_actors.cpp then carried the other two edits in one commit with the
# line below: its extern "C" stub deleted (the matched TU owns the C symbol
# now) and /alternatename:_func_020abd88=__ZN3OAM14BOUNCING_ARROWE beside the
# five HUD-table aliases. The alias is the healthy weak-alias shape for the
# guard: the matched TU only DECLARES func_020abd88, so the LHS stays
# undefined and the directive fires onto the mounted template.
#
# THE CALL EDGE (w4-e's derivation, re-checked at seat time):
# _ZN3HUD6RenderEv.cpp.obj is in walk_window.map and calls
# _ZN5Stage20RenderBouncingArrowsEv by the C name. Stage::Render,
# Stage::LC_Render, Stage::PS_Render and _ZN13dScGameOver_c6RenderEv call it too and
# none of those four is linked, so HUD::Render is the whole edge today, gated
# on data_0209f284 (zeroed bss on this boot) -- a linkage win first, a visible
# one only on a level that sets it.
src/_ZN5Stage20RenderBouncingArrowsEv.cpp
