MxEventPresenter: AddToManager and small destroy cleanup (#269)

* MxEventPresenter: AddToManager and small destroy cleanup

* Update mxeventpresenter.h

* Update mxeventpresenter.h

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Joshua Peisach 2023-11-05 17:45:48 -05:00 committed by GitHub
parent 33dcb139b7
commit ca359e9002
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 3 deletions

View file

@ -24,11 +24,22 @@ void MxEventPresenter::Init()
m_unk50 = NULL; m_unk50 = NULL;
} }
// OFFSET: LEGO1 0x100c2db0
MxResult MxEventPresenter::AddToManager()
{
MxResult ret = FAILURE;
if (EventManager()) {
ret = SUCCESS;
EventManager()->AddPresenter(*this);
}
return ret;
}
// OFFSET: LEGO1 0x100c2de0 // OFFSET: LEGO1 0x100c2de0
void MxEventPresenter::Destroy() void MxEventPresenter::Destroy()
{ {
MxEventManager* eventManager = EventManager(); if (EventManager())
if (eventManager)
EventManager()->RemovePresenter(*this); EventManager()->RemovePresenter(*this);
m_criticalSection.Enter(); m_criticalSection.Enter();

View file

@ -24,7 +24,8 @@ class MxEventPresenter : public MxMediaPresenter {
return !strcmp(name, MxEventPresenter::ClassName()) || MxMediaPresenter::IsA(name); return !strcmp(name, MxEventPresenter::ClassName()) || MxMediaPresenter::IsA(name);
} }
virtual void Destroy() override; // vtable+0x38 virtual MxResult AddToManager() override; // vtable+0x34
virtual void Destroy() override; // vtable+0x38
private: private:
void Init(); void Init();