diff --git a/CMakeLists.txt b/CMakeLists.txt index 818d3773..0e2135c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -140,8 +140,8 @@ add_library(lego1 SHARED LEGO1/mxmatrix.cpp LEGO1/mxmediamanager.cpp LEGO1/mxmediapresenter.cpp - LEGO1/mxmidimanager.cpp LEGO1/mxmidipresenter.cpp + LEGO1/mxmusicmanager.cpp LEGO1/mxmusicpresenter.cpp LEGO1/mxnotificationmanager.cpp LEGO1/mxobjectfactory.cpp diff --git a/LEGO1/mxmidimanager.h b/LEGO1/mxmidimanager.h deleted file mode 100644 index dd362594..00000000 --- a/LEGO1/mxmidimanager.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef MXMIDIMANAGER_H -#define MXMIDIMANAGER_H - -#include "decomp.h" -#include "mxaudiomanager.h" - -// VTABLE 0x100dc930 -// SIZE 0x58 -class MxMIDIManager : public MxAudioManager -{ -public: - MxMIDIManager(); - virtual ~MxMIDIManager() override; - - virtual void Destroy() override; // vtable+18 - virtual void SetVolume(MxS32 p_volume) override; // vtable+2c - virtual MxResult StartMIDIThread(MxU32 p_frequencyMS, MxU8 p_noRegister); // vtable+30 - -private: - void LockedReinitialize(MxBool p_skipDestroy); - void DeinitializeMIDI(); - - MxS32 CalculateVolume(MxS32 p_volume); - void SetMIDIVolume(); - - HMIDISTRM m_MIDIStreamH; // 0x30 - MxBool m_MIDIInitialized; // 0x34 - undefined4 m_unk38; // 0x38 - undefined4 m_unk3c; // 0x3c - undefined4 m_unk40; // 0x40 - undefined4 m_unk44; // 0x44 - undefined4 m_unk48; // 0x48 - MIDIHDR *m_MIDIHdrP; // 0x4c - MxS32 m_multiplier; // 0x50 - DWORD m_MIDIVolume; // 0x54 - -protected: - void Init(); - void InitData(); -}; - -#endif // MXMIDIMANAGER_H \ No newline at end of file diff --git a/LEGO1/mxmidimanager.cpp b/LEGO1/mxmusicmanager.cpp similarity index 82% rename from LEGO1/mxmidimanager.cpp rename to LEGO1/mxmusicmanager.cpp index 26b977df..247b6596 100644 --- a/LEGO1/mxmidimanager.cpp +++ b/LEGO1/mxmusicmanager.cpp @@ -1,23 +1,23 @@ -#include "mxmidimanager.h" +#include "mxmusicmanager.h" #include "mxomni.h" #include -DECOMP_SIZE_ASSERT(MxMIDIManager, 0x58); +DECOMP_SIZE_ASSERT(MxMusicManager, 0x58); // OFFSET: LEGO1 0x100c05a0 -MxMIDIManager::MxMIDIManager() +MxMusicManager::MxMusicManager() { Init(); } // OFFSET: LEGO1 0x100c0630 -MxMIDIManager::~MxMIDIManager() +MxMusicManager::~MxMusicManager() { LockedReinitialize(TRUE); } // OFFSET: LEGO1 0x100c0b20 -void MxMIDIManager::DeinitializeMIDI() +void MxMusicManager::DeinitializeMIDI() { m_criticalSection.Enter(); @@ -36,14 +36,14 @@ void MxMIDIManager::DeinitializeMIDI() } // OFFSET: LEGO1 0x100c0690 -void MxMIDIManager::Init() +void MxMusicManager::Init() { this->m_multiplier = 100; InitData(); } // OFFSET: LEGO1 0x100c06a0 -void MxMIDIManager::InitData() +void MxMusicManager::InitData() { this->m_MIDIStreamH = 0; this->m_MIDIInitialized = FALSE; @@ -56,7 +56,7 @@ void MxMIDIManager::InitData() } // OFFSET: LEGO1 0x100c06c0 -void MxMIDIManager::LockedReinitialize(MxBool p_skipDestroy) +void MxMusicManager::LockedReinitialize(MxBool p_skipDestroy) { if (this->m_thread) { @@ -83,20 +83,20 @@ void MxMIDIManager::LockedReinitialize(MxBool p_skipDestroy) } // OFFSET: LEGO1 0x100c0930 -void MxMIDIManager::Destroy() +void MxMusicManager::Destroy() { LockedReinitialize(FALSE); } // OFFSET: LEGO1 0x100c09a0 -MxS32 MxMIDIManager::CalculateVolume(MxS32 p_volume) +MxS32 MxMusicManager::CalculateVolume(MxS32 p_volume) { MxS32 result = (p_volume * 0xffff) / 100; return (result << 0x10) | result; } // OFFSET: LEGO1 0x100c07f0 -void MxMIDIManager::SetMIDIVolume() +void MxMusicManager::SetMIDIVolume() { MxS32 result = (this->m_volume * this->m_multiplier) / 0x64; HMIDISTRM streamHandle = this->m_MIDIStreamH; @@ -109,7 +109,7 @@ void MxMIDIManager::SetMIDIVolume() } // OFFSET: LEGO1 0x100c0940 -void MxMIDIManager::SetVolume(MxS32 p_volume) +void MxMusicManager::SetVolume(MxS32 p_volume) { MxAudioManager::SetVolume(p_volume); this->m_criticalSection.Enter(); @@ -118,7 +118,7 @@ void MxMIDIManager::SetVolume(MxS32 p_volume) } // OFFSET: LEGO1 0x100c0840 -MxResult MxMIDIManager::StartMIDIThread(MxU32 p_frequencyMS, MxBool p_noRegister) +MxResult MxMusicManager::StartMIDIThread(MxU32 p_frequencyMS, MxBool p_noRegister) { MxResult status = FAILURE; MxBool locked = FALSE; diff --git a/LEGO1/mxmusicmanager.h b/LEGO1/mxmusicmanager.h index 4288ed1e..1a828c84 100644 --- a/LEGO1/mxmusicmanager.h +++ b/LEGO1/mxmusicmanager.h @@ -1,11 +1,42 @@ #ifndef MXMUSICMANAGER_H #define MXMUSICMANAGER_H -#include "mxcore.h" +#include "decomp.h" +#include "mxaudiomanager.h" // VTABLE 0x100dc930 -class MxMusicManager : public MxCore +// SIZE 0x58 +class MxMusicManager : public MxAudioManager { +public: + MxMusicManager(); + virtual ~MxMusicManager() override; + + virtual void Destroy() override; // vtable+18 + virtual void SetVolume(MxS32 p_volume) override; // vtable+2c + virtual MxResult StartMIDIThread(MxU32 p_frequencyMS, MxU8 p_noRegister); // vtable+30 + +private: + void LockedReinitialize(MxBool p_skipDestroy); + void DeinitializeMIDI(); + + MxS32 CalculateVolume(MxS32 p_volume); + void SetMIDIVolume(); + + HMIDISTRM m_MIDIStreamH; // 0x30 + MxBool m_MIDIInitialized; // 0x34 + undefined4 m_unk38; // 0x38 + undefined4 m_unk3c; // 0x3c + undefined4 m_unk40; // 0x40 + undefined4 m_unk44; // 0x44 + undefined4 m_unk48; // 0x48 + MIDIHDR *m_MIDIHdrP; // 0x4c + MxS32 m_multiplier; // 0x50 + DWORD m_MIDIVolume; // 0x54 + +protected: + void Init(); + void InitData(); }; -#endif // MXMUSICMANAGER_H +#endif // MXMUSICMANAGER_H \ No newline at end of file