From 02d003673dce7e0b7f438ae8090967f91289a4a5 Mon Sep 17 00:00:00 2001 From: DmitriLeon2000 Date: Wed, 11 Oct 2023 19:18:26 +0900 Subject: [PATCH] Implement MxMusicPresenter's Destroy method and move MxMediaPresenter's Destroy method to "protected" (#199) * MxMusicPresenter destroy * Implement MxMusicPresenter's Destroy method and move MxMediaPresenter's Destroy method to "protected" * MxMediaPresenter Destroy to "protected", for real * MxMusicPresenter Destroy --- LEGO1/mxmediapresenter.h | 3 ++- LEGO1/mxmusicpresenter.cpp | 14 +++++++++++--- LEGO1/mxmusicpresenter.h | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/LEGO1/mxmediapresenter.h b/LEGO1/mxmediapresenter.h index 167b10c1..6b8fd552 100644 --- a/LEGO1/mxmediapresenter.h +++ b/LEGO1/mxmediapresenter.h @@ -43,9 +43,10 @@ class MxMediaPresenter : public MxPresenter undefined4 m_unk44; undefined4 m_unk48; undefined4 m_unk4c; +protected: + void Destroy(MxBool); private: void Init(); - void Destroy(MxBool); }; diff --git a/LEGO1/mxmusicpresenter.cpp b/LEGO1/mxmusicpresenter.cpp index 45a56679..f376c64f 100644 --- a/LEGO1/mxmusicpresenter.cpp +++ b/LEGO1/mxmusicpresenter.cpp @@ -23,10 +23,18 @@ void MxMusicPresenter::Init() { } -// OFFSET: LEGO1 0x100c2550 STUB -void MxMusicPresenter::Destroy(MxBool) +// OFFSET: LEGO1 0x100c2550 +void MxMusicPresenter::Destroy(MxBool p_reinit) { - // TODO + if (MusicManager()) { + MusicManager()->RemovePresenter(*this); + } + m_criticalSection.Enter(); + Init(); + m_criticalSection.Leave(); + if (!p_reinit) { + MxMediaPresenter::Destroy(FALSE); + } } // OFFSET: LEGO1 0x100c25a0 diff --git a/LEGO1/mxmusicpresenter.h b/LEGO1/mxmusicpresenter.h index 2e55aa6c..ff765786 100644 --- a/LEGO1/mxmusicpresenter.h +++ b/LEGO1/mxmusicpresenter.h @@ -29,7 +29,7 @@ class MxMusicPresenter : public MxAudioPresenter private: void Init(); - void Destroy(MxBool); + void Destroy(MxBool p_reinit); }; #endif // MXMUSICPRESENTER_H