diff --git a/CMakeLists.txt b/CMakeLists.txt index b758b843..423601b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -120,6 +120,7 @@ add_library(lego1 SHARED LEGO1/mxeventpresenter.cpp LEGO1/mxflcpresenter.cpp LEGO1/mxioinfo.cpp + LEGO1/mxlist.cpp LEGO1/mxloopingflcpresenter.cpp LEGO1/mxloopingmidipresenter.cpp LEGO1/mxloopingsmkpresenter.cpp diff --git a/LEGO1/mxlist.cpp b/LEGO1/mxlist.cpp new file mode 100644 index 00000000..b9e67bc4 --- /dev/null +++ b/LEGO1/mxlist.cpp @@ -0,0 +1,5 @@ +#include "mxlist.h" + +#include "decomp.h" + +DECOMP_SIZE_ASSERT(MxList, 0xc); diff --git a/LEGO1/mxlist.h b/LEGO1/mxlist.h new file mode 100644 index 00000000..59516b2a --- /dev/null +++ b/LEGO1/mxlist.h @@ -0,0 +1,20 @@ +#ifndef MXLIST_H +#define MXLIST_H + +#ifndef ISLE_COMPAT +#include +#define LIST_T List +#else +#include +#define LIST_T std::list +#endif + +template +class MxList : public LIST_T +{ +public: + inline MxList() : LIST_T() {} + inline ~MxList() {} +}; + +#endif // MXLIST_H diff --git a/LEGO1/mxnotificationmanager.cpp b/LEGO1/mxnotificationmanager.cpp index d8c9a477..85f5aec6 100644 --- a/LEGO1/mxnotificationmanager.cpp +++ b/LEGO1/mxnotificationmanager.cpp @@ -1,10 +1,13 @@ #include "legoomni.h" #include "mxautolocker.h" #include "mxcore.h" +#include "mxlist.h" #include "mxnotificationmanager.h" #include "mxparam.h" #include "mxtypes.h" +#include "decomp.h" + DECOMP_SIZE_ASSERT(MxNotification, 0x8); DECOMP_SIZE_ASSERT(MxNotificationManager, 0x40); @@ -44,7 +47,7 @@ MxNotificationManager::~MxNotificationManager() // OFFSET: LEGO1 0x100ac800 long MxNotificationManager::Tickle() { - m_sendList = new List(); + m_sendList = new MxList(); if (m_sendList == NULL) { return FAILURE; } @@ -71,7 +74,7 @@ long MxNotificationManager::Tickle() MxResult MxNotificationManager::Create(int p_unk1, int p_unk2) { MxResult result = SUCCESS; - m_queue = new List(); + m_queue = new MxList(); if (m_queue == NULL) { result = FAILURE; @@ -86,12 +89,10 @@ MxResult MxNotificationManager::Create(int p_unk1, int p_unk2) // OFFSET: LEGO1 0x100acd20 void MxNotificationManager::Register(MxCore *p_listener) { - unsigned int listenerId; - List::iterator it; MxAutoLocker lock(&m_lock); - listenerId = p_listener->GetId(); - it = find(m_listenerIds.begin(), m_listenerIds.end(), listenerId); + unsigned int listenerId = p_listener->GetId(); + MxList::iterator it = find(m_listenerIds.begin(), m_listenerIds.end(), listenerId); if (it != m_listenerIds.end()) return; @@ -103,8 +104,7 @@ void MxNotificationManager::Unregister(MxCore *p_listener) { MxAutoLocker lock(&m_lock); - unsigned int listenerId = p_listener->GetId(); - List::iterator it = find(m_listenerIds.begin(), m_listenerIds.end(), listenerId); + MxList::iterator it = find(m_listenerIds.begin(), m_listenerIds.end(), p_listener->GetId()); if (it != m_listenerIds.end()) { m_listenerIds.erase(it); @@ -127,7 +127,7 @@ MxResult MxNotificationManager::Send(MxCore *p_listener, MxParam *p_param) return FAILURE; } else { - List::iterator it = find(m_listenerIds.begin(), m_listenerIds.end(), p_listener->GetId()); + MxList::iterator it = find(m_listenerIds.begin(), m_listenerIds.end(), p_listener->GetId()); if (it == m_listenerIds.end()) { return FAILURE; } diff --git a/LEGO1/mxnotificationmanager.h b/LEGO1/mxnotificationmanager.h index f9a2ef44..e63a17bb 100644 --- a/LEGO1/mxnotificationmanager.h +++ b/LEGO1/mxnotificationmanager.h @@ -1,10 +1,9 @@ #ifndef MXNOTIFICATIONMANAGER_H #define MXNOTIFICATIONMANAGER_H -#include - #include "mxcore.h" #include "mxcriticalsection.h" +#include "mxlist.h" #include "mxtypes.h" class MxNotification @@ -32,11 +31,11 @@ class MxNotification class MxNotificationManager : public MxCore { private: - List *m_queue; // 0x8 - List *m_sendList; // 0xc + MxList *m_queue; // 0x8 + MxList *m_sendList; // 0xc MxCriticalSection m_lock; // 0x10 int m_unk2c; // 0x2c - List m_listenerIds; // 0x30 + MxList m_listenerIds; // 0x30 MxBool m_active; // 0x3c public: