Checkpoint for everything except MxNotificationManager::Register.

This commit is contained in:
Brendan Dougherty 2023-07-11 12:25:55 -05:00
parent 8aad19de35
commit 8827a6dab4
5 changed files with 39 additions and 14 deletions

View File

@ -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

5
LEGO1/mxlist.cpp Normal file
View File

@ -0,0 +1,5 @@
#include "mxlist.h"
#include "decomp.h"
DECOMP_SIZE_ASSERT(MxList<unsigned int>, 0xc);

20
LEGO1/mxlist.h Normal file
View File

@ -0,0 +1,20 @@
#ifndef MXLIST_H
#define MXLIST_H
#ifndef ISLE_COMPAT
#include <STL.H>
#define LIST_T List<T>
#else
#include <list>
#define LIST_T std::list<T>
#endif
template <class T>
class MxList : public LIST_T
{
public:
inline MxList() : LIST_T() {}
inline ~MxList() {}
};
#endif // MXLIST_H

View File

@ -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<MxNotification *>();
m_sendList = new MxList<MxNotification *>();
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<MxNotification *>();
m_queue = new MxList<MxNotification *>();
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<unsigned int>::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<unsigned int>::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<unsigned int>::iterator it = find(m_listenerIds.begin(), m_listenerIds.end(), listenerId);
MxList<unsigned int>::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<unsigned int>::iterator it = find(m_listenerIds.begin(), m_listenerIds.end(), p_listener->GetId());
MxList<unsigned int>::iterator it = find(m_listenerIds.begin(), m_listenerIds.end(), p_listener->GetId());
if (it == m_listenerIds.end()) {
return FAILURE;
}

View File

@ -1,10 +1,9 @@
#ifndef MXNOTIFICATIONMANAGER_H
#define MXNOTIFICATIONMANAGER_H
#include <STL.H>
#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<MxNotification *> *m_queue; // 0x8
List<MxNotification *> *m_sendList; // 0xc
MxList<MxNotification *> *m_queue; // 0x8
MxList<MxNotification *> *m_sendList; // 0xc
MxCriticalSection m_lock; // 0x10
int m_unk2c; // 0x2c
List<unsigned int> m_listenerIds; // 0x30
MxList<unsigned int> m_listenerIds; // 0x30
MxBool m_active; // 0x3c
public: