# run rel0215 wave 2, lane cast-sweep2: OV047'S OWN CAST (level 39, Bowser in
# the Sky, data/stage/koopa3_map). Overlay 3 of 4 in this lane.
#
# The three-way source inventory:
#     delinked complete to a src/ TU   24
#     present but NONMATCHING-bannered  0
#     MISSING                           0
#                                      --
#                                      24  == config/arm9/overlays/ov047/
#                                             symbols.txt's kind:function count
#
# ALL TWENTY-FOUR are listed below, plus EIGHT ov002 bodies that are the
# MEASURED external closure. Nothing is refused, nothing is host-copied and
# nothing is faced: no asm-void block, no scheduler, no card loader, no
# wireless wrapper, no pointer-to-member dispatch, no ModelAnim slot-5
# collision, no r0 ride-through, and no //cpp real-destructor of the ov024
# PyramidTag shape. It is the only overlay in this lane with none of those.
#
# THE STRUCTURE IS FOUR COPIES OF ONE SHAPE. Each of the four classes is a
# Platform whose table carries exactly four own slots -- 0 InitResources,
# 3 CleanupResources, 16 D1, 17 D0 -- and inherits Behavior (6) and Render (9)
# from an ov002 intermediate base. So the overlay is four factories, four
# Init/Cleanup pairs, four destructor pairs and four static initialisers, and
# nothing else. 4 x 5 + 4 = 24.
#
# THE MEASURED CLOSURE GAP: EIGHT ov002 TUs, taken off the first link's own
# unresolved list and off the four tables' slots 6 and 9. They are the last
# eight lines below.
#   _ZN17daObjKurumajiku_c8BehaviorEv / _020b6b10   id 152's inherited Behavior / Render
#   _ZN13daObjKuruma_c8BehaviorEv / _020b68f8   id 151's inherited Behavior / Render
#   func_ov002_020b6ac8 / _020b6c54   what id 152's Init / Cleanup call
#   func_ov002_020b68b0 / _020b6958   what id 151's Init / Cleanup call
# The other two classes' four are already linked: id 156's (_ZN16daObjKaitendai_c8BehaviorEv
# / _020b66f0 / _020b66a8 / _020b676c) via port/slice_gate59.txt and id 153's
# (_ZN13daObjDorifu_c8BehaviorEv / _020b4bc4 / _020b4b6c / _020b4d58) via
# port/slice_ov036cast.txt. Measured against the map, not guessed.
#
# THE DSD CLASS NAMES ARE ATTACHED ONE TABLE LATE. In .data address order the
# four tables are 0x021122a0 (id 152), 0x0211237c (id 156), 0x0211244c (id 151)
# and 0x0211254c (id 153), and dsd's two names sit on the SECOND and FOURTH:
# _ZTV20daObjKm3_Kaitendai_c is id 156's and _ZTV17daObjKm3_Dorifu_c is id 153's. So
# every _ZN10RickshawBs* body serves id 156 and every _ZN18RickshawPlatformBs*
# body serves id 153. Three routes agree -- the factory installs, the RTTI at
# vtable[-1], and the spawn records. The derivation is in port/ov047_syms.txt;
# the seat in hal/actor_classes_ov047.cpp goes by address.
#
# NINE PER-SOURCE -D RENAMES travel with this slice (port/CMakeLists.txt), and
# THREE OF THEM ARE INVERTED. The recovered source uses the RTTI-derived vtable
# names and gets the CLASS right every time, but in the three factories it gets
# the ORDER backwards. The ROM stores the ov002 INTERMEDIATE BASE first and the
# class's OWN table second, which is the correct constructor order:
#     02111298 ldr r1,[pc,#0x14] -> 0x021112b4 -> 0x02109320   the base
#     0211129c ldr r0,[pc,#0x14] -> 0x021112b8 -> 0x021122a0   its own table
#     021112a0 str r1,[r4]   021112a4 str r0,[r4]
# while src/game/actors/d_a_obj_km3_kurumajiku.cpp writes `p[0] = _ZTV21daObjKm3_Kurumajiku_c;`
# FIRST and `p[0] = VT1;` second. So in the three factories the RTTI name means
# the BASE and VT1 means the own table, and in the six destructors the same RTTI
# name means the OWN table. Both readings are bound per source. Left alone the
# factories would install the base table LAST and every one of these actors
# would dispatch through an abstract intermediate whose slots 0 and 3 are ZERO
# in the ROM -- a null call on the first InitResources, and invisible to both
# the byte gate and the linkage count.
#
#   _ZN21daObjKm3_Kurumajiku_cD1Ev.c        id 152 D1. _ZTV21daObjKm3_Kurumajiku_c -> the
#                                OWN table 0x021122a0; _ZTV10dBgActor_c -> the
#                                ov002 INTERMEDIATE 0x02109320 (NOT the port's
#                                own _ZTV10dBgActor_c, which is 0x0210ae38 --
#                                the ov036 (3) trap); VT2 -> _ZTV10dBgActor_c.
#   _ZN21daObjKm3_Kurumajiku_cD0Ev.c        id 152 D0. VT0/VT1/VT2/G0, same three plus the
#                                game heap.
#   daObjKm3_Kurumajiku_c_classInit.c           id 152 factory, INVERTED (above).
#   _ZN20daObjKm3_Kaitendai_cD1Ev.c        id 156 D1. _ZTV20daObjKm3_Kaitendai_c -> the
#   _ZN20daObjKm3_Kaitendai_cD0Ev.c        id 156 D0. OWN table _ZTV20daObjKm3_Kaitendai_c;
#                                _ZTV10dBgActor_c -> ov002 0x021091d4;
#                                VT2 -> _ZTV10dBgActor_c; D0 also G0.
#   daObjKm3_Kaitendai_c_classInit.c        id 156 factory, INVERTED.
#   _ZN17daObjKm3_Kuruma_cD1Ev.c        id 151 D1. _ZTV17daObjKm3_Kuruma_c -> the OWN
#                                table 0x0211244c; _ZTV10dBgActor_c -> ov002
#                                0x02109278; VT2 -> _ZTV10dBgActor_c.
#   _ZN17daObjKm3_Kuruma_cD0Ev.c        id 151 D0. VT0/VT1/VT2/G0.
#   daObjKm3_Kuruma_c_classInit.c   id 151 factory, INVERTED.
#   __sinit_ov047_0211181c.c     FOUR OV052 NAMES for four of ov047's own .bss
#                                symbols (0x02112680, 0x02112688, 0x02112690,
#                                0x021126a8). ov052 IS MOUNTED, so all four
#                                resolve and STAIRS_BS would construct its files
#                                in Mario's Key Course's storage. The ROM's own
#                                pool words resolve to module:overlay(47).
#
# id 153's five TUs need NO rename at all: src/_ZN18RickshawPlatformBs*.c
# spell _ZTV17daObjKm3_Dorifu_c, _ZTV13daObjDorifu_c and _ZTV10dBgActor_c, which
# are the three addresses the ROM writes, in the ROM's own order. The dsd name
# is on the wrong CLASS but it is on the right ADDRESS, and by address is how
# the seat wires it.

