diff --git a/LEGO1/mxhashtable.h b/LEGO1/mxhashtable.h index f9505bb5..3d91717b 100644 --- a/LEGO1/mxhashtable.h +++ b/LEGO1/mxhashtable.h @@ -67,7 +67,7 @@ class MxHashTable : protected HashTableParent virtual ~MxHashTable(); void Resize(); - void MxHashTable::Add(T* ); + void Add(T* ); virtual MxS8 Compare(T*, T*) = 0; diff --git a/LEGO1/mxlist.h b/LEGO1/mxlist.h index 9ace7bf7..d8e2155d 100644 --- a/LEGO1/mxlist.h +++ b/LEGO1/mxlist.h @@ -5,13 +5,14 @@ #include "mxcore.h" template +// SIZE 0xc class MxListEntry { public: - MxListEntry() {} - MxListEntry(T *p_obj) { + MxListEntry() {} + MxListEntry(T *p_obj, MxListEntry *p_prev) { m_obj = p_obj; - m_prev = NULL; + m_prev = p_prev; m_next = NULL; } @@ -38,7 +39,6 @@ class MxListParent : public MxCore // OFFSET: LEGO1 0x1001cd20 virtual MxS8 Compare(T *, T *) = 0; - protected: MxU32 m_count; // +0x8 void (*m_customDestructor)(T *); // +0xc @@ -56,6 +56,8 @@ class MxList : protected MxListParent } virtual ~MxList(); + + void Append(T*); protected: MxListEntry *m_first; // +0x10 MxListEntry *m_last; // +0x14 @@ -80,4 +82,19 @@ MxList::~MxList() m_first = NULL; } +template +inline void MxList::Append(T *p_newobj) +{ + MxListEntry *currentLast = this->m_last; + MxListEntry *newEntry = new MxListEntry(p_newobj, currentLast); + + if (currentLast) + currentLast->m_next = newEntry; + else + this->m_first = newEntry; + + this->m_last = newEntry; + this->m_count++; +} + #endif // MXLIST_H \ No newline at end of file diff --git a/LEGO1/mxmediamanager.cpp b/LEGO1/mxmediamanager.cpp index 95012e19..2be3531f 100644 --- a/LEGO1/mxmediamanager.cpp +++ b/LEGO1/mxmediamanager.cpp @@ -24,17 +24,6 @@ MxResult MxMediaManager::Init() return SUCCESS; } -// OFFSET: LEGO1 0x100b8710 -void MxMediaManager::Destroy() -{ - MxAutoLocker lock(&this->m_criticalSection); - - if (this->m_presenters) - delete this->m_presenters; - - Init(); -} - // OFFSET: LEGO1 0x100b8790 STUB MxResult MxMediaManager::Tickle() { @@ -55,3 +44,38 @@ MxResult MxMediaManager::InitPresenters() return SUCCESS; } + +// OFFSET: LEGO1 0x100b8710 +void MxMediaManager::Destroy() +{ + MxAutoLocker lock(&this->m_criticalSection); + + if (this->m_presenters) + delete this->m_presenters; + + Init(); +} + +// OFFSET: LEGO1 0x100b88c0 +void MxMediaManager::AddPresenter(MxPresenter &p_presenter) +{ + MxAutoLocker lock(&this->m_criticalSection); + + this->m_presenters->Append(&p_presenter); +} + +// OFFSET: LEGO1 0x100b8980 STUB +void MxMediaManager::RemovePresenter(MxPresenter &p_presenter) +{ + MxAutoLocker lock(&this->m_criticalSection); + + // Remove element from m_presenters +} + +// OFFSET: LEGO1 0x100b8ac0 STUB +void MxMediaManager::StopPresenters() +{ + MxAutoLocker lock(&this->m_criticalSection); + + // Call EndAction on all presenters in list +} diff --git a/LEGO1/mxmediamanager.h b/LEGO1/mxmediamanager.h index b5435957..45fdf639 100644 --- a/LEGO1/mxmediamanager.h +++ b/LEGO1/mxmediamanager.h @@ -18,9 +18,9 @@ class MxMediaManager : public MxCore virtual MxResult Tickle(); // vtable+08 virtual MxResult InitPresenters(); // vtable+14 virtual void Destroy(); // vtable+18 - // vtable+1c - // vtable+20 - // vtable+24 + virtual void AddPresenter(MxPresenter &p_presenter); // vtable+1c + virtual void RemovePresenter(MxPresenter &p_presenter); // vtable+20 + virtual void StopPresenters(); // vtable+24 MxResult Init(); private: