Skip to content

Commit

Permalink
Rename InitPresenters to Create, remove this keyword (#1000) (isledec…
Browse files Browse the repository at this point in the history
  • Loading branch information
foxtacles authored and madebr committed Jun 25, 2024
1 parent eb0766d commit 354b7bf
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 29 deletions.
6 changes: 3 additions & 3 deletions LEGO1/omni/include/mxaudiomanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ class MxAudioManager : public MxMediaManager {
MxAudioManager();
~MxAudioManager() override;

MxResult InitPresenters() override; // vtable+14
void Destroy() override; // vtable+18
MxResult Create() override; // vtable+14
void Destroy() override; // vtable+18

// FUNCTION: LEGO1 0x10029910
virtual MxS32 GetVolume() { return this->m_volume; } // vtable+28
virtual MxS32 GetVolume() { return m_volume; } // vtable+28

virtual void SetVolume(MxS32 p_volume); // vtable+2c

Expand Down
2 changes: 1 addition & 1 deletion LEGO1/omni/include/mxmediamanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class MxMediaManager : public MxCore {
~MxMediaManager() override;

MxResult Tickle() override; // vtable+08
virtual MxResult InitPresenters(); // vtable+14
virtual MxResult Create(); // vtable+14
virtual void Destroy(); // vtable+18
virtual void RegisterPresenter(MxPresenter& p_presenter); // vtable+1c
virtual void UnregisterPresenter(MxPresenter& p_presenter); // vtable+20
Expand Down
20 changes: 10 additions & 10 deletions LEGO1/omni/src/audio/mxaudiomanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,30 @@ MxAudioManager::~MxAudioManager()
// FUNCTION: LEGO1 0x100b8df0
void MxAudioManager::Init()
{
this->m_volume = 100;
m_volume = 100;
}

// FUNCTION: LEGO1 0x100b8e00
void MxAudioManager::Destroy(MxBool p_fromDestructor)
{
this->m_criticalSection.Enter();
m_criticalSection.Enter();
g_count--;
Init();
this->m_criticalSection.Leave();
m_criticalSection.Leave();

if (!p_fromDestructor) {
MxMediaManager::Destroy();
}
}

// FUNCTION: LEGO1 0x100b8e40
MxResult MxAudioManager::InitPresenters()
MxResult MxAudioManager::Create()
{
MxResult result = FAILURE;
MxBool success = FALSE;

if (MxMediaManager::InitPresenters() == SUCCESS) {
this->m_criticalSection.Enter();
if (MxMediaManager::Create() == SUCCESS) {
m_criticalSection.Enter();
success = TRUE;
result = SUCCESS;
g_count++;
Expand All @@ -54,7 +54,7 @@ MxResult MxAudioManager::InitPresenters()
}

if (success) {
this->m_criticalSection.Leave();
m_criticalSection.Leave();
}

return result;
Expand All @@ -69,7 +69,7 @@ void MxAudioManager::Destroy()
// FUNCTION: LEGO1 0x100b8ea0
void MxAudioManager::SetVolume(MxS32 p_volume)
{
this->m_criticalSection.Enter();
this->m_volume = p_volume;
this->m_criticalSection.Leave();
m_criticalSection.Enter();
m_volume = p_volume;
m_criticalSection.Leave();
}
2 changes: 1 addition & 1 deletion LEGO1/omni/src/audio/mxmusicmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ MxResult MxMusicManager::Create(MxU32 p_frequencyMS, MxBool p_createThread)
MxResult status = FAILURE;
MxBool locked = FALSE;

if (MxAudioManager::InitPresenters() == SUCCESS) {
if (MxAudioManager::Create() == SUCCESS) {
if (p_createThread) {
m_criticalSection.Enter();
locked = TRUE;
Expand Down
16 changes: 8 additions & 8 deletions LEGO1/omni/src/audio/mxsoundmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,22 @@ void MxSoundManager::Init()
// FUNCTION: LEGO1 0x100ae840
void MxSoundManager::Destroy(MxBool p_fromDestructor)
{
if (this->m_thread) {
this->m_thread->Terminate();
delete this->m_thread;
if (m_thread) {
m_thread->Terminate();
delete m_thread;
}
else {
TickleManager()->UnregisterClient(this);
}

this->m_criticalSection.Enter();
m_criticalSection.Enter();

if (this->m_dsBuffer) {
this->m_dsBuffer->Release();
if (m_dsBuffer) {
m_dsBuffer->Release();
}

Init();
this->m_criticalSection.Leave();
m_criticalSection.Leave();

if (!p_fromDestructor) {
MxAudioManager::Destroy();
Expand All @@ -72,7 +72,7 @@ MxResult MxSoundManager::Create(MxU32 p_frequencyMS, MxBool p_createThread)
MxResult status = FAILURE;
MxBool locked = FALSE;

if (MxAudioManager::InitPresenters() != SUCCESS) {
if (MxAudioManager::Create() != SUCCESS) {
goto done;
}

Expand Down
4 changes: 2 additions & 2 deletions LEGO1/omni/src/audio/mxsoundpresenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ void MxSoundPresenter::Destroy(MxBool p_fromDestructor)
MSoundManager()->UnregisterPresenter(*this);
}

this->m_criticalSection.Enter();
m_criticalSection.Enter();
MxMediaPresenter::Init();
this->m_criticalSection.Leave();
m_criticalSection.Leave();

if (!p_fromDestructor) {
MxMediaPresenter::Destroy(FALSE);
Expand Down
2 changes: 1 addition & 1 deletion LEGO1/omni/src/common/mxmediamanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ MxResult MxMediaManager::Init()
}

// FUNCTION: LEGO1 0x100b85e0
MxResult MxMediaManager::InitPresenters()
MxResult MxMediaManager::Create()
{
AUTOLOCK(m_criticalSection);

Expand Down
2 changes: 1 addition & 1 deletion LEGO1/omni/src/event/mxeventmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ MxResult MxEventManager::Create(MxU32 p_frequencyMS, MxBool p_createThread)
MxResult status = FAILURE;
MxBool locked = FALSE;

MxResult result = MxMediaManager::InitPresenters();
MxResult result = MxMediaManager::Create();
if (result == SUCCESS) {
if (p_createThread) {
this->m_criticalSection.Enter();
Expand Down
4 changes: 2 additions & 2 deletions LEGO1/omni/src/video/mxvideomanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ MxResult MxVideoManager::VTable0x28(

m_unk0x60 = FALSE;

if (MxMediaManager::InitPresenters() != SUCCESS) {
if (MxMediaManager::Create() != SUCCESS) {
goto done;
}

Expand Down Expand Up @@ -219,7 +219,7 @@ MxResult MxVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyMS,

m_unk0x60 = TRUE;

if (MxMediaManager::InitPresenters() != SUCCESS) {
if (MxMediaManager::Create() != SUCCESS) {
goto done;
}

Expand Down

0 comments on commit 354b7bf

Please sign in to comment.