Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions config/arm9/overlays/ov002/delinks.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ src/_ZN5EnemyD2Ev.c:
complete
.text start:0x020aed18 end:0x020aed3c

src/_ZN5EnemyD0Ev.c:
src/_ZN5EnemyD0Ev.cpp:
complete
.text start:0x020aed3c end:0x020aed74

src/_ZN5EnemyD1Ev.c:
src/_ZN5EnemyD1Ev.cpp:
complete
.text start:0x020aed74 end:0x020aed98

Expand Down Expand Up @@ -3248,6 +3248,7 @@ src/func_ov002_020d6998.cpp:
.text start:0x020d6998 end:0x020d6c60

src/func_ov002_020d6c60.cpp:
complete
.text start:0x020d6c60 end:0x020d6dac

src/func_ov002_020d6dac.c:
Expand Down Expand Up @@ -4651,7 +4652,7 @@ src/_ZN8PlatformD1Ev.cpp:
complete
.text start:0x020ee42c end:0x020ee464

src/_ZN8PlatformD0Ev.c:
src/_ZN8PlatformD0Ev.cpp:
complete
.text start:0x020ee464 end:0x020ee4b0

Expand Down
1 change: 1 addition & 0 deletions config/arm9/overlays/ov002/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1667,6 +1667,7 @@ data_ov002_021081b8 kind:data(any) addr:0x021081b8
_ZTI12dEnemyBase_c kind:data(any) addr:0x021081c0
_ZTS12dEnemyBase_c kind:data(any) addr:0x021081cc
data_ov002_021081e4 kind:data(any) addr:0x021081e4
_ZTV5Enemy kind:data(any) addr:0x021081e4
_ZTI11dCapEnemy_c kind:data(any) addr:0x02108260
_ZTS11dCapEnemy_c kind:data(any) addr:0x0210826c
data_ov002_02108284 kind:data(any) addr:0x02108284
Expand Down
3 changes: 0 additions & 3 deletions config/arm9/overlays/ov091/delinks.txt
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,6 @@ src/_ZN5StumpD0Ev.c:
complete
.text start:0x021339a8 end:0x021339fc

src/func_ov091_021339fc.c:
.text start:0x021339fc end:0x02133c6c

