From 94c825bb0498da897c2d0dccf7ac6647ba11e367 Mon Sep 17 00:00:00 2001 From: fallenoak Date: Wed, 26 Nov 2025 19:28:14 -0600 Subject: [PATCH] feat(sound): add SESound::SetUserData --- src/sound/SESound.cpp | 8 ++++++++ src/sound/SESound.hpp | 4 +++- src/sound/SESoundInternal.hpp | 2 ++ src/sound/SI2.cpp | 13 ++++++++++++- 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/sound/SESound.cpp b/src/sound/SESound.cpp index cfe46e8..5d554e4 100644 --- a/src/sound/SESound.cpp +++ b/src/sound/SESound.cpp @@ -591,3 +591,11 @@ void SESound::Play() { this->m_internal->Play(); } } + +void SESound::SetUserData(SEUserData* userData) { + if (!this->m_internal) { + return; + } + + this->m_internal->m_userData = userData; +} diff --git a/src/sound/SESound.hpp b/src/sound/SESound.hpp index 47580f9..cfaf3fb 100644 --- a/src/sound/SESound.hpp +++ b/src/sound/SESound.hpp @@ -2,10 +2,11 @@ #define SOUND_SE_SOUND_HPP #include "sound/SESoundInternal.hpp" +#include "sound/SEUserData.hpp" +#include #include #include #include -#include struct SOUND_INTERNAL_LOOKUP : TSHashObject { SESoundInternal* m_internal; @@ -38,6 +39,7 @@ class SESound { bool IsPlaying(); int32_t Load(const char* filename, int32_t a3, FMOD::SoundGroup* soundGroup1, FMOD::SoundGroup* soundGroup2, bool a6, bool a7, uint32_t a8, int32_t a9, uint32_t a10); void Play(); + void SetUserData(SEUserData* userData); private: // Private static functions diff --git a/src/sound/SESoundInternal.hpp b/src/sound/SESoundInternal.hpp index 255aa5d..1a09948 100644 --- a/src/sound/SESoundInternal.hpp +++ b/src/sound/SESoundInternal.hpp @@ -6,6 +6,7 @@ #include class SESound; +class SEUserData; class SFile; class SoundCacheNode : public TSLinkedNode { @@ -29,6 +30,7 @@ class SESoundInternal : public TSLinkedNode { FMOD::System* m_fmodSystem; FMOD::Channel* m_fmodChannel = nullptr; SESound* m_sound = nullptr; + SEUserData* m_userData = nullptr; // TODO int32_t m_useCache = 0; int32_t m_type = 0; diff --git a/src/sound/SI2.cpp b/src/sound/SI2.cpp index e5a575a..e6df3a3 100644 --- a/src/sound/SI2.cpp +++ b/src/sound/SI2.cpp @@ -1,11 +1,12 @@ #include "sound/SI2.hpp" -#include "SoundKitProperties.hpp" #include "console/CVar.hpp" #include "sound/CVarHandlers.hpp" #include "sound/SESound.hpp" +#include "sound/SI2USERDATA.hpp" #include "sound/SOUNDKITDEF.hpp" #include "sound/SOUNDKITLOOKUP.hpp" #include "sound/SOUNDKITOBJECT.hpp" +#include "sound/SoundKitProperties.hpp" #include "ui/FrameScript.hpp" TSGrowableArray SI2::s_SoundKitDefs; @@ -383,6 +384,16 @@ int32_t SI2::PlaySoundKit(int32_t id, int32_t a2, SOUNDKITOBJECT* object, SoundK // TODO + auto userData = STORM_NEW(SI2USERDATA); + userData->m_name = soundKitDef->name ? soundKitDef->name : ""; + userData->m_ID = id; + userData->m_def = soundKitDef; + userData->m_type = properties->m_type; + // TODO + sound->SetUserData(userData); + + // TODO + sound->CompleteLoad(); // TODO