From 8aad19de35bb89d2658530168622700225cc71dd Mon Sep 17 00:00:00 2001 From: Brendan Dougherty Date: Sun, 9 Jul 2023 13:23:14 -0500 Subject: [PATCH] Cleanup and add MxParam. --- CMakeLists.txt | 1 + LEGO1/mxnotificationmanager.cpp | 9 ++++++--- LEGO1/mxnotificationmanager.h | 21 ++++++++++++++++----- LEGO1/mxparam.cpp | 11 +++++++++++ LEGO1/mxparam.h | 32 ++++++++++++++++++++++++++++++++ 5 files changed, 66 insertions(+), 8 deletions(-) create mode 100644 LEGO1/mxparam.cpp create mode 100644 LEGO1/mxparam.h diff --git a/CMakeLists.txt b/CMakeLists.txt index cdfebd05..b758b843 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -133,6 +133,7 @@ add_library(lego1 SHARED LEGO1/mxomnicreateparam.cpp LEGO1/mxomnicreateparambase.cpp LEGO1/mxpalette.cpp + LEGO1/mxparam.cpp LEGO1/mxpresenter.cpp LEGO1/mxscheduler.cpp LEGO1/mxsmkpresenter.cpp diff --git a/LEGO1/mxnotificationmanager.cpp b/LEGO1/mxnotificationmanager.cpp index 4310cc02..d8c9a477 100644 --- a/LEGO1/mxnotificationmanager.cpp +++ b/LEGO1/mxnotificationmanager.cpp @@ -5,10 +5,13 @@ #include "mxparam.h" #include "mxtypes.h" +DECOMP_SIZE_ASSERT(MxNotification, 0x8); +DECOMP_SIZE_ASSERT(MxNotificationManager, 0x40); + // OFFSET: LEGO1 0x100ac220 -MxNotification::MxNotification(MxCore *p_destination, MxParam *p_param) +MxNotification::MxNotification(MxCore *p_target, MxParam *p_param) { - m_destination = p_destination; + m_target = p_target; m_param = p_param->Clone(); } @@ -54,7 +57,7 @@ long MxNotificationManager::Tickle() while (m_sendList->size() != 0) { MxNotification *notif = m_sendList->front(); m_sendList->pop_front(); - notif->m_destination->Notify(*notif->m_param); + notif->GetTarget()->Notify(*notif->GetParam()); delete notif; } diff --git a/LEGO1/mxnotificationmanager.h b/LEGO1/mxnotificationmanager.h index 373c2cb7..f9a2ef44 100644 --- a/LEGO1/mxnotificationmanager.h +++ b/LEGO1/mxnotificationmanager.h @@ -10,11 +10,22 @@ class MxNotification { public: - MxCore *m_destination; - MxParam *m_param; - - MxNotification(MxCore *p_destination, MxParam *p_param); + MxNotification(MxCore *p_target, MxParam *p_param); ~MxNotification(); + + inline MxCore *GetTarget() + { + return m_target; + } + + inline MxParam *GetParam() + { + return m_param; + } + +private: + MxCore *m_target; // 0x0 + MxParam *m_param; // 0x4 }; // VTABLE 0x100dc078 @@ -30,7 +41,7 @@ class MxNotificationManager : public MxCore public: MxNotificationManager(); - virtual ~MxNotificationManager(); // vtable+0x0 + virtual ~MxNotificationManager(); // vtable+0x0 (scalar deleting destructor) virtual long Tickle(); // vtable+0x8 // TODO: Where does this method come from? diff --git a/LEGO1/mxparam.cpp b/LEGO1/mxparam.cpp new file mode 100644 index 00000000..d7bb36b2 --- /dev/null +++ b/LEGO1/mxparam.cpp @@ -0,0 +1,11 @@ +#include "mxparam.h" + +#include "decomp.h" + +DECOMP_SIZE_ASSERT(MxParam, 0xc); + +// OFFSET: LEGO1 0x10010390 +MxParam* MxParam::Clone() +{ + return new MxParam(m_type, m_sender); +} diff --git a/LEGO1/mxparam.h b/LEGO1/mxparam.h new file mode 100644 index 00000000..c8948397 --- /dev/null +++ b/LEGO1/mxparam.h @@ -0,0 +1,32 @@ +#ifndef MXPARAM_H +#define MXPARAM_H + +#include "mxomnicreateparambase.h" + +class MxCore; + +// VTABLE 0x100d56e0 +class MxParam : public MxOmniCreateParamBase +{ +public: + inline MxParam(int p_type, MxCore *p_sender) : MxOmniCreateParamBase(), m_type(p_type), m_sender(p_sender){} + + virtual ~MxParam(){}; // vtable+0x0 (scalar deleting destructor) + virtual MxParam *Clone(); // vtable+0x4 + + inline int GetType() const + { + return m_type; + } + + inline MxCore *GetSender() const + { + return m_sender; + } + +private: + int m_type; // 0x4 + MxCore *m_sender; // 0x8 +}; + +#endif // MXPARAM_H