Implement AddPresenter, RemovePresenter, StopPresenters

This commit is contained in:
Christian Semmler 2023-09-13 08:51:02 -04:00
parent 1734ab5bc4
commit de8cb523fa
4 changed files with 60 additions and 19 deletions

View File

@ -67,7 +67,7 @@ class MxHashTable : protected HashTableParent<T>
virtual ~MxHashTable();
void Resize();
void MxHashTable::Add(T* );
void Add(T* );
virtual MxS8 Compare(T*, T*) = 0;

View File

@ -5,13 +5,14 @@
#include "mxcore.h"
template <class T>
// SIZE 0xc
class MxListEntry
{
public:
MxListEntry<T>() {}
MxListEntry<T>(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<T>
}
virtual ~MxList();
void Append(T*);
protected:
MxListEntry<T> *m_first; // +0x10
MxListEntry<T> *m_last; // +0x14
@ -80,4 +82,19 @@ MxList<T>::~MxList()
m_first = NULL;
}
template <class T>
inline void MxList<T>::Append(T *p_newobj)
{
MxListEntry<T> *currentLast = this->m_last;
MxListEntry<T> *newEntry = new MxListEntry<T>(p_newobj, currentLast);
if (currentLast)
currentLast->m_next = newEntry;
else
this->m_first = newEntry;
this->m_last = newEntry;
this->m_count++;
}
#endif // MXLIST_H

View File

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

View File

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