From 6594cc78ea8cbe3635345ed2f455ad52ed6afd09 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 26 Oct 2023 07:20:14 -0400 Subject: [PATCH] Implement/match remaining MxSoundManager virtual functions (#250) --- LEGO1/mxsoundmanager.cpp | 39 +++++++++++++++++++++++++++++++++------ LEGO1/mxwavepresenter.cpp | 18 ++++++++++++++++++ LEGO1/mxwavepresenter.h | 5 +++++ 3 files changed, 56 insertions(+), 6 deletions(-) diff --git a/LEGO1/mxsoundmanager.cpp b/LEGO1/mxsoundmanager.cpp index 95463e87..937cad63 100644 --- a/LEGO1/mxsoundmanager.cpp +++ b/LEGO1/mxsoundmanager.cpp @@ -1,7 +1,10 @@ #include "mxsoundmanager.h" +#include "mxautolocker.h" #include "mxomni.h" +#include "mxpresenter.h" #include "mxticklemanager.h" +#include "mxwavepresenter.h" DECOMP_SIZE_ASSERT(MxSoundManager, 0x3c); @@ -124,16 +127,30 @@ MxResult MxSoundManager::Create(MxU32 p_frequencyMS, MxBool p_createThread) return status; } -// OFFSET: LEGO1 0x100aed10 STUB +// OFFSET: LEGO1 0x100aed10 void MxSoundManager::vtable0x34() { - // TODO + MxAutoLocker lock(&m_criticalSection); + + MxPresenter* presenter; + MxPresenterListCursor cursor(m_presenters); + + while (cursor.Next(presenter)) + if (presenter->IsA("MxWavePresenter")) + ((MxWavePresenter*) presenter)->VTable0x64(); } -// OFFSET: LEGO1 0x100aee10 STUB +// OFFSET: LEGO1 0x100aee10 void MxSoundManager::vtable0x38() { - // TODO + MxAutoLocker lock(&m_criticalSection); + + MxPresenter* presenter; + MxPresenterListCursor cursor(m_presenters); + + while (cursor.Next(presenter)) + if (presenter->IsA("MxWavePresenter")) + ((MxWavePresenter*) presenter)->VTable0x68(); } // OFFSET: LEGO1 0x100aeab0 @@ -142,8 +159,18 @@ void MxSoundManager::Destroy() Destroy(FALSE); } -// OFFSET: LEGO1 0x100aeac0 STUB +// OFFSET: LEGO1 0x100aeac0 void MxSoundManager::SetVolume(MxS32 p_volume) { - // TODO + MxAudioManager::SetVolume(p_volume); + + m_criticalSection.Enter(); + + MxPresenter* presenter; + MxPresenterListCursor cursor(m_presenters); + + while (cursor.Next(presenter)) + ((MxAudioPresenter*) presenter)->vtable60(((MxAudioPresenter*) presenter)->vtable5c()); + + m_criticalSection.Leave(); } diff --git a/LEGO1/mxwavepresenter.cpp b/LEGO1/mxwavepresenter.cpp index 957580b9..133d08eb 100644 --- a/LEGO1/mxwavepresenter.cpp +++ b/LEGO1/mxwavepresenter.cpp @@ -16,3 +16,21 @@ void MxWavePresenter::Init() m_unk66 = 0; m_unk68 = 0; } + +// OFFSET: LEGO1 0x100b2440 STUB +void MxWavePresenter::VTable0x64() +{ + // TODO +} + +// OFFSET: LEGO1 0x100b2470 STUB +void MxWavePresenter::VTable0x68() +{ + // TODO +} + +// OFFSET: LEGO1 0x1000d6b0 +undefined MxWavePresenter::VTable0x6c() +{ + return m_unk68; +} diff --git a/LEGO1/mxwavepresenter.h b/LEGO1/mxwavepresenter.h index f9c961a6..06300b7f 100644 --- a/LEGO1/mxwavepresenter.h +++ b/LEGO1/mxwavepresenter.h @@ -26,6 +26,11 @@ class MxWavePresenter : public MxSoundPresenter { return !strcmp(name, MxWavePresenter::ClassName()) || MxSoundPresenter::IsA(name); } + virtual void VTable0x64(); // vtable+0x64 + virtual void VTable0x68(); // vtable+0x68 + virtual undefined VTable0x6c(); // vtable+0x6c + +private: undefined4 m_unk54; undefined4 m_unk58; undefined4 m_unk5c;