src/func_ov091_02133c6c.cpp:
complete
.text start:0x02133c6c end:0x02133d1c
Expand Down
9 changes: 7 additions & 2 deletions include/Actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,14 @@ struct Actor : ActorDerived {
s32 mHorzSpeed; /* 0x098 */
s32 mVertAccel; /* 0x09c -- fix12, negative (gravity) */
s32 mTerminalVelocity; /* 0x0a0 -- fix12, negative */
u8 pad_0a4[0x4]; /* likely the same physics block; unproven */
/* 0x0a4 and 0x0ac were padding "likely the same physics block; unproven".
They are real, and Enemy is the evidence: its generated header declared
both as s32 and its sources read them, so once `Enemy : Actor` they have
to exist here. Still unnamed -- what they mean is not evidenced, only
that they are Actor's and four bytes wide. */
s32 unk_0a4; /* 0x0a4 */
s32 mVertSpeed; /* 0x0a8 */
u8 pad_0ac[0x4]; /* likely the same physics block; unproven */
s32 unk_0ac; /* 0x0ac */
u32 mFlags; /* 0x0b0 -- bit 0x10000 suppresses behaviour */
s32 unk_0b4; /* 0x0b4 */
s32 unk_0b8; /* 0x0b8 -- clip radius; 0 skips the camera transform */
Expand Down
19 changes: 19 additions & 0 deletions include/Animation.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
struct BCA_File;
struct SharedFilePtr;

extern "C" void _ZN6Memory16operator_delete2EPv(void *);

struct Animation {
/* 0x00 is the vptr, placed implicitly by the first virtual declaration. */
u32 numFramesAndFlags; /* 0x04 - count in bits 0..29, loop flags in 30..31 */
Expand All @@ -66,6 +68,23 @@ struct Animation {
/* --- static --- */
static char *LoadFile(SharedFilePtr &ptr);
static void UpdateFileOffsets(BCA_File &file);

/* WHAT LETS A REAL `~Class()` REPRODUCE THE ROM'S DELETING DESTRUCTOR.
The compiler generates D0 as "run the destructor body, then call operator
delete on the class". Without this it emits the global `_ZdlPv`, which
exists nowhere in this image, and the D0 comes out one relocated word
different from the ROM -- a difference build_pin.verify CANNOT SEE,
because it wildcards relocated words. Only the link catches it.

This family deallocates through Memory::operator_delete2, not the actor
heap: every D0 below ends with a call to 0x0203cbcc. Actor's copy of this
member calls Memory::Deallocate instead, which is why each needs its own.

Inline, and in the IMMEDIATE base -- mwcc inlines it only when it finds it
in the class or one level up, as include/Actor.h records. No layout
effect: a non-virtual inline member adds no field and no vtable slot. */
void operator delete(void *ptr) { _ZN6Memory16operator_delete2EPv(ptr); }

};

typedef char Animation_size_must_be_0x10[sizeof(Animation) == 0x10 ? 1 : -1];
Expand Down
51 changes: 39 additions & 12 deletions include/ArrowSignRight.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,44 @@
/* AUTO-GENERATED from matched-function evidence by tools/gen_header.py
* class ArrowSignRight: 6 matched functions, 7 evidenced fields.
* Offsets/widths are observed, not guessed. Gaps are explicit padding.
* Field NAMES are placeholders - renaming cannot change codegen. */
#ifndef ARROWSIGNRIGHT_H
#define ARROWSIGNRIGHT_H

#include "types.h"
#include "Model.h"
#include "Platform.h"
#include "ShadowModel.h"

/* Derives from Platform: the destructor stores this class's vtable, then
* Platform's -- inlined -- then destroys the MovingMeshCollider at 0x124 and
* the Model at 0xd4 before chaining to Actor. All three belong to Platform.
* Everything this header used to restate below 0x31e was Actor's and
* Platform's, and is inherited now.
*
* SIZE IS THE OBSERVED FIELD SPAN, rounded up. It guards this declaration; it
* is not independent evidence about the ROM.
*/

#ifdef __cplusplus

struct ArrowSignRight : Platform {
u8 pad_31e[0x2];
ShadowModel mShadowModel; /* 0x320 */
u8 unk_348; /* 0x348 */
u8 pad_349[0x33];
u8 unk_37c; /* 0x37c */

/* --- vtable --- */
virtual ~ArrowSignRight();

int Behavior();
int CleanupResources();
int Render();
};

typedef char ArrowSignRight_size_must_be_0x380[sizeof(ArrowSignRight) == 0x380 ? 1 : -1];

#else

/* The C spelling of the same object, flat. Kept because the D0 file is a C
translation unit that reads these fields, and D0 is compiler-generated so it
can never be migrated. Same arrangement as include/ShadowModel.h. */
struct ArrowSignRight {
u8 pad_000[0xc];
u16 unk_00c; /* 0x00c */
Expand All @@ -26,12 +57,8 @@ struct ArrowSignRight {
u8 unk_348; /* 0x348 */
u8 pad_349[0x33];
u8 unk_37c; /* 0x37c */
#ifdef __cplusplus
/* methods */
int Behavior();
int CleanupResources();
int Render();
#endif
};

#endif
#endif /* __cplusplus */

#endif /* ARROWSIGNRIGHT_H */
41 changes: 31 additions & 10 deletions include/BigBrickBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,9 @@

/* Derives from Platform: the destructor stores this class's vtable, then
* Platform's -- inlined -- then destroys the MovingMeshCollider at 0x124 and
* the Model at 0xd4 before chaining to Actor. All three are Platform's.
* the Model at 0xd4 before chaining to Actor. All three belong to Platform.
* Everything this header used to restate below 0x31e was Actor's and
* Platform's.
*
* THE FIELDS AT 0x31e/0x31f ARE IN PLATFORM'S TAIL PADDING. Platform's last
* field ends at 0x31e and its size rounds to 0x320; the Itanium ABI lets a
* derived class use a non-POD base's tail padding, and the ROM does. The bytes
* settle it -- code here reads this+0x31e and reproduces.
* Platform's, and is inherited now.
*
* SIZE IS THE OBSERVED FIELD SPAN, rounded up. It guards this declaration; it
* is not independent evidence about the ROM.
Expand All @@ -22,9 +17,9 @@
#ifdef __cplusplus

struct BigBrickBlock : Platform {
u8 unk_31e; /* 0x31e - in Platform's tail padding */
u8 unk_31f; /* 0x31f */
u8 mEventID; /* 0x320 */
u8 unk_31e; /* 0x31e */
u8 unk_31f; /* 0x31f */
u8 mEventID; /* 0x320 */
u8 pad_321[0x3];
Actor *mSwitch; /* 0x324 */

Expand All @@ -39,6 +34,32 @@ struct BigBrickBlock : Platform {

typedef char BigBrickBlock_size_must_be_0x328[sizeof(BigBrickBlock) == 0x328 ? 1 : -1];

#else

/* The C spelling of the same object, flat. Kept because the D0 file is a C
translation unit that reads these fields, and D0 is compiler-generated so it
can never be migrated. Same arrangement as include/ShadowModel.h. */
struct BigBrickBlock {
u8 pad_000[0xc];
u16 mActorId; /* 0x00c */
u8 pad_00e[0xc6];
/* Model member, named by the class's own destructor calling
Model's D1 at +0x0d4 -- a relocation the ROM build
checks. Was a u8 marker. [_ZN13BigBrickBlockD1Ev.c] */
Model mModel; /* 0x0d4 */
u8 mMeshCollider; /* 0x124 */
u8 pad_125[0x1f9];
u8 unk_31e; /* 0x31e */
u8 unk_31f; /* 0x31f */
u8 mEventID; /* 0x320 */
u8 pad_321[0x3];
/* Actor * -- the ROM loads this WORD and passes it to _ZN5Actor15FindWithActorIDEjPS_
as that function's `this`, which is an object address, so the word is a Actor *. It
says nothing about the rest of the marker's span, which stays explicit padding. Was
a u8 marker. */
Actor *mSwitch; /* 0x324 */
};

#endif /* __cplusplus */

#endif /* BIGBRICKBLOCK_H */
12 changes: 12 additions & 0 deletions include/BlendModelAnim.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

#ifdef __cplusplus

extern "C" void _ZN6Memory16operator_delete2EPv(void *);

struct BlendModelAnim : ModelAnim {
Fix12i blendWeight; /* 0x64 - 0x1000 is 1.0 */
Fix12i blendStep; /* 0x68 - per-frame increment */
Expand All @@ -41,6 +43,16 @@ struct BlendModelAnim : ModelAnim {
void Advance();
void SetAnim(BCA_File &animFile, int numBlendFrames, int flags,
Fix12<int> speed, u16 startFrame); /* free function, wall 6az */

/* ITS OWN, TO RESOLVE AN AMBIGUITY MULTIPLE INHERITANCE CREATES. ModelAnim
derives from Model (so ModelBase) and from Animation, and both bases
declare operator delete, so an inherited one is "ambiguous access to
name found: ModelBase::operator delete and Animation::operator delete".
Declaring it here picks the same deallocator both bases name, and also
satisfies the rule in include/Actor.h that mwcc only inlines the member
when it is in the class or its immediate base. */
void operator delete(void *ptr) { _ZN6Memory16operator_delete2EPv(ptr); }

};

typedef char BlendModelAnim_size_must_be_0x70[sizeof(BlendModelAnim) == 0x70 ? 1 : -1];
Expand Down
68 changes: 43 additions & 25 deletions include/BlueCoinSwitch.h
Original file line number Diff line number Diff line change
@@ -1,24 +1,47 @@
/* Hand-written from matched-function evidence:
* class BlueCoinSwitch, ov002 0x020f11b0-0x020f15fc (9 functions, no other
* class in the TU -- tu_map.py).
*
* Two names again, as with CastleWater. The symbols mangle from
* `BlueCoinSwitch`, so the struct is spelled that way; the RTTI record calls it
* `daObjBC_Switch_c` and include/daObjBC_Switch_c.h is the generated view under
* that name. Same object, and this is the header methods are defined against.
*
* It is a Platform -- Behavior and InitResources both call
* Platform::UpdateModelPosAndRotY and Platform::UpdateClsnPosAndRot on it -- so
* mPos and mAngleY sit at Actor's offsets. Written FLAT with the inherited
* slots restated, as every other generated header here is.
*
* Field NAMES are placeholders - renaming cannot change codegen.
*/
#ifndef BLUECOINSWITCH_H
#define BLUECOINSWITCH_H

#include "types.h"
#include "math/Matrix.h"
#include "Platform.h"

/* Derives from Platform: the destructor stores this class's vtable, then
* Platform's -- inlined -- then destroys the MovingMeshCollider at 0x124 and
* the Model at 0xd4 before chaining to Actor. All three belong to Platform.
* Everything this header used to restate below 0x31e was Actor's and
* Platform's, and is inherited now.
*
* SIZE IS THE OBSERVED FIELD SPAN, rounded up. It guards this declaration; it
* is not independent evidence about the ROM.
*/

#ifdef __cplusplus

struct BlueCoinSwitch : Platform {
u8 pad_31e[0x2];
s32 unk_320; /* 0x320 */
s32 unk_324; /* 0x324 */
u16 unk_328; /* 0x328 */
u16 unk_32a; /* 0x32a */
u8 unk_32c; /* 0x32c */
u8 unk_32d; /* 0x32d */
u8 unk_32e; /* 0x32e */

/* --- vtable --- */
virtual ~BlueCoinSwitch();

s32 Behavior();
int CleanupResources();
int InitResources();
int Render();
};

typedef char BlueCoinSwitch_size_must_be_0x330[sizeof(BlueCoinSwitch) == 0x330 ? 1 : -1];

#else

/* The C spelling of the same object, flat. Kept because the D0 file is a C
translation unit that reads these fields, and D0 is compiler-generated so it
can never be migrated. Same arrangement as include/ShadowModel.h. */
struct BlueCoinSwitch {
u8 pad_000[0x8];
/* Spawn word, unpacked into two fields by InitResources: bits 0-3 become
Expand Down Expand Up @@ -63,13 +86,8 @@ struct BlueCoinSwitch {
u8 unk_32c; /* 0x32c */
u8 unk_32d; /* 0x32d */
u8 unk_32e; /* 0x32e */
#ifdef __cplusplus
/* methods */
s32 Behavior();
int CleanupResources();
int InitResources();
int Render();
#endif
};

#endif
#endif /* __cplusplus */

#endif /* BLUECOINSWITCH_H */
10 changes: 4 additions & 6 deletions include/BowserFireSeaArena.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
*
* Two sub-objects of its own, on top of Platform's two:
*
* Platform data ends 0x31e -> unk_31e
* three s16 = 0x324 -> mModel2
* Platform 0x000 + 0x324 = 0x324 -> mModel2
* Model 0x324 + 0x050 = 0x374 -> mMovingMeshCollider2
* MovingMeshCollider 0x374 + 0x1c8 = 0x53c -> padding, then unk_56c
*
Expand All @@ -34,10 +33,9 @@
#include "Platform.h"

struct BowserFireSeaArena : Platform {
/* Platform's data ends at 0x31e, so this class's own fields start there --
these three, and only then mModel2 at 0x324. They were briefly declared as
Platform's; that reproduced this class either way and made StarSwitch, whose
own first s32 sits at 0x320, impossible. */
/* THIS CLASS'S OWN, not Platform's -- Platform ends at 0x31e. They are what
push mModel2 from 0x320 to 0x324, and the first two sit in the base's
tail padding. */
s16 unk_31e; /* 0x31e */
s16 unk_320; /* 0x320 */
s16 unk_322; /* 0x322 */
Expand Down
Loading
Loading