MxSoundManager: dtor, destroy, update types (#164)

* MxSoundManager: dtor, destroy, update types

Also make MxThread's destructor public

* Minor adjustments

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Joshua Peisach 2023-10-05 03:47:37 -04:00 committed by GitHub
parent 6916aa49e3
commit 2d45914ddf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 6 deletions

View file

@ -1,21 +1,49 @@
#include "mxsoundmanager.h"
#include "mxomni.h"
DECOMP_SIZE_ASSERT(MxSoundManager, 0x3c);
// OFFSET: LEGO1 0x100ae740
MxSoundManager::MxSoundManager()
{
Init();
}
// OFFSET: LEGO1 0x100ae7d0 STUB
// OFFSET: LEGO1 0x100ae7d0
MxSoundManager::~MxSoundManager()
{
// TODO
Destroy(TRUE);
}
// OFFSET: LEGO1 0x100ae830
void MxSoundManager::Init()
{
m_unk30 = 0;
m_unk34 = 0;
m_dsBuffer = NULL;
}
// OFFSET: LEGO1 0x100ae840
void MxSoundManager::Destroy(MxBool p_param)
{
if (this->m_thread) {
this->m_thread->Terminate();
delete this->m_thread;
}
else {
TickleManager()->UnregisterClient(this);
}
this->m_criticalSection.Enter();
if (this->m_dsBuffer) {
this->m_dsBuffer->Release();
}
Init();
this->m_criticalSection.Leave();
if (!p_param) {
MxAudioManager::Destroy();
}
}

View file

@ -1,11 +1,13 @@
#ifndef MXSOUNDMANAGER_H
#define MXSOUNDMANAGER_H
#include "decomp.h"
#include "mxaudiomanager.h"
#include <dsound.h>
// VTABLE 0x100dc128
// SIZE 0x3c
// Base vtables are: MxCore -> 0x100dc6b0 -> MxAudioManager -> MxSoundManager
class MxSoundManager : public MxAudioManager
{
public:
@ -14,8 +16,11 @@ public:
private:
void Init();
int m_unk30;
int m_unk34;
void Destroy(MxBool);
undefined4 m_unk30;
LPDIRECTSOUNDBUFFER m_dsBuffer; // 0x34
undefined m_unk35[4];
};
#endif // MXSOUNDMANAGER_H

View file

@ -24,6 +24,8 @@ public:
protected:
MxThread();
public:
virtual ~MxThread();
private: