From 2a85444daa23b86e76611c0167d01db99803bf30 Mon Sep 17 00:00:00 2001 From: robojumper Date: Sat, 28 Jun 2025 15:24:05 +0200 Subject: [PATCH] d_snd_source_tg_sound OK --- config/SOUE01/symbols.txt | 20 +++++------ configure.py | 4 +-- include/d/snd/d_snd_source_tg_sound.h | 11 +++++- src/d/snd/d_snd_source_tg_sound.cpp | 49 +++++++++++++++++++++++++++ 4 files changed, 70 insertions(+), 14 deletions(-) create mode 100644 src/d/snd/d_snd_source_tg_sound.cpp diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 9b875ba9..c9534025 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -21427,13 +21427,13 @@ fn_80392E10 = .text:0x80392E10; // type:function size:0x8 fn_80392E20 = .text:0x80392E20; // type:function size:0x8 fn_80392E30 = .text:0x80392E30; // type:function size:0x8 __ct__19dSndSourceTgSound_cFlP9dAcBase_cPCcP17dSndSourceGroup_c = .text:0x80392E40; // type:function size:0x54 -fn_80392EA0 = .text:0x80392EA0; // type:function size:0x74 -fn_80392F20 = .text:0x80392F20; // type:function size:0x28 -fn_80392F50 = .text:0x80392F50; // type:function size:0x30 -fn_80392F80 = .text:0x80392F80; // type:function size:0x4 -fn_80392F90 = .text:0x80392F90; // type:function size:0x58 -fn_80392FF0 = .text:0x80392FF0; // type:function size:0x8 -fn_80393000 = .text:0x80393000; // type:function size:0x8 +postSetup__19dSndSourceTgSound_cFv = .text:0x80392EA0; // type:function size:0x74 +setTgActive__19dSndSourceTgSound_cFb = .text:0x80392F20; // type:function size:0x28 +postCalc__19dSndSourceTgSound_cFv = .text:0x80392F50; // type:function size:0x30 +preCalc__19dSndSourceTgSound_cFv = .text:0x80392F80; // type:function size:0x4 scope:weak +__dt__19dSndSourceTgSound_cFv = .text:0x80392F90; // type:function size:0x58 scope:weak +@88@__dt__19dSndSourceTgSound_cFv = .text:0x80392FF0; // type:function size:0x8 scope:weak +@4@__dt__19dSndSourceTgSound_cFv = .text:0x80393000; // type:function size:0x8 scope:weak fn_80393010 = .text:0x80393010; // type:function size:0x98 fn_803930B0 = .text:0x803930B0; // type:function size:0xD0 fn_80393180 = .text:0x80393180; // type:function size:0x64 @@ -21606,7 +21606,7 @@ fn_80399120 = .text:0x80399120; // type:function size:0x58 fn_80399180 = .text:0x80399180; // type:function size:0xB0 fn_80399230 = .text:0x80399230; // type:function size:0xA0 fn_803992D0 = .text:0x803992D0; // type:function size:0xA8 -fn_80399380 = .text:0x80399380; // type:function size:0xAC +postSetupSound__19dSndSourceTgSound_cFUlUlP13dSndSeSound_c = .text:0x80399380; // type:function size:0xAC fn_80399430 = .text:0x80399430; // type:function size:0x3C fn_80399470 = .text:0x80399470; // type:function size:0x6C fn_803994E0 = .text:0x803994E0; // type:function size:0x78 @@ -38092,7 +38092,7 @@ lbl_8054C9D0 = .data:0x8054C9D0; // type:object size:0x1FC __vt__22dSndSourceHarpSwHarp_c = .data:0x8054CBCC; // type:object size:0x1FC __vt__23dSndSourceHarpObjWarp_c = .data:0x8054CDC8; // type:object size:0x1FC __vt__23dSndSourceHarpRelated_c = .data:0x8054CFC4; // type:object size:0x1FC -lbl_8054D1C0 = .data:0x8054D1C0; // type:object size:0x1F0 +__vt__19dSndSourceTgSound_c = .data:0x8054D1C0; // type:object size:0x1EC 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:0xC scope:weak @@ -41254,7 +41254,7 @@ lbl_805747E4 = .sdata:0x805747E4; // type:object size:0x4 @6586 = .sdata:0x805747F8; // type:object size:0x6 scope:local data:string lbl_80574800 = .sdata:0x80574800; // type:object size:0x8 lbl_80574808 = .sdata:0x80574808; // type:object size:0x8 -lbl_80574810 = .sdata:0x80574810; // type:object size:0x8 +@7595 = .sdata:0x80574810; // type:object size:0x6 scope:local lbl_80574818 = .sdata:0x80574818; // type:object size:0x8 lbl_80574820 = .sdata:0x80574820; // type:object size:0x8 lbl_80574828 = .sdata:0x80574828; // type:object size:0x8 diff --git a/configure.py b/configure.py index 2e490ffa..1d7b39e4 100644 --- a/configure.py +++ b/configure.py @@ -765,7 +765,6 @@ config.libs = [ Object(NonMatching, "d/snd/d_snd_source_mgr.cpp"), Object(NonMatching, "d/snd/d_snd_source_group.cpp"), Object(Matching, "d/snd/d_snd_source.cpp"), - # sound source subclasses start Object(NonMatching, "d/snd/d_snd_source_link_body.cpp"), Object(NonMatching, "d/snd/d_snd_source_link_head.cpp"), Object(NonMatching, "d/snd/d_snd_source_enemy.cpp"), @@ -777,8 +776,7 @@ config.libs = [ Object(Matching, "d/snd/d_snd_source_py_bird.cpp"), Object(NonMatching, "d/snd/d_snd_source_demo.cpp"), Object(NonMatching, "d/snd/d_snd_source_harp_related.cpp"), - # sound source subclasses end - Object(NonMatching, "d/snd/d_snd_source_tg_sound.cpp"), + Object(Matching, "d/snd/d_snd_source_tg_sound.cpp"), Object(NonMatching, "d/snd/d_snd_id_mappers.cpp"), Object(Matching, "d/snd/d_snd_distant_sound_actor_pool.cpp"), Object(Matching, "d/snd/d_snd_distant_sound_actor.cpp"), diff --git a/include/d/snd/d_snd_source_tg_sound.h b/include/d/snd/d_snd_source_tg_sound.h index 90bc59e6..2544a7dd 100644 --- a/include/d/snd/d_snd_source_tg_sound.h +++ b/include/d/snd/d_snd_source_tg_sound.h @@ -7,8 +7,17 @@ class dSndSourceTgSound_c : public dSoundSource_c { public: dSndSourceTgSound_c(s32 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup); + /* 0x184 */ virtual void preCalc() override {} + /* 0x188 */ virtual void postSetup() override; + /* 0x18C */ virtual void postCalc() override; + + /* 0x1CC */ virtual void postSetupSound(u32 playingId, u32 requestedId, dSndSeSound_c *seSound) override; + + void setTgActive(bool active); + private: - /* 0x15C */ u8 _0x15C[0x164 - 0x15C]; + /* 0x15C */ u32 mTgSoundId; + /* 0x160 */ bool mTgActive; }; #endif diff --git a/src/d/snd/d_snd_source_tg_sound.cpp b/src/d/snd/d_snd_source_tg_sound.cpp new file mode 100644 index 00000000..c7506fc0 --- /dev/null +++ b/src/d/snd/d_snd_source_tg_sound.cpp @@ -0,0 +1,49 @@ +#include "d/snd/d_snd_source_tg_sound.h" + +#include "common.h" +#include "d/snd/d_snd_player_mgr.h" +#include "d/snd/d_snd_source.h" +#include "sized_string.h" + +dSndSourceTgSound_c::dSndSourceTgSound_c( + s32 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup +) + : dSoundSource_c(sourceType, ac, name, pOwnerGroup), mTgActive(true) {} + +void dSndSourceTgSound_c::postSetup() { + switch (mSubtype) { + // TODO subtypes + case 7: + mTgActive = false; + break; + default: + mTgActive = true; + break; + } + + SizedString<64> label; + label.sprintf("SE_%s", mpName); + mTgSoundId = dSndPlayerMgr_c::GetInstance()->convertLabelStringToSoundId(label); +} + +void dSndSourceTgSound_c::setTgActive(bool active) { + switch (mSubtype) { + case 34: + case 35: + mTgActive = !active; + break; + default: + mTgActive = active; + break; + } +} + +void dSndSourceTgSound_c::postCalc() { + if (mTgSoundId == -1) { + return; + } + if (!mTgActive) { + return; + } + holdSound(mTgSoundId); +}