Add missing MxSoundManager functions (#258)

This commit is contained in:
Christian Semmler 2023-10-31 10:22:01 -04:00 committed by GitHub
parent 1562fab522
commit cb286520e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 70 additions and 26 deletions

View file

@ -1,5 +1,15 @@
#include "define.h" #include "define.h"
// 0x1010141c
MxU32 g_mxcoreCount[101] = {0, -6643, -5643, -5058, -4643, -4321, -4058, -3836, -3643, -3473, -3321, -3184, -3058,
-2943, -2836, -2736, -2643, -2556, -2473, -2395, -2321, -2251, -2184, -2120, -2058, -2000,
-1943, -1888, -1836, -1785, -1736, -1689, -1643, -1599, -1556, -1514, -1473, -1434, -1395,
-1358, -1321, -1286, -1251, -1217, -1184, -1152, -1120, -1089, -1058, -1029, -1000, -971,
-943, -915, -888, -862, -836, -810, -785, -761, -736, -713, -689, -666, -643,
-621, -599, -577, -556, -535, -514, -494, -473, -454, -434, -415, -395, -377,
-358, -340, -321, -304, -286, -268, -251, -234, -217, -200, -184, -168, -152,
-136, -120, -104, -89, -74, -58, -43, -29, -14, 0};
// 0x10101eac // 0x10101eac
const char* g_parseExtraTokens = ":;"; const char* g_parseExtraTokens = ":;";

View file

@ -1,6 +1,9 @@
#ifndef DEFINE_H #ifndef DEFINE_H
#define DEFINE_H #define DEFINE_H
#include "mxtypes.h"
extern MxU32 g_mxcoreCount[101];
extern const char* g_parseExtraTokens; extern const char* g_parseExtraTokens;
extern const char* g_strWORLD; extern const char* g_strWORLD;
extern const char* g_strACTION; extern const char* g_strACTION;

View file

@ -1,13 +1,12 @@
#include "mxcore.h" #include "mxcore.h"
// 0x1010141c #include "define.h"
unsigned int g_mxcoreCount = 0;
// OFFSET: LEGO1 0x100ae1a0 // OFFSET: LEGO1 0x100ae1a0
MxCore::MxCore() MxCore::MxCore()
{ {
m_id = g_mxcoreCount; m_id = g_mxcoreCount[0];
g_mxcoreCount++; g_mxcoreCount[0]++;
} }
// OFFSET: LEGO1 0x100ae1e0 // OFFSET: LEGO1 0x100ae1e0

View file

@ -1,5 +1,6 @@
#include "mxsoundmanager.h" #include "mxsoundmanager.h"
#include "define.h"
#include "mxautolocker.h" #include "mxautolocker.h"
#include "mxomni.h" #include "mxomni.h"
#include "mxpresenter.h" #include "mxpresenter.h"
@ -127,6 +128,53 @@ MxResult MxSoundManager::Create(MxU32 p_frequencyMS, MxBool p_createThread)
return status; return status;
} }
// OFFSET: LEGO1 0x100aeab0
void MxSoundManager::Destroy()
{
Destroy(FALSE);
}
// OFFSET: LEGO1 0x100aeac0
void MxSoundManager::SetVolume(MxS32 p_volume)
{
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();
}
// OFFSET: LEGO1 0x100aebd0
MxPresenter* MxSoundManager::FUN_100aebd0(const MxAtomId& p_atomId, MxU32 p_objectId)
{
MxAutoLocker lock(&m_criticalSection);
MxPresenter* presenter;
MxPresenterListCursor cursor(m_presenters);
while (cursor.Next(presenter)) {
if (presenter->GetAction()->GetAtomId().GetInternal() == p_atomId.GetInternal() &&
presenter->GetAction()->GetObjectId() == p_objectId)
return presenter;
}
return NULL;
}
// OFFSET: LEGO1 0x100aecf0
MxS32 MxSoundManager::FUN_100aecf0(MxU32 p_unk)
{
if (!p_unk)
return -10000;
return g_mxcoreCount[p_unk];
}
// OFFSET: LEGO1 0x100aed10 // OFFSET: LEGO1 0x100aed10
void MxSoundManager::vtable0x34() void MxSoundManager::vtable0x34()
{ {
@ -152,25 +200,3 @@ void MxSoundManager::vtable0x38()
if (presenter->IsA("MxWavePresenter")) if (presenter->IsA("MxWavePresenter"))
((MxWavePresenter*) presenter)->VTable0x68(); ((MxWavePresenter*) presenter)->VTable0x68();
} }
// OFFSET: LEGO1 0x100aeab0
void MxSoundManager::Destroy()
{
Destroy(FALSE);
}
// OFFSET: LEGO1 0x100aeac0
void MxSoundManager::SetVolume(MxS32 p_volume)
{
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();
}

View file

@ -2,6 +2,7 @@
#define MXSOUNDMANAGER_H #define MXSOUNDMANAGER_H
#include "decomp.h" #include "decomp.h"
#include "mxatomid.h"
#include "mxaudiomanager.h" #include "mxaudiomanager.h"
#include <dsound.h> #include <dsound.h>
@ -11,6 +12,9 @@
class MxSoundManager : public MxAudioManager { class MxSoundManager : public MxAudioManager {
public: public:
MxSoundManager(); MxSoundManager();
// OFFSET: LEGO1 0x100ae7b0 TEMPLATE
// MxSoundManager::`scalar deleting destructor'
virtual ~MxSoundManager() override; // vtable+0x0 virtual ~MxSoundManager() override; // vtable+0x0
virtual void Destroy() override; // vtable+18 virtual void Destroy() override; // vtable+18
@ -22,6 +26,8 @@ class MxSoundManager : public MxAudioManager {
private: private:
void Init(); void Init();
void Destroy(MxBool p_fromDestructor); void Destroy(MxBool p_fromDestructor);
MxPresenter* FUN_100aebd0(const MxAtomId& p_atomId, MxU32 p_objectId);
MxS32 FUN_100aecf0(MxU32 p_unk);
LPDIRECTSOUND m_directSound; // 0x30 LPDIRECTSOUND m_directSound; // 0x30
LPDIRECTSOUNDBUFFER m_dsBuffer; // 0x34 LPDIRECTSOUNDBUFFER m_dsBuffer; // 0x34