More simple handles

This commit is contained in:
robojumper
2025-06-13 23:53:19 +02:00
parent f56b72a2e0
commit 05c7eb29c9
9 changed files with 295 additions and 22 deletions
+40 -2
View File
@@ -2735,15 +2735,53 @@ d/snd/d_snd_distant_sound_actor_pool.cpp:
.ctors start:0x804DB930 end:0x804DB934
.data start:0x8054D400 end:0x8054D410
.sbss start:0x80575DD0 end:0x80575DD8
.sdata2 start:0x8057E398 end:0x8057E3B8
.sdata2 start:0x8057E398 end:0x8057E3B0
.bss start:0x805D1018 end:0x805D1030
d/snd/d_snd_distant_sound_actor.cpp:
.text start:0x80393E00 end:0x80394208 align:16
.data start:0x8054D410 end:0x8054D470
d/snd/d_snd_se_sound.cpp:
.text start:0x80394210 end:0x8039466C align:16
.data start:0x8054D470 end:0x8054D488
.sdata2 start:0x8057E3B0 end:0x8057E3B8
d/snd/d_snd_se_sound_1.cpp:
.text start:0x80394670 end:0x803946C4 align:16
.data start:0x8054D488 end:0x8054D4A0
d/snd/d_snd_se_sound_2.cpp:
.text start:0x803946D0 end:0x803947AC align:16
.data start:0x8054D4A0 end:0x8054D4B8
d/snd/d_snd_se_sound_pool.cpp:
.text start:0x803947B0 end:0x80394DD4 align:16
.data start:0x8054D4B8 end:0x8054D4C8
d/snd/d_snd_sound_link_body_callbacks.cpp:
.text start:0x80394DE0 end:0x803957B8 align:16
d/snd/d_snd_sound_enemy_callbacks.cpp:
.text start:0x803957C0 end:0x80396104 align:16
d/snd/d_snd_sound_object_callbacks.cpp:
.text start:0x80396110 end:0x80398430 align:16
d/snd/d_snd_sound_equipment_callbacks.cpp:
.text start:0x80398430 end:0x80398AD4 align:16
d/snd/d_snd_sound_npc_callbacks.cpp:
.text start:0x80398AE0 end:0x80398E18 align:16
d/snd/d_snd_sound_npc_2_callbacks.cpp:
.text start:0x80398E20 end:0x80398FFC align:16
d/snd/d_snd_sound_tgsound_callbacks.cpp:
.text start:0x80399000 end:0x8039942C align:16
d/snd/d_snd_mgr_unk_11.cpp:
.text start:0x80394210 end:0x8039A848 align:16
.text start:0x80399430 end:0x8039A848 align:16
.ctors start:0x804DB934 end:0x804DB938
d/snd/d_snd_calc_pitch.cpp:
+20 -20
View File
@@ -21475,22 +21475,22 @@ setPause__23dSndDistantSoundActor_cFbi = .text:0x80394150; // type:function size
fn_803941C0 = .text:0x803941C0; // type:function size:0x10
fn_803941D0 = .text:0x803941D0; // type:function size:0x24
@84@__dt__23dSndDistantSoundActor_cFv = .text:0x80394200; // type:function size:0x8
fn_80394210 = .text:0x80394210; // type:function size:0xA8
fn_803942C0 = .text:0x803942C0; // type:function size:0x14
fn_803942E0 = .text:0x803942E0; // type:function size:0x40
fn_80394320 = .text:0x80394320; // type:function size:0x78
fn_803943A0 = .text:0x803943A0; // type:function size:0x80
fn_80394420 = .text:0x80394420; // type:function size:0x40
fn_80394460 = .text:0x80394460; // type:function size:0x9C
fn_80394500 = .text:0x80394500; // type:function size:0xA8
fn_803945B0 = .text:0x803945B0; // type:function size:0x78
fn_80394630 = .text:0x80394630; // type:function size:0x1C
fn_80394650 = .text:0x80394650; // type:function size:0x1C
fn_80394670 = .text:0x80394670; // type:function size:0x44
fn_803946C0 = .text:0x803946C0; // type:function size:0x4
fn_803946D0 = .text:0x803946D0; // type:function size:0x54
fn_80394730 = .text:0x80394730; // type:function size:0x3C
fn_80394770 = .text:0x80394770; // type:function size:0x3C
__ct__13dSndSeSound_cFv = .text:0x80394210; // type:function size:0xA8
__ct__16UnkSeSoundStructFv = .text:0x803942C0; // type:function size:0x14 scope:weak
__dt__16UnkSeSoundStructFv = .text:0x803942E0; // type:function size:0x40 scope:weak
__dt__13dSndSeSound_cFv = .text:0x80394320; // type:function size:0x78
setSource__13dSndSeSound_cFP14dSoundSource_cUl = .text:0x803943A0; // type:function size:0x80
clear__13dSndSeSound_cFv = .text:0x80394420; // type:function size:0x40
calc__13dSndSeSound_cFP14dSoundSource_c = .text:0x80394460; // type:function size:0x9C
shiftPair__13dSndSeSound_cFPC16UnkSeSoundStruct = .text:0x80394500; // type:function size:0xA8
shiftValue__13dSndSeSound_cFf = .text:0x803945B0; // type:function size:0x78
onStart__13dSndSeSound_cFP14dSoundSource_c = .text:0x80394630; // type:function size:0x1C
onCalc__13dSndSeSound_cFP14dSoundSource_c = .text:0x80394650; // type:function size:0x1C
__ct__14dSndSeSound1_cFv = .text:0x80394670; // type:function size:0x44
setSource__14dSndSeSound1_cFP14dSoundSource_cUl = .text:0x803946C0; // type:function size:0x4
__ct__14dSndSeSound2_cFv = .text:0x803946D0; // type:function size:0x54
setSource__14dSndSeSound2_cFP14dSoundSource_cUl = .text:0x80394730; // type:function size:0x3C
calcTimer__14dSndSeSound2_cFv = .text:0x80394770; // type:function size:0x3C
fn_803947B0 = .text:0x803947B0; // type:function size:0x78
fn_80394830 = .text:0x80394830; // type:function size:0x4C
fn_80394880 = .text:0x80394880; // type:function size:0x10
@@ -38094,9 +38094,9 @@ lbl_8054D3B0 = .data:0x8054D3B0; // type:object size:0xC
lbl_8054D3BC = .data:0x8054D3BC; // type:object size:0x44
__vt__45SndMgrDisposer<27dSndDistantSoundActorPool_c> = .data:0x8054D400; // type:object size:0x10
__vt__23dSndDistantSoundActor_c = .data:0x8054D410; // type:object size:0x60
lbl_8054D470 = .data:0x8054D470; // type:object size:0x18
lbl_8054D488 = .data:0x8054D488; // type:object size:0x18
lbl_8054D4A0 = .data:0x8054D4A0; // type:object size:0x18
__vt__13dSndSeSound_c = .data:0x8054D470; // type:object size:0x14
__vt__14dSndSeSound1_c = .data:0x8054D488; // type:object size:0x14
__vt__14dSndSeSound2_c = .data:0x8054D4A0; // type:object size:0x14
lbl_8054D4B8 = .data:0x8054D4B8; // type:object size:0x10
lbl_8054D4C8 = .data:0x8054D4C8; // type:object size:0x58
lbl_8054D520 = .data:0x8054D520; // type:object size:0x10 data:string
@@ -49438,7 +49438,7 @@ lbl_8057E3A0 = .sdata2:0x8057E3A0; // type:object size:0x4 align:4 data:float
lbl_8057E3A4 = .sdata2:0x8057E3A4; // type:object size:0x4 align:4 data:float
lbl_8057E3A8 = .sdata2:0x8057E3A8; // type:object size:0x4 align:4 data:float
lbl_8057E3AC = .sdata2:0x8057E3AC; // type:object size:0x4 align:4 data:float
lbl_8057E3B0 = .sdata2:0x8057E3B0; // type:object size:0x4 align:4 data:float
@3193 = .sdata2:0x8057E3B0; // type:object size:0x4 scope:local align:4 data:float
lbl_8057E3B8 = .sdata2:0x8057E3B8; // type:object size:0x4 align:4 data:float
lbl_8057E3BC = .sdata2:0x8057E3BC; // type:object size:0x4 align:4 data:float
lbl_8057E3C0 = .sdata2:0x8057E3C0; // type:object size:0x4 align:4 data:float
+11
View File
@@ -771,6 +771,17 @@ config.libs = [
Object(NonMatching, "d/snd/d_snd_mgr_unk_16.cpp"),
Object(NonMatching, "d/snd/d_snd_distant_sound_actor_pool.cpp"),
Object(NonMatching, "d/snd/d_snd_distant_sound_actor.cpp"),
Object(Matching, "d/snd/d_snd_se_sound.cpp"),
Object(Matching, "d/snd/d_snd_se_sound_1.cpp"),
Object(Matching, "d/snd/d_snd_se_sound_2.cpp"),
Object(NonMatching, "d/snd/d_snd_se_sound_pool.cpp"),
Object(NonMatching, "d/snd/d_snd_sound_link_body_callbacks.cpp"),
Object(NonMatching, "d/snd/d_snd_sound_enemy_callbacks.cpp"),
Object(NonMatching, "d/snd/d_snd_sound_object_callbacks.cpp"),
Object(NonMatching, "d/snd/d_snd_sound_equipment_callbacks.cpp"),
Object(NonMatching, "d/snd/d_snd_sound_npc_callbacks.cpp"),
Object(NonMatching, "d/snd/d_snd_sound_npc_2_callbacks.cpp"),
Object(NonMatching, "d/snd/d_snd_sound_tgsound_callbacks.cpp"),
Object(NonMatching, "d/snd/d_snd_mgr_unk_11.cpp"),
Object(NonMatching, "d/snd/d_snd_calc_pitch.cpp"),
],
+61
View File
@@ -0,0 +1,61 @@
#ifndef D_SND_SE_SOUND_H
#define D_SND_SE_SOUND_H
#include "common.h"
#include "d/snd/d_snd_sound.h"
#include "nw4r/snd/snd_SoundHandle.h"
#include "nw4r/ut/ut_list.h"
class dSoundSource_c;
struct UnkSeSoundStruct {
UnkSeSoundStruct() : field_0x00(0), field_0x04(0.0f) {}
~UnkSeSoundStruct() {}
/* 0x00 */ UNKWORD field_0x00;
/* 0x04 */ f32 field_0x04;
};
class dSndSeSound_c {
public:
dSndSeSound_c();
~dSndSeSound_c();
enum Type_e {
SE_HANDLE_TYPE_1 = 0,
SE_HANDLE_TYPE_2 = 1,
};
// vtable at 0x000
/* vt 0x08 */ virtual void setSource(dSoundSource_c *source, u32 soundId);
/* vt 0x0C */ virtual void onStart(dSoundSource_c *source);
/* vt 0x10 */ virtual void onCalc(dSoundSource_c *source);
void calc(dSoundSource_c *source);
// not sure what this does
void shiftPair(const UnkSeSoundStruct *p);
void shiftValue(f32 value);
typedef void Callback(dSndSeSound_c *sound, dSoundSource_c *source, nw4r::snd::SoundHandle &handle);
protected:
void clear();
/* 0x004 */ u8 _0x004[0x00C - 0x004];
/* 0x00C */ nw4r::ut::Node mPoolLink;
/* 0x014 */ UNKWORD field_0x014;
/* 0x018 */ dSndSound_c mSound;
/* 0x108 */ dSndSound_c *mpSoundHandle;
/* 0x10C */ Type_e mHandleType;
/* 0x110 */ u32 mSoundId;
/* 0x114 */ s32 field_0x114;
/* 0x118 */ UnkSeSoundStruct *mpUnk;
/* 0x11C */ u8 field_0x11C;
/* 0x11D */ u8 field_0x11D;
/* 0x11E */ u8 field_0x11E;
/* 0x120 */ Callback *mpStartCallback;
/* 0x124 */ Callback *mpCalcCallback;
};
#endif
+15
View File
@@ -0,0 +1,15 @@
#ifndef D_SND_SE_SOUND_1_H
#define D_SND_SE_SOUND_1_H
#include "common.h"
#include "d/snd/d_snd_se_sound.h"
class dSndSeSound1_c : public dSndSeSound_c {
public:
dSndSeSound1_c();
// vtable at 0x000
/* vt 0x08 */ virtual void setSource(dSoundSource_c *source, u32 soundId) override;
};
#endif
+22
View File
@@ -0,0 +1,22 @@
#ifndef D_SND_SE_SOUND_2_H
#define D_SND_SE_SOUND_2_H
#include "common.h"
#include "d/snd/d_snd_se_sound.h"
class dSndSeSound2_c : public dSndSeSound_c {
public:
dSndSeSound2_c();
// vtable at 0x000
/* vt 0x08 */ virtual void setSource(dSoundSource_c *source, u32 soundId) override;
bool calcTimer();
private:
/* 0x128 */ u32 field_0x128;
/* 0x12C */ u32 field_0x12C;
/* 0x130 */ u8 field_0x130;
};
#endif
+88
View File
@@ -0,0 +1,88 @@
#include "d/snd/d_snd_se_sound.h"
#include "common.h"
#include "d/snd/d_snd_source.h"
dSndSeSound_c::dSndSeSound_c()
: field_0x014(0),
mpSoundHandle(&mSound),
mHandleType(SE_HANDLE_TYPE_1),
mSoundId(-1),
field_0x114(-1),
field_0x11C(1),
field_0x11D(0),
field_0x11E(0),
mpStartCallback(nullptr),
mpCalcCallback(nullptr) {
mpUnk = new UnkSeSoundStruct[10];
}
dSndSeSound_c::~dSndSeSound_c() {
delete[] mpUnk;
}
void dSndSeSound_c::setSource(dSoundSource_c *source, u32 soundId) {
clear();
mSoundId = soundId;
field_0x114 = 0;
UnkSeSoundStruct* s = mpUnk;
while (s < &mpUnk[10]) {
s->field_0x00 = 0;
s->field_0x04 = 0.0f;
s++;
}
mpCalcCallback = nullptr;
mpStartCallback = nullptr;
field_0x11D = 0;
field_0x11E = 0;
}
void dSndSeSound_c::clear() {
field_0x114 = -1;
field_0x014 = 0;
mpCalcCallback = nullptr;
mpStartCallback = nullptr;
mpSoundHandle = &mSound;
field_0x11C = 1;
field_0x11D = 0;
mSound.cancel();
}
void dSndSeSound_c::calc(dSoundSource_c *source) {
onCalc(source);
if (mpSoundHandle->IsPause() && mpSoundHandle->GetRemainingFadeFrames() == 0) {
return;
}
field_0x114++;
}
void dSndSeSound_c::shiftPair(const UnkSeSoundStruct *pUnk) {
if (pUnk == nullptr) {
return;
}
for (int i = 9; i > 0; i--) {
mpUnk[i] = mpUnk[i - 1];
}
mpUnk[0] = *pUnk;
}
void dSndSeSound_c::shiftValue(f32 value) {
for (int i = 9; i > 0; i--) {
mpUnk[i].field_0x04 = mpUnk[i - 1].field_0x04;
}
mpUnk[0].field_0x04 = value;
}
void dSndSeSound_c::onStart(dSoundSource_c *source) {
if (mpStartCallback != nullptr) {
(mpStartCallback)(this, source, *mpSoundHandle);
}
}
void dSndSeSound_c::onCalc(dSoundSource_c *source) {
if (mpCalcCallback != nullptr) {
(mpCalcCallback)(this, source, *mpSoundHandle);
}
}
+12
View File
@@ -0,0 +1,12 @@
#include "d/snd/d_snd_se_sound_1.h"
#include "common.h"
#include "d/snd/d_snd_source.h"
dSndSeSound1_c::dSndSeSound1_c() {
mHandleType = SE_HANDLE_TYPE_1;
}
void dSndSeSound1_c::setSource(dSoundSource_c *source, u32 soundId) {
dSndSeSound_c::setSource(source, soundId);
}
+26
View File
@@ -0,0 +1,26 @@
#include "d/snd/d_snd_se_sound_2.h"
#include "common.h"
#include "d/snd/d_snd_source.h"
dSndSeSound2_c::dSndSeSound2_c() : field_0x128(0), field_0x12C(0), field_0x130(0) {
mHandleType = SE_HANDLE_TYPE_2;
}
void dSndSeSound2_c::setSource(dSoundSource_c *source, u32 soundId) {
dSndSeSound_c::setSource(source, soundId);
field_0x128 = 0;
field_0x12C = 0;
field_0x130 = 0;
}
bool dSndSeSound2_c::calcTimer() {
if (!field_0x130 && field_0x128 != 0) {
field_0x12C++;
if (field_0x12C <= field_0x128) {
return true;
}
}
return false;
}