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
4 changes: 2 additions & 2 deletions config/arm9/overlays/ov023/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ _ZTV16daObjFm_Battan_c kind:data(any) addr:0x02111fe4
data_ov023_02112064 kind:data(any) addr:0x02112064
data_ov023_02112080 kind:bss addr:0x02112080
data_ov023_02112088 kind:bss addr:0x02112088
@348 kind:bss addr:0x02112090
@347 kind:bss addr:0x0211209c
@357 kind:bss addr:0x02112090
@356 kind:bss addr:0x0211209c
data_ov023_021120a8 kind:bss addr:0x021120a8
data_ov023_021120bc kind:bss addr:0x021120bc ambiguous
12 changes: 6 additions & 6 deletions config/tu_manifest.d/ov023/daObjFm_Battan_c.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,14 @@
"evidence": "model resource handle constructed with file ID 1558"
},
{
"symbol": "@348",
"symbol": "@357",
"address": "0x02112090",
"size": "0xc",
"binding": "STB_GLOBAL",
"evidence": "compiler-generated collision resource destructor-registration node"
},
{
"symbol": "@347",
"symbol": "@356",
"address": "0x0211209c",
"size": "0xc",
"binding": "STB_GLOBAL",
Expand Down Expand Up @@ -230,13 +230,13 @@
"evidence": "mwcc emits the ctor-table object local; DSD exposes owned symbols globally and cannot encode a local symbols.txt entry"
},
{
"symbol": "@348",
"symbol": "@357",
"from": "STB_LOCAL",
"to": "STB_GLOBAL",
"evidence": "compiler-local collision registration node is a configured initializer relocation destination at 0x02112090"
},
{
"symbol": "@347",
"symbol": "@356",
"from": "STB_LOCAL",
"to": "STB_GLOBAL",
"evidence": "compiler-local model registration node is a configured initializer relocation destination at 0x0211209c"
Expand Down Expand Up @@ -308,7 +308,7 @@
"source": "0x02111b00",
"type": "R_ARM_ABS32",
"kind": "load",
"symbol": "@347",
"symbol": "@356",
"addend": 0,
"target_module": "ov023",
"target_address": "0x0211209c"
Expand Down Expand Up @@ -338,7 +338,7 @@
"source": "0x02111b10",
"type": "R_ARM_ABS32",
"kind": "load",
"symbol": "@348",
"symbol": "@357",
"addend": 0,
"target_module": "ov023",
"target_address": "0x02112090"
Expand Down
50 changes: 50 additions & 0 deletions include/Sound.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@

#include "types.h"

/* Global scope on purpose: inside `namespace Sound` this would declare
Sound::dActor_c, which is not the type any caller is holding. */
struct dActor_c;

namespace Sound {

/* A bank-bound wrapper over Sound::Play, defined in
Expand Down Expand Up @@ -65,6 +69,52 @@ struct Player {
static void SetPlayableSeqCount(int index, int count);
};

/* The rest of the recovered Sound entry points, declared so callers stop
hand-spelling the mangled name. Two different sources, kept straight:

PARAMETERS come from the mangled symbol. Note what that is and is not: the
image holds zero _Z... strings, so these names are this TREE's convention
rather than ROM evidence (see the Fix12 note in types.h). What they are is
the one spelling every existing caller already agrees on, which is what a
shared declaration needs. Where the convention and the bytes disagree the
bytes win -- so `5Fix12IiE` is declared Fix12i, the plain s32 the callers
actually pass, not the template the name implies.

Sound::PlaySub and Sound::ChangeMusicVolume are deliberately NOT here. Their
definitions are mangled-name C symbols carrying `5Fix12IiE`, and no type this
tree defines mangles to that (types.h refuses to make Fix12 a template), so a
namespace-qualified call cannot reach them. Callers keep the extern spelling.

RETURN TYPES come from each DEFINITION in src/, never from a caller. A
return type is not part of an Itanium mangled name, so the symbol is
silent on it and a caller that ignores the result evidences nothing.

Parameter NAMES are mostly not recoverable -- the definitions carry
placeholders -- so only the ones a definition actually names are named here.

PlaySub and ChangeMusicVolume are defined as `extern "C"` functions literally
named by the mangled symbol, so nothing type-checks across that seam and a
wrong declaration here would link silently. Their call sites are byte-verified
individually, which is what actually settles them. */


void Play(u32, u32, const Vector3 &v);
void Play2D(u32, u32);
void PlayBank0(u32 id, const Vector3 &pos);
u32 PlayBank2_2D(u32);
u32 PlayCharVoice(u32, u32, const Vector3 &v);
int PlayLong(u32 handle, u32, u32, const Vector3 &pos, s16);
int PlaySecretSound(dActor_c *actor, u16 *counter);

void PauseMusic();
void UnpauseMusic();
void LoadInitialGroup(int group);
void LoadAndSetMusic_Layer1(int);
void StopLoadedMusic_Layer1(u32);
void StopLoadedMusic_Layer2();

void UnsetPlayerVoiceGroup();

}

#endif /* __cplusplus */
Expand Down
6 changes: 3 additions & 3 deletions src/_ZN10PyramidTop8BehaviorEv.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
//cpp
#include "Sound.h"
#include "types.h"
// @symbol _ZN10PyramidTop8BehaviorEv
/* recovered: named members + shared header, real C++ method, declarations from a shared header */
#include "decl_common.h"
/* recovered: named members + shared header, real C++ method */
#include "PyramidTop.h"
extern "C" {
extern int _ZN5Sound15PlaySecretSoundEP8dActor_cPt(void* actor, void* pt);
extern void _ZN5Sound9PlayBank3EjRK7Vector3(unsigned int bank, void* pos);
}

Expand All @@ -20,14 +20,14 @@ int PyramidTop::Behavior()
}
break;
case 1:
_ZN5Sound15PlaySecretSoundEP8dActor_cPt(((char*)this), (void*)((char*)&mSoundTimer));
Sound::PlaySecretSound((dActor_c *)(((char*)this)), (u16 *)(((char*)&mSoundTimer)));
if (mStateTimer == 0) {
_ZN5Sound9PlayBank3EjRK7Vector3(0x4b, (void*)((char*)&mCamSpacePosX));
}
func_ov024_02111350(((char*)this));
break;
case 2:
if (_ZN5Sound15PlaySecretSoundEP8dActor_cPt(((char*)this), (void*)((char*)&mSoundTimer))) {
if (Sound::PlaySecretSound((dActor_c *)(((char*)this)), (u16 *)(((char*)&mSoundTimer)))) {
_ZN5Sound9PlayBank3EjRK7Vector3(0x4c, (void*)((char*)&mCamSpacePosX));
func_ov024_021112c0(((char*)this));
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/_ZN10dScEntry_c16CleanupResourcesEv.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//cpp
#include "Sound.h"
// @symbol _ZN10dScEntry_c16CleanupResourcesEv
/* recovered: real C++ method */
/* dScEntry_c::CleanupResources() -- vtable slot 3. Releases the level-entry
Expand All @@ -9,7 +10,6 @@

extern "C" {
void func_020308b4(void *self);
void _ZN5Sound21UnsetPlayerVoiceGroupEv(void);
extern void *data_0209d4a8;
}

Expand All @@ -21,7 +21,7 @@ s32 dScEntry_c::CleanupResources()
data_0209b2e8 = (void *)0;
}
data_0209d4a8 = (void *)0;
_ZN5Sound21UnsetPlayerVoiceGroupEv();
Sound::UnsetPlayerVoiceGroup();
CleanCommonModelDataArr();
return 1;
}
4 changes: 2 additions & 2 deletions src/_ZN10dScTitle_c16CleanupResourcesEv.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
//cpp
#include "Sound.h"
// @symbol _ZN10dScTitle_c16CleanupResourcesEv
/* recovered: real C++ method */
/* dScTitle_c::CleanupResources() -- vtable slot 3. The title scene owns only
* its voice group; releasing that is the whole teardown. */
#include "dScTitle_c.h"

extern "C" void _ZN5Sound21UnsetPlayerVoiceGroupEv(void);

s32 dScTitle_c::CleanupResources()
{
_ZN5Sound21UnsetPlayerVoiceGroupEv();
Sound::UnsetPlayerVoiceGroup();
return 1;
}
4 changes: 2 additions & 2 deletions src/_ZN11dScMiniGm_c16CleanupResourcesEv.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//cpp
#include "Sound.h"
// @symbol _ZN11dScMiniGm_c16CleanupResourcesEv
/* recovered: real C++ method */
/* dScMiniGm_c::CleanupResources() -- vtable slot 3. Tears the running minigame
Expand All @@ -7,13 +8,12 @@
#include "dScMiniGm_c.h"
#include "decl_common.h"

extern "C" void _ZN5Sound21UnsetPlayerVoiceGroupEv(void);

s32 dScMiniGm_c::CleanupResources()
{
if (data_0208a174[0] >= 0) {
func_ov005_020c0030((int)this);
}
_ZN5Sound21UnsetPlayerVoiceGroupEv();
Sound::UnsetPlayerVoiceGroup();
return 1;
}
4 changes: 2 additions & 2 deletions src/_ZN11dScMiniGm_c8BehaviorEv.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//cpp
#include "Sound.h"
// @symbol _ZN11dScMiniGm_c8BehaviorEv
/* recovered: named members + real C++ method */
/* dScMiniGm_c::Behavior() -- vtable slot 6. Runs the minigame-menu frame: a
Expand All @@ -14,7 +15,6 @@
extern "C" {
int func_02012790(int);
int RandomIntInternal(int *seed);
void _ZN5Sound22StopLoadedMusic_Layer1Ej(unsigned int);

extern unsigned char data_020a0e40;
extern unsigned short data_020a0e5a[];
Expand Down Expand Up @@ -52,7 +52,7 @@ s32 dScMiniGm_c::Behavior()
if (mExitTimer == 1) {
_ZN8dScene_c20SetAndStopColorFaderEv();
ExitMinigameMenu();
_ZN5Sound22StopLoadedMusic_Layer1Ej(0x1e);
Sound::StopLoadedMusic_Layer1(0x1e);
mExiting = 1;
return 1;
}
Expand Down
9 changes: 4 additions & 5 deletions src/_ZN12dScStarSel_c13InitResourcesEv.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//cpp
#include "Sound.h"
// @symbol _ZN12dScStarSel_c13InitResourcesEv
/* recovered: real C++ method over include/dScStarSel_c.h -- vtable slot 0.
*
Expand All @@ -24,8 +25,6 @@

extern "C" {
void Enable3dEngines(void);
void _ZN5Sound16LoadInitialGroupEi(int);
void _ZN5Sound22LoadAndSetMusic_Layer1Ei(int);
void _ZN2GX12SetBankForBGEt(u16);
void _ZN2GX13SetBankForOBJEt(u16);
void _ZN2GX15SetBankForSubBGEt(u16);
Expand Down Expand Up @@ -84,12 +83,12 @@ s32 dScStarSel_c::InitResources()
LoadTextNarcs();
LoadArchive(0);
Enable3dEngines();
_ZN5Sound16LoadInitialGroupEi(3);
Sound::LoadInitialGroup(3);
if (data_02092110 == 0x24 || data_02092110 == 0x26 || data_02092110 == 0x28) {
_ZN5Sound22LoadAndSetMusic_Layer1Ei(0x24);
Sound::LoadAndSetMusic_Layer1(0x24);
func_0201277c(0xB8);
} else {
_ZN5Sound22LoadAndSetMusic_Layer1Ei(0x16);
Sound::LoadAndSetMusic_Layer1(0x16);
}
REG16(0x4000304) |= 0x8000;
::Initialise3dGraphics(0);
Expand Down
8 changes: 3 additions & 5 deletions src/_ZN13BasementWater8BehaviorEv.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
//cpp
#include "Sound.h"
// @symbol _ZN13BasementWater8BehaviorEv
/* recovered: named members + shared header, real C++ method */
#include "BasementWater.h"
extern "C" {
extern void _ZN5Sound15PlaySecretSoundEP8dActor_cPt(void* a, unsigned short* p);
extern unsigned int _ZN5Sound8PlayLongEjjjRK7Vector3s(unsigned int a, unsigned int b, unsigned int d, void* v, unsigned int e);
extern void _ZN7Minimap19UpdateLevelSpecificEv(void);
extern void _ZN10dBgActor_c21UpdateModelPosAndRotYEv(void* thiz);
extern void _ZN10dBgActor_c19UpdateClsnPosAndRotEv(void* thiz);
Expand All @@ -16,12 +15,11 @@ extern int data_0209f32c;
int BasementWater::Behavior()
{
if (mWasJustDrained != 0)
_ZN5Sound15PlaySecretSoundEP8dActor_cPt(((char*)this), (unsigned short*)((char*)&mSoundTimer));
Sound::PlaySecretSound((dActor_c *)(((char*)this)), (u16 *)(((char*)&mSoundTimer)));
if (mPosY <= mLoweredY) {
mPosY = mLoweredY;
} else if (*(int*)((char*)data_0209caa0 + 8) & 0x80000) {
mSoundID = _ZN5Sound8PlayLongEjjjRK7Vector3s(
mSoundID, 3, 0x96, (void*)((char*)&mCamSpacePosX), 0);
mSoundID = Sound::PlayLong(mSoundID, 3, 0x96, *(const Vector3 *)(((char*)&mCamSpacePosX)), 0);
*(int*)((char*)&mPosY) -= 0x5000;
mWasJustDrained = 1;
if (mPosY <= mLoweredY) {
Expand Down
3 changes: 2 additions & 1 deletion src/_ZN13KoopaTheQuick16CleanupResourcesEv.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//cpp
#include "Sound.h"
// @symbol _ZN13KoopaTheQuick16CleanupResourcesEv
/* recovered: named members + shared header, real C++ method, declarations from a shared header */
#include "decl_common.h"
Expand Down Expand Up @@ -27,6 +28,6 @@ int KoopaTheQuick::CleanupResources()
_ZN13SharedFilePtr7ReleaseEv(&data_ov062_0211e03c);
_ZN13SharedFilePtr7ReleaseEv(&data_ov062_0211e02c);
_ZN13SharedFilePtr7ReleaseEv(&data_ov062_0211e004);
if (mIsRacing) _ZN5Sound22StopLoadedMusic_Layer2Ev();
if (mIsRacing) Sound::StopLoadedMusic_Layer2();
return 1;
}
3 changes: 2 additions & 1 deletion src/_ZN15dScMgSnowball_c8BehaviorEv.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//cpp
#include "Sound.h"
// @symbol _ZN15dScMgSnowball_c8BehaviorEv
#include "decl_common.h"
#include "dScMgSnowball_c.h"
Expand Down Expand Up @@ -224,7 +225,7 @@ s32 dScMgSnowball_c::Behavior()
if (I(0xab3c) - I(0xaba0) < (I(0xba04) << 12) + 0x10000) {
func_ov004_020adb1c(I(0xb9e0));
I(0xb9f4) = 2;
_ZN5Sound12PlayBank2_2DEj(0x10e);
Sound::PlayBank2_2D(0x10e);
}
break;

Expand Down
7 changes: 3 additions & 4 deletions src/_ZN5Stage10PS_CleanupEv.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//cpp
#include "Sound.h"
/* Stage::PS_Cleanup() at 0x0202d2c8. Static, like the rest of the PS_ group:
* restarts the timer, unpauses or stops the music and clears the blend
* registers, all through globals. */
Expand All @@ -13,8 +14,6 @@ extern unsigned char data_0209f280[];
extern unsigned short data_0209f300[];
extern unsigned char data_0209f2c4[];
extern int _ZN5Timer10StartTimerEv(void*);
extern int _ZN5Sound12UnpauseMusicEv(void);
extern int _ZN5Sound22StopLoadedMusic_Layer1Ej(unsigned int);
}
void Stage::PS_Cleanup(){
if(*data_0209f2a0){
Expand All @@ -23,8 +22,8 @@ void Stage::PS_Cleanup(){
}
*data_0209d45c &= ~0xe;
*data_0209d454 &= ~3;
if(*data_0209f280==0) _ZN5Sound12UnpauseMusicEv();
else _ZN5Sound22StopLoadedMusic_Layer1Ej(0x3c);
if(*data_0209f280==0) Sound::UnpauseMusic();
else Sound::StopLoadedMusic_Layer1(0x3c);
*data_0209f300=0xf;
*(short*)0x4000050=0;
*(short*)0x4001050=0;
Expand Down
4 changes: 2 additions & 2 deletions src/_ZN5Stage7PS_InitEv.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//cpp
#include "Sound.h"
// @symbol _ZN5Stage7PS_InitEv
/* recovered: real C++ method -- named members, local shadow class
*
Expand Down Expand Up @@ -46,7 +47,6 @@ extern u16 data_0209f300;
extern s32 data_0209fc68;

extern int SublevelToLevel(int i);
extern void _ZN5Sound10PauseMusicEv(void);
extern void _ZN3G2x18SetBlendBrightnessEPVtts(volatile u16 *p, int a, int b);
}

Expand Down Expand Up @@ -105,7 +105,7 @@ void Stage::PS_Init()
}
}

_ZN5Sound10PauseMusicEv();
Sound::PauseMusic();
_ZN3G2x18SetBlendBrightnessEPVtts((volatile u16 *)0x04000050, r5 | 0x20, -7);
_ZN3G2x18SetBlendBrightnessEPVtts((volatile u16 *)0x04001050, r4 | 0x20, -7);
}
4 changes: 2 additions & 2 deletions src/_ZN6Player13St_Throw_InitEv.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//cpp
#include "Sound.h"
// @symbol _ZN6Player13St_Throw_InitEv
/* recovered: named members + shared header, real C++ method
*
Expand All @@ -8,7 +9,6 @@
*/
#include "Player.h"
extern "C" {
extern int _ZN5Sound13PlayCharVoiceEjjRK7Vector3(unsigned a, unsigned b, const Vector3& v);
/* SetAnim takes a Fix12<int> by value -- the mwccarm 6az wall, runbook
section 7 -- so it stays extern "C" with a scalar in that slot. */
extern int _ZN6Player7SetAnimEji5Fix12IiEj(void*,unsigned,int,int,unsigned);
Expand All @@ -30,7 +30,7 @@ int Player::St_Throw_Init()
anim30:
_ZN6Player7SetAnimEji5Fix12IiEj(this, 0x30, 0x40000000, 0x1000, 0);
voice:
_ZN5Sound13PlayCharVoiceEjjRK7Vector3(mCharacter, 0x13, *(const Vector3*)&mCamSpacePosX);
Sound::PlayCharVoice(mCharacter, 0x13, *(const Vector3*)&mCamSpacePosX);
} else {
_ZN6Player7SetAnimEji5Fix12IiEj(this, 0x8a, 0x40000000, 0x1000, 0);
}
Expand Down
Loading
Loading