added override + small changes

This commit is contained in:
vMidz 2023-10-05 22:57:53 +03:00 committed by GitHub
parent 2fbc98af48
commit d40b1ac676
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 23 deletions

View File

@ -11,13 +11,13 @@ class MxAudioManager : public MxMediaManager
MxAudioManager();
virtual ~MxAudioManager() override;
virtual MxResult InitPresenters(); // vtable+14
virtual void Destroy(); // vtable+18
virtual MxResult InitPresenters() override; // vtable+14
virtual void Destroy() override; // vtable+18
virtual MxS32 GetVolume(); // vtable+28
virtual void SetVolume(MxS32 p_volume); // vtable+2c
private:
void LockedReinitialize(MxBool);
void LockedReinitialize(MxBool p_skipDestroy);
static MxS32 g_unkCount;

View File

@ -1,6 +1,6 @@
#include "mxmidimanager.h"
#include "mxomni.h"
#include <Windows.h>
#include <windows.h>
DECOMP_SIZE_ASSERT(MxMIDIManager, 0x58);
@ -13,7 +13,7 @@ MxMIDIManager::MxMIDIManager()
// OFFSET: LEGO1 0x100c0630
MxMIDIManager::~MxMIDIManager()
{
LockedReinitialize(1);
LockedReinitialize(TRUE);
}
// OFFSET: LEGO1 0x100c0b20
@ -91,18 +91,19 @@ void MxMIDIManager::Destroy()
// OFFSET: LEGO1 0x100c09a0
MxS32 MxMIDIManager::CalculateVolume(MxS32 p_volume)
{
int result = (p_volume * 0xffff) / 100;
MxS32 result = (p_volume * 0xffff) / 100;
return (result << 0x10) | result;
}
// OFFSET: LEGO1 0x100c07f0
void MxMIDIManager::SetMIDIVolume()
{
int result = (this->m_volume * this->m_multiplier) / 0x64;
MxS32 result = (this->m_volume * this->m_multiplier) / 0x64;
HMIDISTRM streamHandle = this->m_MIDIStreamH;
if (streamHandle)
{
int volume = CalculateVolume(result);
MxS32 volume = CalculateVolume(result);
midiOutSetVolume(streamHandle, volume);
}
}
@ -133,20 +134,20 @@ MxResult MxMIDIManager::StartMIDIThread(MxU32 p_frequencyMS, MxBool p_noRegister
if (this->m_thread)
{
if (this->m_thread->Start(0, 0) == FALSE)
if (this->m_thread->Start(0, 0) == SUCCESS)
{
status = FALSE;
status = SUCCESS;
}
}
}
else
{
TickleManager()->RegisterClient(this, p_frequencyMS);
status = FALSE;
status = SUCCESS;
}
}
if (status != FALSE)
if (status != SUCCESS)
{
Destroy();
}
@ -155,5 +156,6 @@ MxResult MxMIDIManager::StartMIDIThread(MxU32 p_frequencyMS, MxBool p_noRegister
{
this->m_criticalSection.Leave();
}
return status;
}

View File

@ -12,24 +12,24 @@ class MxMIDIManager : public MxAudioManager
MxMIDIManager();
virtual ~MxMIDIManager() override;
void DeinitializeMIDI();
MxS32 CalculateVolume(MxS32 p_volume);
void SetMIDIVolume();
virtual void Destroy(); // vtable+18
virtual void SetVolume(MxS32 p_volume); // vtable+2c
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
MxU32 m_unk38; // 0x38
MxU32 m_unk3c; // 0x3c
MxU32 m_unk40; // 0x40
MxU32 m_unk44; // 0x44
MxU32 m_unk48; // 0x48
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