mirror of
https://github.com/isledecomp/isle-portable.git
synced 2025-03-14 08:49:48 -04:00
Finish MxMediaManager and MxEventManager (#185)
* Finish MxMediaManager and MxEventManager * Update mxomni.cpp * fixes
This commit is contained in:
parent
472a82f220
commit
5f8bde9e48
5 changed files with 72 additions and 9 deletions
|
@ -1,4 +1,8 @@
|
|||
#include "mxeventmanager.h"
|
||||
#include "mxcriticalsection.h"
|
||||
#include "mxthread.h"
|
||||
#include "mxticklemanager.h"
|
||||
#include "mxomni.h"
|
||||
|
||||
// OFFSET: LEGO1 0x100c0360
|
||||
MxEventManager::MxEventManager()
|
||||
|
@ -9,17 +13,54 @@ MxEventManager::MxEventManager()
|
|||
// OFFSET: LEGO1 0x100c03f0
|
||||
MxEventManager::~MxEventManager()
|
||||
{
|
||||
// TODO: MxMediaManager::TerminateThread call
|
||||
TerminateThread(TRUE);
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c0450
|
||||
void MxEventManager::Init()
|
||||
{
|
||||
// This is intentionally left blank
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c04a0 STUB
|
||||
MxResult MxEventManager::vtable0x28(undefined4 p_unknown1, undefined p_unknown2)
|
||||
// OFFSET: LEGO1 0x100c04a0
|
||||
MxResult MxEventManager::CreateEventThread(MxU32 p_frequencyMS, MxBool p_noRegister)
|
||||
{
|
||||
//TODO
|
||||
return FAILURE;
|
||||
MxResult status = FAILURE;
|
||||
MxBool locked = FALSE;
|
||||
|
||||
MxResult result = MxMediaManager::InitPresenters();
|
||||
if (result == SUCCESS)
|
||||
{
|
||||
if (p_noRegister)
|
||||
{
|
||||
this->m_criticalSection.Enter();
|
||||
locked = TRUE;
|
||||
this->m_thread = new MxTickleThread(this, p_frequencyMS);
|
||||
|
||||
if (this->m_thread)
|
||||
{
|
||||
if (this->m_thread->Start(0, 0) == SUCCESS)
|
||||
{
|
||||
status = SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TickleManager()->RegisterClient(this, p_frequencyMS);
|
||||
status = SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
if (status != SUCCESS)
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
if (locked)
|
||||
{
|
||||
this->m_criticalSection.Leave();
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ class MxEventManager : public MxMediaManager
|
|||
public:
|
||||
MxEventManager();
|
||||
virtual ~MxEventManager() override;
|
||||
virtual MxResult vtable0x28(undefined4 p_unknown1, MxU8 p_unknown2); // vtable+28
|
||||
virtual MxResult CreateEventThread(MxU32 p_frequencyMS, MxBool p_noRegister); // vtable+28
|
||||
private:
|
||||
void Init();
|
||||
};
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#include "mxautolocker.h"
|
||||
#include "mxpresenter.h"
|
||||
#include "decomp.h"
|
||||
#include "mxticklemanager.h"
|
||||
#include "mxomni.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxMediaManager, 0x2c);
|
||||
|
||||
|
@ -65,7 +67,7 @@ void MxMediaManager::Destroy()
|
|||
|
||||
if (this->m_presenters)
|
||||
delete this->m_presenters;
|
||||
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
|
@ -97,3 +99,22 @@ void MxMediaManager::StopPresenters()
|
|||
while (cursor.Next(presenter))
|
||||
presenter->EndAction();
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c0460
|
||||
void MxMediaManager::TerminateThread(MxBool p_reinit)
|
||||
{
|
||||
if(m_thread != NULL)
|
||||
{
|
||||
m_thread->Terminate();
|
||||
delete m_thread;
|
||||
}
|
||||
else
|
||||
{
|
||||
TickleManager()->UnregisterClient(this);
|
||||
}
|
||||
|
||||
if(!p_reinit)
|
||||
{
|
||||
MxMediaManager::Destroy();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ public:
|
|||
virtual void StopPresenters(); // vtable+24
|
||||
|
||||
MxResult Init();
|
||||
void TerminateThread(MxBool p_reinit);
|
||||
|
||||
protected:
|
||||
MxPresenterList *m_presenters;
|
||||
|
|
|
@ -284,7 +284,7 @@ MxResult MxOmni::Create(MxOmniCreateParam &p)
|
|||
{
|
||||
MxEventManager *eventManager = new MxEventManager();
|
||||
this->m_eventManager = eventManager;
|
||||
if (m_eventManager != NULL && m_eventManager->vtable0x28(50, 0) != SUCCESS)
|
||||
if (m_eventManager != NULL && m_eventManager->CreateEventThread(50, 0) != SUCCESS)
|
||||
{
|
||||
delete m_eventManager;
|
||||
m_eventManager = NULL;
|
||||
|
@ -345,7 +345,7 @@ void MxOmni::Destroy()
|
|||
MxLong MxOmni::Notify(MxParam &p)
|
||||
{
|
||||
MxAutoLocker lock(&this->m_criticalsection);
|
||||
|
||||
|
||||
if (p.GetType() != MXSTREAMER_UNKNOWN)
|
||||
return 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue