# run rel0215 wave 2, lane cast-ov027 (W2-ov027): ov027's SNOWMAN'S LAND cast,
# per symbol. Level 19, data/stage/snow_land, course 9.
#
# ov027 is already mounted WHOLE in PORT_LEVEL_OVERLAYS. This is the SECOND
# mount of the same overlay, per symbol -- the ov012/ov013/ov026/ov030/ov036
# dual-mount shape, which does not conflict: --whole emits
# port_ov027_image/_patch/_at and NOTHING by name, while --from-list --pack
# emits the named arrays plus port_ov027_syms_patch.
#
# WHY the cast needs the named mount rather than the image: the registry
# rewrites each SpawnInfo's +0 word to the host factory and ActorBase's
# constructor reads the two list priorities back out of the SAME record, and
# the class code reaches its SharedFilePtrs, its pointer-to-member source
# table and its tuning blocks BY NAME.
#
# ==== THE BASE IS PROVEN BEFORE ANYTHING IS READ OFF IT (trap T4) ==========
# Every byte below is out of extracted/overlays/overlay_0027.bin, never
# extracted/dsd/arm9_overlays/ (the two disagree on 89 of 103 overlays and dsd
# never scores better). The image is 10816 bytes = 0x2a40, and
# .text+.rodata+.init+.ctor+.data spans exactly 0x2a40 (0x021111a0..0x02113be0,
# where .bss begins). Seven of the eight entry points read as a control read
# the first word e92d4010 = push {r4,lr}:
#   021111a0 021111e4 02111564 02111594 0211186c 021120c4 02112ab4
# The eighth is a static initialiser and reads e92d4000 = push {lr}, which is
# the other plausible prologue for a void(void).
#
# Sections, from config/arm9/overlays/ov027/delinks.txt:
#   .text   0x021111a0..0x02112b14   .rodata 0x02112b14..0x02112cb0
#   .init   0x02112cb0..0x02112fc4   .ctor   0x02112fc4..0x02112fd4
#   .data   0x02112fe0..0x02113be0   .bss    0x02113be0..0x02113d20
#
# ==== THE CAST MAP, BOTH ATTRIBUTION ROUTES (trap T6) ======================
# Both routes are required of every id because ov009/ov014/ov015/ov016/ov018/
# ov020/ov021/ov022/ov024/ov025/ov026/ov027/ov029/ov032/ov034/ov036/ov045/ov056
# all share the level overlay load window at base 0x021111a0. Route 1 is the
# arm9 ACTOR_SPAWN_TABLE at 0x02090864 + id*4, whose words are RELOCATIONS --
# the raw arm9_dec bytes there are garbage, and config/arm9/relocs.txt resolves
# each one to an address plus a module list that names TWELVE TO SIXTEEN
# overlays at once. Route 1 alone cannot say ov027: it hands back THIRTY-ONE
# candidate ids whose target lands inside ov027's .data with 27 in the module
# list. Route 2 is the record's own word[1] low halfword, which must read back
# the id the slot was reached from, and word[0], which must land inside ov027's
# own .text (0x021111a0..0x02112b14). Route 2 cuts 31 candidates to FIVE.
#
#  id  SpawnInfo                    word[0] spawn func           word[1]     idhalf
#  92  g_profile_SL_ICEBLOCK  0x02111594 daObjSlIceBlock_c_classInit_SL_ICEBLOCK 0x0107005c  92
#  93  g_profile_SL_ICEBLOCK_SHOT         0x02111564 daObjSlIceBlock_c_classInit_SL_ICEBLOCK_SHOT        0x0108005d  93
# 217  g_profile_ICE_DONKETU         0x0211186c daIDonketu_c_classInit        0x003d00d9 217
# 258  g_profile_PENGUIN_DEFENDER          0x0211207c daPgDfdr_c_classInit     0x00740102 258
# 275  g_profile_SNOWMAN_BREATH      0x02112ab4 daSnmBth_c_classInit     0x00860113 275
#
# Route-1 slots, for the record:
#   92  0x020909d4 -> 0x021137e4  overlays(9,14,15,18,20,21,22,24,25,26,27,29,32,36)
#   93  0x020909d8 -> 0x02113800  overlays(9,14,15,18,20,21,22,24,25,26,27,29,32,36)
#  217  0x02090bc8 -> 0x021138d8  overlays(9,14,15,18,20,21,22,24,25,26,27,29,32,34,36)
#  258  0x02090c6c -> 0x02113a00  overlays(9,14,15,18,20,21,22,25,26,27,29,32,36)
#  275  0x02090cb0 -> 0x02113b2c  overlays(9,14,15,16,18,20,21,22,26,27,29,36)
#
# TWO route-1 candidates that route 2 REFUSES, and they are the reason route 2
# is not optional. Id 228's slot resolves to 0x02113800, which IS
# g_profile_SL_ICEBLOCK_SHOT -- but that record's own idhalf reads 93, not 228, so
# 228 belongs to a different overlay at the shared address. Id 129's slot
# resolves to 0x02113b50, which is ov027's SnowmanBreath VTABLE and is ov036's
# g_profile_RC_KAITEN (that overlay's id 129). Seating either on
# route 1 would have been a wrong answer that looks like a right one.
#
# ==== THE LANE CARRIES A FIFTH CLASS THE TASK SHEET DID NOT NAME ==========
# The brief named four: ChillBully, SlidingIce, SlidingIceSpawner,
# SnowmanBreath. Route 2 confirms a FIFTH registered id, 258, whose SpawnInfo
# dsd left unnamed (g_profile_PENGUIN_DEFENDER) and whose factory dsd left unnamed
# (daPgDfdr_c_classInit). Its ROM RTTI name is daPgDfdr_c and it owns the block
# 0x021118c8..0x021120c4 -- SIXTEEN of this overlay's 53 functions, including
# _ZN10daPgDfdr_c16CleanupResourcesEv, which the task sheet itself flagged as booby trap 2.
# It is placed on level 19 (x1) and the baseline census skips it as 0x102.
# Seating four classes and not five would leave a third of the overlay in no
# slice and the flagged TU unlinked, so 258 is seated with the other four.
#
# ==== THE dsd NAMES ARE CORRECT BY ADDRESS ON THIS OVERLAY ================
# Unlike ov036 and ov045, ov027 carries NO off-by-one. Measured, not assumed:
# every function that stores a table stores the table its own name predicts.
#   _ZN10SlidingIceD1Ev / D0Ev / daObjSlIceBlock_c_classInit_SL_ICEBLOCK_SHOT / daObjSlIceBlock_c_classInit_SL_ICEBLOCK
#       all store 0x02113824, which dsd names _ZTV10SlidingIce.
#   _ZN13SnowmanBreathD1Ev / D0Ev / daSnmBth_c_classInit
#       all store 0x02113b50, which dsd names _ZTV13SnowmanBreath.
# The other two tables dsd leaves unnamed (data_ov027_02113930,
# _ZTV10daPgDfdr_c) and the host arrays keep those config spellings so
# vtspan can size them, the ov036 correction.
#
# Each table's own vtable[-1] __si_class_type_info name string, read out of the
# raw image, is the independent confirmation:
#
#   vtable      typeinfo    name string            ids      base typeinfo
#   0x02113824  0x021137c4  17daObjSlIceBlock_c    92, 93   0x021089ec ov002
#   0x02113930  0x021138b0  12daIDonketu_c         217      0x021138bc ov027
#   0x02113a90  0x021139e4  10daPgDfdr_c           258      0x021089ec ov002
#   0x02113b50  0x02113b10  10daSnmBth_c           275      0x0208e390 arm9
#
# "Donketu" is the ROM's name for the Bully family, so 0x02113930 is
# ChillBully's; daIDonketu_c_classInit's own literal pool stores it, which settles it
# without the name. IDS 92 AND 93 SHARE ONE TABLE: daObjSlIceBlock_c_classInit_SL_ICEBLOCK_SHOT and
# daObjSlIceBlock_c_classInit_SL_ICEBLOCK are byte-identical apart from nothing at all -- both
# allocate 812, call Platform::C2 and store 0x02113824. Two SpawnInfo records,
# two ids, one class. Both rows point at the same host array and the same fill.
#
# ==== THE FOUR VTABLE WIDTHS, SLOT BY SLOT ================================
# Read out of config/arm9/overlays/ov027/relocs.txt with every target resolved
# through config/arm9/symbols.txt, cross-read against the raw overlay image.
# The four standing width traps were each checked on every table:
#
#   file tables          -- SWEPT, not present past any tail.
#   state records        -- SWEPT, not present past any tail.
#   typeinfo terminators -- the primary route on daPgDfdr_c and it is honest
#                           there (0x0209a764 sits exactly one slot past the
#                           last virtual). It does NOT apply to the other three.
#   PMF source tables    -- FIRES ON CHILLBULLY, and it is the whole reason
#                           that table is not 41 slots. See below.
#
#  id(s)  table       last virtual                      TRUTH  second route
#  92,93  0x02113824  31 Platform::Kill                   32   slot 32 carries NO
#                                                              relocation and reads
#                                                              ASCII "7daOts_c"
#   217   0x02113930  36 _ZN7daOts_c14PlayDeathSoundEv               37   _ZTV5Bully is 37 slots
#                                                              (port/ov064_syms.txt:9)
#   258   0x02113a90  31 Platform::Kill                   32   typeinfo terminator
#                                                              0x0209a764 at slot 32
#   275   0x02113b50  30 OnAimedAtWithEggReturnVec        31   zero padding to the
#                                                              EXACT .data end 0x02113be0
#
# THE FOURTH WIDTH TRAP FIRES ON CHILLBULLY AND ALL THREE TELLS ARE PRESENT.
# Past slot 36 the words at 0x021139c4..0x021139e4 look exactly like four more
# vtable slots with four nulls interleaved. They are a POINTER-TO-MEMBER SOURCE
# TABLE, four {function, 0} pairs:
#   0x021139c4 -> 0x02111a28  +4 == 0   dsd: data_ov027_021139c4
#   0x021139cc -> 0x02111c48  +4 == 0   dsd: data_ov027_021139cc
#   0x021139d4 -> 0x02111ca8  +4 == 0   dsd: data_ov027_021139d4
#   0x021139dc -> 0x02111b2c  +4 == 0   dsd: data_ov027_021139dc
#   (1) every other word is zero;
#   (2) dsd names one symbol per PAIR, at 8-byte stride, and names none of the
#       nulls;
#   (3) the semantic tail: slot 36 is _ZN7daOts_c14PlayDeathSoundEv, inside Bully's own
#       37-slot base table span, and _ZTV5Bully IS 37 slots.
# A FOURTH tell settles it beyond argument, and it is this overlay's own code:
# src/__sinit_ov027_02112df8.cpp copies exactly these four symbols, as 8-BYTE
# structs, into data_ov027_02113ce4. A vtable slot is four bytes; these are
# eight. A sweep of the whole .rodata+.data for the same shape found this run
# and no other.
#
# port/tools/vtspan.py --sweep DISAGREES WITH THE 37 AND IT IS THE TOOL THAT IS
# SHORT. Its sweep line reads
#   data_ov027_02113930  host 37  ROM 32  bound 1  term
#   data_ov027_02113930  32 by terminator (raw run 38, dsd bound 1,
#                                          terminator 32, typeinfo 45)
# and the cause is named in vtspan's own source. tail_width() declines this
# table on purpose -- its docstring says "Inconclusive on purpose for a deeper
# hierarchy of its own (Bully and BigBully are 37)" -- so the terminator route
# decides, and span() breaks at the first slot >= 31 that dsd NAMES and that is
# not Platform::Kill (vtspan.py:467-470). dsd names data_ov027_021139b0, which
# is slot 32, in the MIDDLE of this table. That is exactly the disease the code
# comments above that break call out ("THE SYMBOL TERMINATOR HAS THE SAME
# DISEASE THE SYMBOL BOUND HAS"), and the residual gap it states.
#
# THE 37 IS PROVEN THREE WAYS, none of them vtspan's:
#   (1) the raw run is 38 -- vtspan's own first column -- and slot 37 is the
#       first PMF pair, whose partner word at slot 38 is the literal zero that
#       ends the run;
#   (2) BOTH ov064 Bully tables terminate at 37. Read out of
#       extracted/overlays/overlay_0064.bin at base 0x02115ee0: _ZTV5Bully
#       (0x0211b870) and the base table data_ov064_0211b768 each carry a code
#       pointer in slots 0..36 and 0x0209a764 __si_class_type_info at slot 37;
#   (3) ChillBully's slots 33/34/35/36 are 0x02116374 / 0x02116360 /
#       0x0211635c / 0x02116348, which are BYTE-IDENTICAL to the Bully base
#       table's own slots 33/34/35/36. The derived class inherits those four
#       unchanged, which it could not do if its table stopped at 32.
# Nothing fails on this: the host array is declared 37, which is the ROM width
# and is also >= vtspan's estimate, so the sweep passes. Declaring 32 would
# have been the bug -- the fill writes vt[36].
#
# ChillBully derives from Bully (ov064): slot 3 is _ZN7daOts_c16CleanupResourcesEv,
# slot 9 is _ZN7daOts_c6RenderEv, and slots 33/34/35/36 are ov064 bodies.
# SnowmanBreath is a plain Actor (base typeinfo 0x0208e390, arm9) and stops at
# Actor's slot 30. SlidingIce and daPgDfdr_c are Platform-derived and carry
# slot 31 Platform::Kill.
#
# ==== THE FOUR VTABLE SPANS ARE EXCLUDED: THEY ARE HOST STORAGE ==========
# The ov015/ov016/ov022/ov036/ov045/ov080 rule -- a mounted vtable hands a
# factory DS code addresses. Every dsd symbol INSIDE each span is excluded with
# it, 14 in all:
#   0x02113824..0x021138a4  92,93  32 slots  _ZTV10SlidingIce +0211382c
#   0x02113930..0x021139c4  217    37 slots  data_ov027_02113930 +02113934
#                                            +02113980 +02113998 +021139b0
#   0x02113a90..0x02113b10  258    32 slots  _ZTV10daPgDfdr_c +02113aa0
#                                            +02113abc
#   0x02113b50..0x02113bcc  275    31 slots  _ZTV13SnowmanBreath +02113b7c
#                                            +02113b80 +02113b90
# hal/actor_classes_ov027.cpp declares the four as host arrays and fills them.
# ov064's Bully/BigBully BASE-class 37-slot table (0x0211b768) is ChillBully's
# intermediate base; port/ov064_syms.txt deliberately leaves it out of that
# mount and nothing else in the tree defines it, so it is a host array here too.
# 0x0210ae38 (_ZTV10dBgActor_c / the port's _ZTV10dBgActor_c) and 0x021089ec are
# already host storage and are left exactly as they are.
#
# ==== FOUR EXPLICIT SIZE PINS (trap T3) ===================================
# Each one is a place the ROM READS OR WRITES A RECORD WIDER THAN dsd's
# inferred next-symbol gap. Each pin drops the interior dsd tagged ambiguous,
# and nothing in ov027's relocs, nothing in src/ and nothing in
# include/decl_common.h names any of the five dropped symbols (checked).
#
#   data_ov027_02112ca4:0xc   gap 0x4   drops data_ov027_02112ca8
#       A three-word table of SharedFilePtr pointers -- its own words relocate
#       to 0x02113c84, 0x02113c74 and 0x02113c8c, the three Anim files
#       __sinit_ov027_02112df8 constructs. src/actors/daPgDfdr_c.cpp reads it
#       as data[i] for i = 0..2, so the READ runs 8 bytes off a 4-byte host
#       object. The ov035 lane pinned its own 0x02112ca4 to 0xc for the same
#       reason at the same shared-window address.
#   data_ov027_02113c10:0x8   gap 0x4   drops data_ov027_02113c14
#       An 8-byte SharedFilePtr, built by __sinit_ov027_02112d1c with asset
#       0x2e4. SharedFilePtr::Construct WRITES 8 bytes.
#   data_ov027_02113ccc:0xc   gap 0x8   drops data_ov027_02113cd4
#       A 12-byte destructor-chain node, registered by func_020731dc from
#       __sinit_ov027_02112df8.
#   data_ov027_02113ce4:0x20  gap 0x8   drops data_ov027_02113cec, _02113cf4
#       The PMF copy target. __sinit_ov027_02112df8 assigns FOUR 8-byte pairs
#       into it -- 32 bytes into a host object dsd would have sized at 8. This
#       is the ov002 0x0210ffbc shape exactly: the overflow would run over the
#       first three words of whatever the emitter placed next.
#
# A FIFTH PIN, and it goes the other way -- DOWN, not up:
#   data_ov027_02113a24:0x2   gap 0x2   drops nothing
#       ovdata.py's inferred size has a FLOOR of 4 (`max(4, nxt - a)`,
#       port/tools/ovdata.py:1148), and this symbol's real gap is TWO, so the
#       emitter sized it 4 and refused the pack: "data_ov027_02113a26 at
#       0x02113a26 overlaps the symbol ending at 0x02113a28". The four names
#       0x02113a1c / _a20 / _a24 / _a26 are FOUR VIEWS OF ONE ARRAY, not four
#       objects: src/actors/daPgDfdr_c.cpp indexes all four with the same
#       [c+0x3d9] and the record stride is 0xc (record 0 at 0x02113a1c reads
#       {00220000, 00005000, dd30, dd30}, record 1 at 0x02113a28 reads
#       {0016c000, 0000a000, dd30, dd30}), so the four are the record's +0,
#       +4, +8 and +10 fields. Pinning the s16 field to its real 2 bytes lets
#       --pack lay all four contiguously, which reproduces the ROM bytes
#       exactly and keeps every index correct. It is the only symbol in this
#       mount whose natural gap is under 4; the whole list was swept for the
#       shape rather than fixed one refusal at a time.
#
# Every other symbol's next-symbol delta already equals its ROM record size:
# the bss reads as four sinit groups of N 8-byte SharedFilePtrs followed by N
# 12-byte chain nodes, and each group's last node ends on the next group's
# first word.
#
# ==== WHAT IS MOUNTED =====================================================
# 121 symbols: every ov027 .rodata / .data / .bss symbol that is not inside one
# of the four vtable spans and is not one of the five pinned-over interiors.
# The .p__sinit words (0x02112fc4..0x02112fd4) are not listed: a bring-up calls
# the sinits directly rather than walking the ctor table, and they are not C
# identifiers anyway.
data_ov027_02112b14 data_ov027_02112b18 data_ov027_02112b1c
data_ov027_02112b38 data_ov027_02112b84 data_ov027_02112ba8
data_ov027_02112bdc data_ov027_02112bec data_ov027_02112c08
data_ov027_02112c18 data_ov027_02112c44 data_ov027_02112c4c
data_ov027_02112c58 data_ov027_02112c68 data_ov027_02112c88
data_ov027_02112ca4:0xc data_ov027_02112fe0 data_ov027_02112fe4
data_ov027_02112fe8 data_ov027_02112ff0 data_ov027_02112ff8
data_ov027_02112ffc data_ov027_02113000 data_ov027_0211300c
data_ov027_02113018 data_ov027_02113024 data_ov027_02113034
data_ov027_02113044 data_ov027_02113054 data_ov027_02113064
data_ov027_02113074 data_ov027_02113084 data_ov027_02113094
data_ov027_021130a4 data_ov027_021130b4 data_ov027_021130cc
data_ov027_021130d0 data_ov027_021130e8 data_ov027_02113108
data_ov027_02113128 data_ov027_02113154 data_ov027_02113184
data_ov027_021131cc data_ov027_02113214 data_ov027_02113228
data_ov027_02113264 data_ov027_021132ec data_ov027_02113344
data_ov027_021133a8 data_ov027_02113434 data_ov027_02113518
data_ov027_02113534 data_ov027_02113554 data_ov027_021135d4
data_ov027_021135f4 data_ov027_021136d4 data_ov027_021136f4
data_ov027_0211373c _ZTI17daObjSlIceBlock_c _ZTS17daObjSlIceBlock_c
g_profile_SL_ICEBLOCK data_ov027_021137f8 g_profile_SL_ICEBLOCK_SHOT
data_ov027_02113804 data_ov027_02113820 _ZTS7daOts_c
data_ov027_021138a8 _ZTI12daIDonketu_c _ZTI7daOts_c
data_ov027_021138c4 _ZTS12daIDonketu_c g_profile_ICE_DONKETU
data_ov027_021138f0 data_ov027_021138f4 data_ov027_021138fc
data_ov027_021139c4 data_ov027_021139cc data_ov027_021139d4
data_ov027_021139dc _ZTI10daPgDfdr_c _ZTS10daPgDfdr_c
data_ov027_021139f4 g_profile_PENGUIN_DEFENDER data_ov027_02113a1c
data_ov027_02113a20 data_ov027_02113a24:0x2 data_ov027_02113a26
data_ov027_02113a50 data_ov027_02113a74 _ZTI10daSnmBth_c
_ZTS10daSnmBth_c g_profile_SNOWMAN_BREATH data_ov027_02113be0
data_ov027_02113be8 data_ov027_02113bf0 data_ov027_02113bfc
data_ov027_02113c08 data_ov027_02113c10:0x8 data_ov027_02113c18
data_ov027_02113c20 data_ov027_02113c28 data_ov027_02113c30
data_ov027_02113c3c data_ov027_02113c48 data_ov027_02113c54
data_ov027_02113c60 data_ov027_02113c6c data_ov027_02113c74
data_ov027_02113c7c data_ov027_02113c84 data_ov027_02113c8c
data_ov027_02113c94 data_ov027_02113c9c data_ov027_02113ca8
data_ov027_02113cb4 data_ov027_02113cc0 data_ov027_02113ccc:0xc
data_ov027_02113cd8 data_ov027_02113ce4:0x20 data_ov027_02113d04
data_ov027_02113d10
