mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-21 07:11:16 +00:00
Merge branch 'master' into mxaudiomanager
This commit is contained in:
commit
009faf882f
@ -147,6 +147,7 @@ add_library(lego1 SHARED
|
|||||||
LEGO1/mxpalette.cpp
|
LEGO1/mxpalette.cpp
|
||||||
LEGO1/mxparam.cpp
|
LEGO1/mxparam.cpp
|
||||||
LEGO1/mxpresenter.cpp
|
LEGO1/mxpresenter.cpp
|
||||||
|
LEGO1/mxpresenterlist.cpp
|
||||||
LEGO1/mxscheduler.cpp
|
LEGO1/mxscheduler.cpp
|
||||||
LEGO1/mxsemaphore.cpp
|
LEGO1/mxsemaphore.cpp
|
||||||
LEGO1/mxsmkpresenter.cpp
|
LEGO1/mxsmkpresenter.cpp
|
||||||
|
|||||||
@ -67,7 +67,7 @@ class MxHashTable : protected HashTableParent<T>
|
|||||||
virtual ~MxHashTable();
|
virtual ~MxHashTable();
|
||||||
|
|
||||||
void Resize();
|
void Resize();
|
||||||
void MxHashTable::Add(T* );
|
void Add(T* );
|
||||||
|
|
||||||
virtual MxS8 Compare(T*, T*) = 0;
|
virtual MxS8 Compare(T*, T*) = 0;
|
||||||
|
|
||||||
|
|||||||
196
LEGO1/mxlist.h
Normal file
196
LEGO1/mxlist.h
Normal file
@ -0,0 +1,196 @@
|
|||||||
|
#ifndef MXLIST_H
|
||||||
|
#define MXLIST_H
|
||||||
|
|
||||||
|
#include "mxtypes.h"
|
||||||
|
#include "mxcore.h"
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
// SIZE 0xc
|
||||||
|
class MxListEntry
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MxListEntry() {}
|
||||||
|
MxListEntry(T *p_obj, MxListEntry *p_prev) {
|
||||||
|
m_obj = p_obj;
|
||||||
|
m_prev = p_prev;
|
||||||
|
m_next = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
T *m_obj;
|
||||||
|
MxListEntry *m_prev;
|
||||||
|
MxListEntry *m_next;
|
||||||
|
};
|
||||||
|
|
||||||
|
// VTABLE 0x100d6350
|
||||||
|
// SIZE 0x10
|
||||||
|
template <class T>
|
||||||
|
class MxListParent : public MxCore
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MxListParent() {
|
||||||
|
m_count = 0;
|
||||||
|
m_customDestructor = Destroy;
|
||||||
|
}
|
||||||
|
// OFFSET: LEGO1 0x1001cdd0
|
||||||
|
virtual ~MxListParent() {}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x1001cd30
|
||||||
|
static void Destroy(T *) {};
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x1001cd20
|
||||||
|
virtual MxS8 Compare(T *, T *) = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
MxU32 m_count; // +0x8
|
||||||
|
void (*m_customDestructor)(T *); // +0xc
|
||||||
|
};
|
||||||
|
|
||||||
|
// VTABLE 0x100d6368
|
||||||
|
// SIZE 0x18
|
||||||
|
template <class T>
|
||||||
|
class MxList : protected MxListParent<T>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MxList() {
|
||||||
|
m_last = NULL;
|
||||||
|
m_first = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual ~MxList();
|
||||||
|
|
||||||
|
void Append(T*);
|
||||||
|
|
||||||
|
friend class MxListCursor<T>;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
MxListEntry<T> *m_first; // +0x10
|
||||||
|
MxListEntry<T> *m_last; // +0x14
|
||||||
|
|
||||||
|
private:
|
||||||
|
void _DeleteEntry(MxListEntry<T> *match);
|
||||||
|
};
|
||||||
|
|
||||||
|
// VTABLE 0x100d6488
|
||||||
|
template <class T>
|
||||||
|
class MxListCursor : public MxCore
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MxListCursor(MxList<T> *p_list) {
|
||||||
|
m_list = p_list;
|
||||||
|
m_match = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
MxBool Find(T *p_obj);
|
||||||
|
void Detach();
|
||||||
|
MxBool Next(T*& p_obj);
|
||||||
|
void Reset() { m_match = NULL; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
MxList<T> *m_list;
|
||||||
|
MxListEntry<T> *m_match;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Unclear purpose
|
||||||
|
// VTABLE 0x100d6530
|
||||||
|
template <class T>
|
||||||
|
class MxListCursorChild : public MxListCursor<T>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MxListCursorChild(MxList<T> *p_list) : MxListCursor<T>(p_list) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Unclear purpose
|
||||||
|
// VTABLE 0x100d6470
|
||||||
|
template <class T>
|
||||||
|
class MxListCursorChildChild : public MxListCursorChild<T>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MxListCursorChildChild(MxList<T> *p_list) : MxListCursorChild<T>(p_list) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
// OFFSET: LEGO1 0x1001ce20
|
||||||
|
MxList<T>::~MxList()
|
||||||
|
{
|
||||||
|
for (MxListEntry<T> *t = m_first;;) {
|
||||||
|
if (!t)
|
||||||
|
break;
|
||||||
|
|
||||||
|
MxListEntry<T> *next = t->m_next;
|
||||||
|
m_customDestructor(t->m_obj);
|
||||||
|
delete t;
|
||||||
|
t = next;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_count = 0;
|
||||||
|
m_last = NULL;
|
||||||
|
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++;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
inline void MxList<T>::_DeleteEntry(MxListEntry<T> *match)
|
||||||
|
{
|
||||||
|
MxListEntry<T> **pPrev = &match->m_prev;
|
||||||
|
MxListEntry<T> **pNext = &match->m_next;
|
||||||
|
|
||||||
|
if (match->m_prev)
|
||||||
|
match->m_prev->m_next = *pNext;
|
||||||
|
else
|
||||||
|
m_first = *pNext;
|
||||||
|
|
||||||
|
if (*pNext)
|
||||||
|
(*pNext)->m_prev = *pPrev;
|
||||||
|
else
|
||||||
|
m_last = *pPrev;
|
||||||
|
|
||||||
|
delete match;
|
||||||
|
m_count--;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
inline MxBool MxListCursor<T>::Find(T *p_obj)
|
||||||
|
{
|
||||||
|
for (m_match = m_list->m_first;
|
||||||
|
m_match && m_list->Compare(m_match->m_obj, p_obj);
|
||||||
|
m_match = m_match->m_next);
|
||||||
|
|
||||||
|
return m_match != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
inline void MxListCursor<T>::Detach()
|
||||||
|
{
|
||||||
|
m_list->_DeleteEntry(m_match);
|
||||||
|
m_match = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
inline MxBool MxListCursor<T>::Next(T*& p_obj)
|
||||||
|
{
|
||||||
|
if (!m_match)
|
||||||
|
m_match = m_list->m_first;
|
||||||
|
else
|
||||||
|
m_match = m_match->m_next;
|
||||||
|
|
||||||
|
if (m_match)
|
||||||
|
p_obj = m_match->m_obj;
|
||||||
|
|
||||||
|
return m_match != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // MXLIST_H
|
||||||
@ -1,8 +1,12 @@
|
|||||||
#include "mxmediamanager.h"
|
#include "mxmediamanager.h"
|
||||||
|
#include "mxautolocker.h"
|
||||||
|
#include "mxpresenter.h"
|
||||||
#include "decomp.h"
|
#include "decomp.h"
|
||||||
|
|
||||||
DECOMP_SIZE_ASSERT(MxMediaManager, 0x2c);
|
DECOMP_SIZE_ASSERT(MxMediaManager, 0x2c);
|
||||||
|
|
||||||
|
typedef MxListCursorChildChild<MxPresenter> MxPresenterListCursor;
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x100b84c0
|
// OFFSET: LEGO1 0x100b84c0
|
||||||
MxMediaManager::MxMediaManager()
|
MxMediaManager::MxMediaManager()
|
||||||
{
|
{
|
||||||
@ -12,22 +16,86 @@ MxMediaManager::MxMediaManager()
|
|||||||
// OFFSET: LEGO1 0x100b8560
|
// OFFSET: LEGO1 0x100b8560
|
||||||
MxMediaManager::~MxMediaManager()
|
MxMediaManager::~MxMediaManager()
|
||||||
{
|
{
|
||||||
Teardown();
|
Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x100b85d0
|
// OFFSET: LEGO1 0x100b85d0
|
||||||
MxResult MxMediaManager::Init()
|
MxResult MxMediaManager::Init()
|
||||||
{
|
{
|
||||||
this->m_unk08 = NULL;
|
this->m_presenters = NULL;
|
||||||
this->m_thread = NULL;
|
this->m_thread = NULL;
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x100b8710
|
// OFFSET: LEGO1 0x100b8790
|
||||||
void MxMediaManager::Teardown()
|
MxResult MxMediaManager::Tickle()
|
||||||
{
|
{
|
||||||
if(this->m_unk08) {
|
MxAutoLocker lock(&this->m_criticalSection);
|
||||||
delete this->m_unk08;
|
MxPresenter *presenter;
|
||||||
|
MxPresenterListCursor cursor(this->m_presenters);
|
||||||
|
|
||||||
|
while (cursor.Next(presenter))
|
||||||
|
presenter->Tickle();
|
||||||
|
|
||||||
|
cursor.Reset();
|
||||||
|
|
||||||
|
while (cursor.Next(presenter))
|
||||||
|
presenter->VTable0x4c();
|
||||||
|
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100b85e0
|
||||||
|
MxResult MxMediaManager::InitPresenters()
|
||||||
|
{
|
||||||
|
MxAutoLocker lock(&this->m_criticalSection);
|
||||||
|
|
||||||
|
this->m_presenters = new MxPresenterList;
|
||||||
|
|
||||||
|
if (!this->m_presenters) {
|
||||||
|
this->Destroy();
|
||||||
|
return FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100b8710
|
||||||
|
void MxMediaManager::Destroy()
|
||||||
|
{
|
||||||
|
MxAutoLocker lock(&this->m_criticalSection);
|
||||||
|
|
||||||
|
if (this->m_presenters)
|
||||||
|
delete this->m_presenters;
|
||||||
|
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100b88c0
|
||||||
|
void MxMediaManager::AddPresenter(MxPresenter &p_presenter)
|
||||||
|
{
|
||||||
|
MxAutoLocker lock(&this->m_criticalSection);
|
||||||
|
|
||||||
|
this->m_presenters->Append(&p_presenter);
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100b8980
|
||||||
|
void MxMediaManager::RemovePresenter(MxPresenter &p_presenter)
|
||||||
|
{
|
||||||
|
MxAutoLocker lock(&this->m_criticalSection);
|
||||||
|
MxPresenterListCursor cursor(this->m_presenters);
|
||||||
|
|
||||||
|
if (cursor.Find(&p_presenter))
|
||||||
|
cursor.Detach();
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100b8ac0
|
||||||
|
void MxMediaManager::StopPresenters()
|
||||||
|
{
|
||||||
|
MxAutoLocker lock(&this->m_criticalSection);
|
||||||
|
MxPresenter *presenter;
|
||||||
|
MxPresenterListCursor cursor(this->m_presenters);
|
||||||
|
|
||||||
|
while (cursor.Next(presenter))
|
||||||
|
presenter->EndAction();
|
||||||
|
}
|
||||||
|
|||||||
@ -4,20 +4,29 @@
|
|||||||
#include "mxcore.h"
|
#include "mxcore.h"
|
||||||
#include "mxcriticalsection.h"
|
#include "mxcriticalsection.h"
|
||||||
#include "mxthread.h"
|
#include "mxthread.h"
|
||||||
|
#include "mxpresenterlist.h"
|
||||||
#include "mxtypes.h"
|
#include "mxtypes.h"
|
||||||
|
|
||||||
// VTABLE 0x100dc6b0
|
// VTABLE 0x100dc6b0
|
||||||
|
// SIZE 0x2c
|
||||||
class MxMediaManager : public MxCore
|
class MxMediaManager : public MxCore
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MxMediaManager();
|
MxMediaManager();
|
||||||
virtual ~MxMediaManager() override;
|
virtual ~MxMediaManager() override;
|
||||||
|
|
||||||
|
virtual MxResult Tickle(); // vtable+08
|
||||||
|
virtual MxResult InitPresenters(); // vtable+14
|
||||||
|
virtual void Destroy(); // vtable+18
|
||||||
|
virtual void AddPresenter(MxPresenter &p_presenter); // vtable+1c
|
||||||
|
virtual void RemovePresenter(MxPresenter &p_presenter); // vtable+20
|
||||||
|
virtual void StopPresenters(); // vtable+24
|
||||||
|
|
||||||
MxResult Init();
|
MxResult Init();
|
||||||
void Teardown();
|
|
||||||
private:
|
private:
|
||||||
void* m_unk08;
|
MxPresenterList *m_presenters;
|
||||||
MxThread* m_thread; // 0xc
|
MxThread *m_thread; // 0xc
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MxCriticalSection m_criticalSection; // 0x10
|
MxCriticalSection m_criticalSection; // 0x10
|
||||||
|
|||||||
@ -77,7 +77,7 @@ class MxPresenter : public MxCore
|
|||||||
undefined4 m_unk0x10;
|
undefined4 m_unk0x10;
|
||||||
undefined4 m_unk0x14;
|
undefined4 m_unk0x14;
|
||||||
undefined4 m_unk0x18;
|
undefined4 m_unk0x18;
|
||||||
MxDSAction* m_action; // 0
|
MxDSAction *m_action; // 0
|
||||||
MxCriticalSection m_criticalSection;
|
MxCriticalSection m_criticalSection;
|
||||||
MxPresenter *m_unkPresenter; // 0x3c
|
MxPresenter *m_unkPresenter; // 0x3c
|
||||||
};
|
};
|
||||||
|
|||||||
14
LEGO1/mxpresenterlist.cpp
Normal file
14
LEGO1/mxpresenterlist.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#include "mxpresenterlist.h"
|
||||||
|
#include "mxpresenter.h"
|
||||||
|
|
||||||
|
DECOMP_SIZE_ASSERT(MxPresenterList, 0x18);
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x1001cd00
|
||||||
|
MxS8 MxPresenterList::Compare(MxPresenter *p_var0, MxPresenter *p_var1)
|
||||||
|
{
|
||||||
|
if (p_var1 == p_var0)
|
||||||
|
return 0;
|
||||||
|
if (p_var1 <= p_var0)
|
||||||
|
return 1;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
27
LEGO1/mxpresenterlist.h
Normal file
27
LEGO1/mxpresenterlist.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#ifndef MXPRESENTERLIST_H
|
||||||
|
#define MXPRESENTERLIST_H
|
||||||
|
|
||||||
|
#include "mxlist.h"
|
||||||
|
|
||||||
|
class MxPresenter;
|
||||||
|
|
||||||
|
// Unclear what the purpose of this class is
|
||||||
|
// VTABLE 0x100d62f0
|
||||||
|
// SIZE 0x18
|
||||||
|
class MxPresenterListParent : public MxList<MxPresenter>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MxPresenterListParent() {
|
||||||
|
m_customDestructor = Destroy;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// VTABLE 0x100d6308
|
||||||
|
// SIZE 0x18
|
||||||
|
class MxPresenterList : public MxPresenterListParent
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual MxS8 Compare(MxPresenter *, MxPresenter *); // +0x14
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MXPRESENTERLIST_H
|
||||||
Loading…
Reference in New Issue
Block a user