# ---- id 152 RICKSHAW_BS (0x021122a0, 21daObjKm3_Kurumajiku_c) -------------
src/game/actors/d_a_obj_km3_kurumajiku.cpp

# ---- id 156 ROTATING_PLATFORM_BS (0x0211237c, 20daObjKm3_Kaitendai_c) -----
src/game/actors/d_a_obj_km3_kaitendai.cpp

# ---- id 151 RICKSHAW_PLATFORM_BS (0x0211244c, 17daObjKm3_Kuruma_c) --------
src/game/actors/d_a_obj_km3_kuruma.cpp

# ---- id 153 STAIRS_BS (0x0211254c, 17daObjKm3_Dorifu_c) ------------------
src/game/actors/d_a_obj_km3_dorifu.cpp

# ---- the four static initialisers, one per class -------------------------
src/__sinit_ov047_021116dc.c
src/__sinit_ov047_02111748.c
src/__sinit_ov047_021117b4.c
src/__sinit_ov047_0211181c.c

# ---- THE MEASURED CLOSURE: nine ov002 bodies ----------------------------
# The first eight came off the first link's own unresolved list; the ninth,
# func_ov002_020b6a80, came off the SECOND link's, because it is what
# _ZN17daObjKurumajiku_c8BehaviorEv and func_ov002_020b6c54 call and neither of those was in
# the build until the eighth line above put them there. Two rounds, both
# measured, neither guessed.
src/_ZN17daObjKurumajiku_c8BehaviorEv.cpp
src/_ZN17daObjKurumajiku_c6RenderEv.cpp
src/func_ov002_020b6ac8.cpp
src/func_ov002_020b6c54.c
src/_ZN13daObjKuruma_c8BehaviorEv.cpp
src/_ZN13daObjKuruma_c6RenderEv.cpp
src/func_ov002_020b68b0.cpp
src/func_ov002_020b6958.c
src/func_ov002_020b6a80.c
