A bit of source manager maybe

This commit is contained in:
robojumper
2025-06-07 10:28:42 +02:00
parent 5969ccb7fd
commit 00d7d44105
8 changed files with 124 additions and 32 deletions
+2
View File
@@ -2456,6 +2456,8 @@ d/snd/d_snd_anim_sound.cpp:
d/snd/d_snd_source_mgr.cpp:
.text start:0x80382410 end:0x803864C8 align:16
.ctors start:0x804DB91C end:0x804DB920
.sbss start:0x80575DA8 end:0x80575DB0
.sdata2 start:0x8057DB68 end:0x8057DBC0
d/snd/d_snd_source_group.cpp:
.text start:0x803864D0 end:0x803889BC align:16
+8 -8
View File
@@ -20960,10 +20960,10 @@ fn_80383960 = .text:0x80383960; // type:function size:0x9C
d_s_vt_0x180__14dSoundSource_cFv = .text:0x80383A00; // type:function size:0x8
d_s_vt_0x1DC__14dSoundSource_cFv = .text:0x80383A10; // type:function size:0x8
d_s_vt_0x1D8__14dSoundSource_cFv = .text:0x80383A20; // type:function size:0x4
fn_80383A30 = .text:0x80383A30; // type:function size:0x78
initEnemyBgmRelatedMgr = .text:0x80383AB0; // type:function size:0x48
fn_80383B00 = .text:0x80383B00; // type:function size:0x10
EnemyBgmRelatedMgr__ctor = .text:0x80383B10; // type:function size:0x140
__dt__33SndMgrDisposer<15dSndSourceMgr_c>Fv = .text:0x80383A30; // type:function size:0x78
create__33SndMgrDisposer<15dSndSourceMgr_c>Fv = .text:0x80383AB0; // type:function size:0x48
remove__33SndMgrDisposer<15dSndSourceMgr_c>Fv = .text:0x80383B00; // type:function size:0x10
__ct__15dSndSourceMgr_cFv = .text:0x80383B10; // type:function size:0x140
fn_80383C50 = .text:0x80383C50; // type:function size:0x78
fn_80383CD0 = .text:0x80383CD0; // type:function size:0x4C
fn_80383D20 = .text:0x80383D20; // type:function size:0x44
@@ -21015,7 +21015,7 @@ fn_803857C0 = .text:0x803857C0; // type:function size:0x5C
fn_80385820 = .text:0x80385820; // type:function size:0x8
fn_80385830 = .text:0x80385830; // type:function size:0x44
fn_80385880 = .text:0x80385880; // type:function size:0x50
fn_803858D0 = .text:0x803858D0; // type:function size:0xA0
playFlowSound__15dSndSourceMgr_cFUl = .text:0x803858D0; // type:function size:0xA0
fn_80385970 = .text:0x80385970; // type:function size:0x90
vt_0x118__14dSoundSource_cFv = .text:0x80385A00; // type:function size:0x8
vt_0x114__14dSoundSource_cFv = .text:0x80385A10; // type:function size:0x4
@@ -37750,7 +37750,7 @@ lbl_80549EC4 = .data:0x80549EC4; // type:object size:0x1EC
lbl_8054A0B0 = .data:0x8054A0B0; // type:object size:0x1EC
lbl_8054A29C = .data:0x8054A29C; // type:object size:0x1EC
lbl_8054A488 = .data:0x8054A488; // type:object size:0x1EC
lbl_8054A674 = .data:0x8054A674; // type:object size:0xC
__vt__33SndMgrDisposer<15dSndSourceMgr_c> = .data:0x8054A674; // type:object size:0xC
lbl_8054A680 = .data:0x8054A680; // type:object size:0x150
lbl_8054A7D0 = .data:0x8054A7D0; // type:object size:0xC
__vt__14dSoundSource_c = .data:0x8054A7DC; // type:object size:0x1EC
@@ -41913,8 +41913,8 @@ sInstance__20dSndSmallEffectMgr_c = .sbss:0x80575D98; // type:object size:0x4 da
sDisposer__20dSndSmallEffectMgr_c = .sbss:0x80575D9C; // type:object size:0x4 data:4byte
lbl_80575DA0 = .sbss:0x80575DA0; // type:object size:0x4 data:4byte
lbl_80575DA4 = .sbss:0x80575DA4; // type:object size:0x4 data:4byte
ENEMY_BGM_RELATED_MGR = .sbss:0x80575DA8; // type:object size:0x4 data:4byte
lbl_80575DAC = .sbss:0x80575DAC; // type:object size:0x4 data:4byte
sInstance__15dSndSourceMgr_c = .sbss:0x80575DA8; // type:object size:0x4 data:4byte
sDisposer__15dSndSourceMgr_c = .sbss:0x80575DAC; // type:object size:0x4 data:4byte
lbl_80575DB0 = .sbss:0x80575DB0; // type:object size:0x8 data:4byte
lbl_80575DB8 = .sbss:0x80575DB8; // type:object size:0x8 data:byte
lbl_80575DC0 = .sbss:0x80575DC0; // type:object size:0x8 data:4byte
+1 -1
View File
@@ -78,8 +78,8 @@ private:
// at 0x00: dSoundSourceIf_c vtable
// at 0x04: dSnd3DActor_c sub-object
// at 0x58: thunk-vtable
/* 0xE8 */ u8 field_0xE8[0xF0 - 0xE8];
/* 0xE8 */ nw4r::ut::Node mMgrLink;
/* 0x0F0 */ UNKWORD field_0x0F0;
/* 0x0F4 */ UNKWORD field_0x0F4;
/* 0x0F8 */ dAcBase_c *mpPlayer;
+3 -2
View File
@@ -21,6 +21,7 @@ class dSoundSource_c;
class dSndSourceGroup_c {
public:
dSndSourceGroup_c();
dSndSourceGroup_c(u32, const char*, u32, u32);
~dSndSourceGroup_c();
void registerSource(dSoundSource_c *);
@@ -42,8 +43,8 @@ private:
void resetSoundSourceParam();
void clearList();
/* 0x00 */ nw4r::ut::Node mNode;
/* 0x08 */ u8 _0x08[0x10 - 0x08];
/* 0x00 */ nw4r::ut::Node mNode1;
/* 0x08 */ nw4r::ut::Node mNode2;
/* 0x10 */ UNKWORD field_0x10;
/* 0x14 */ UNKWORD field_0x14;
/* 0x18 */ UNKWORD field_0x18;
+64
View File
@@ -0,0 +1,64 @@
#ifndef D_SND_SOURCE_MGR_H
#define D_SND_SOURCE_MGR_H
#include "d/snd/d_snd_source.h"
#include "d/snd/d_snd_source_group.h"
#include "d/snd/d_snd_util.h"
#include "nw4r/ut/ut_list.h"
SND_DISPOSER_FORWARD_DECL(dSndSourceMgr_c);
// 0 - "" - Link
// ActorLink::initModels
// 0x2C - NpcKenT
// 0x20 - Door, TBox, CharE (Chair), Tubo
// 0x35 - TgSound
// 0x2D - PyBird
// 0x22 - Bamboo
// 0x23 - Item
// 0x19 - Nusi*, BKr, BBs
// 0x1A - MgRArm, MgLArm
// 0x1B - Mgtail
class dSndSourceMgr_c {
SND_DISPOSER_MEMBERS(dSndSourceMgr_c);
static const u32 NUM_GROUPS = 128;
public:
dSndSourceMgr_c();
void playFlowSound(u32 id);
private:
/* 0x0010 */ u8 field_0x0010;
/* 0x0011 */ u8 field_0x0011;
/* 0x0012 */ u8 field_0x0012;
/* 0x0013 */ u8 field_0x0013;
/* 0x0014 */ dSndSourceGroup_c *mpDefaultGroup;
/* 0x0018 */ nw4r::ut::List mGroupList1;
/* 0x0024 */ nw4r::ut::List mGroupList2;
/* 0x0030 */ nw4r::ut::List mGroupList3;
/* 0x003C */ dSndSourceGroup_c mGroups[NUM_GROUPS];
// Not sure what these are for
/* 0x383C */ nw4r::ut::List mSourceList1; // node offset 0xE8, probably into dSoundSource::mMgrLink
/* 0x3848 */ nw4r::ut::List field_0x3848; // node offset 0x15C, possibly a subset of source types
/* 0x3854 */ nw4r::ut::List field_0x3854; // node offset 0x160
/* 0x3860 */ UNKWORD field_0x3860;
/* 0x3864 */ UNKWORD field_0x3864;
/* 0x3868 */ UNKWORD field_0x3868;
/* 0x386C */ f32 field_0x386C;
/* 0x3870 */ dSoundSource_c *mpPlayerSource;
/* 0x3874 */ dSoundSource_c *mpFiTalkSource;
/* 0x3878 */ dSoundSource_c *field_0x3878;
/* 0x387C */ dSoundSource_c *field_0x387C;
/* 0x3880 */ dSoundSource_c *field_0x3880; // fi singing related?
/* 0x3884 */ dSoundSource_c *field_0x3884;
};
#endif
+3 -20
View File
@@ -3,6 +3,7 @@
#include "common.h"
#include "d/snd/d_snd_player_mgr.h"
#include "d/snd/d_snd_source_mgr.h"
class dSndPlayerMgr_c;
class dSndSound_c;
@@ -29,26 +30,8 @@ extern "C" bool fn_80364DA0(void *);
extern "C" void fn_80365020(void *);
extern "C" void fn_80364D00(void *, s32);
// ENEMY_BGM_RELATED_MGR -> dSndSourceMgr_c
// 0x3870 = player sound source
// 0x3874 = Fi
// 0 - "" - Link
// ActorLink::initModels
// 0x2C - NpcKenT
// 0x20 - Door, TBox, CharE (Chair), Tubo
// 0x35 - TgSound
// 0x2D - PyBird
// 0x22 - Bamboo
// 0x23 - Item
// 0x19 - Nusi*, BKr, BBs
// 0x1A - MgRArm, MgLArm
// 0x1B - Mgtail
extern "C" void *ENEMY_BGM_RELATED_MGR;
extern "C" void fn_80384570(void *, bool);
extern "C" void fn_803858D0(void *);
#define ENEMY_BGM_RELATED_MGR (dSndSourceMgr_c::GetInstance())
extern "C" void fn_80384570(dSndSourceMgr_c *, bool);
// This one has a SoundActor that actually plays the BGM_ music tracks,
// including the battle BGM track.
+2 -1
View File
@@ -23,6 +23,7 @@
#include "d/lyt/meter/d_lyt_meter.h"
#include "d/lyt/msg_window/d_lyt_msg_window.h"
#include "d/snd/d_snd_small_effect_mgr.h"
#include "d/snd/d_snd_source_mgr.h"
#include "egg/core/eggHeap.h"
#include "f/f_base.h"
#include "f/f_profile.h"
@@ -198,7 +199,7 @@ void dFlow_c::playSound(u32 params) {
return;
}
if (params >= 100) {
fn_803858D0(ENEMY_BGM_RELATED_MGR);
dSndSourceMgr_c::GetInstance()->playFlowSound(params);
return;
}
+41
View File
@@ -0,0 +1,41 @@
#include "d/snd/d_snd_source_mgr.h"
#include "common.h"
#include "d/snd/d_snd_source.h"
#include "nw4r/ut/ut_list.h"
#include <cmath>
SND_DISPOSER_DEFINE(dSndSourceMgr_c);
dSndSourceMgr_c::dSndSourceMgr_c()
: field_0x0010(0),
field_0x0011(0),
field_0x0012(0),
field_0x0013(0),
field_0x3860(0),
field_0x3864(0),
field_0x3868(0),
field_0x386C(INFINITY),
mpPlayerSource(nullptr),
mpFiTalkSource(nullptr),
field_0x3878(nullptr),
field_0x387C(nullptr),
field_0x3880(nullptr),
field_0x3884(nullptr) {
// TODO offsetof
nw4r::ut::List_Init(&mGroupList1, 0);
nw4r::ut::List_Init(&mGroupList2, 0);
// TODO figure out what these are for
nw4r::ut::List_Init(&mGroupList3, 8);
nw4r::ut::List_Init(&mSourceList1, 0xE8);
nw4r::ut::List_Init(&field_0x3848, 0x15C);
nw4r::ut::List_Init(&field_0x3854, 0x160);
mpDefaultGroup = new dSndSourceGroup_c(-1, "Default", 0, 0);
for (dSndSourceGroup_c *group = &mGroups[0]; group < &mGroups[NUM_GROUPS]; group++) {
nw4r::ut::List_Append(&mGroupList2, group);
}
}