mirror of
https://github.com/isledecomp/isle-portable.git
synced 2024-11-22 15:37:55 -05:00
Bootstrap MxDSSelectAction, generalize MxList (#142)
* reccmp: Add ability to compare template instantiations * Add example of template instantiation comparison. * merge * Add template compare annotations for MxList instances * Bootstrap MxDSSelectAction, generalize MxList * Fix template annotations * Fix merge error * Fix merge error --------- Co-authored-by: Brendan Dougherty <brandougherty1@gmail.com>
This commit is contained in:
parent
56f3d12096
commit
b7efd64ac1
6 changed files with 66 additions and 40 deletions
|
@ -8,7 +8,7 @@ class MxDSAction;
|
|||
|
||||
// VTABLE 0x100dced8
|
||||
// SIZE 0x1c
|
||||
class MxDSActionList : public MxList<MxDSAction>
|
||||
class MxDSActionList : public MxList<MxDSAction*>
|
||||
{
|
||||
public:
|
||||
MxDSActionList() {
|
||||
|
@ -23,15 +23,15 @@ class MxDSActionList : public MxList<MxDSAction>
|
|||
undefined m_unk18;
|
||||
};
|
||||
|
||||
typedef MxListCursorChild<MxDSAction> MxDSActionListCursor;
|
||||
typedef MxListCursorChild<MxDSAction*> MxDSActionListCursor;
|
||||
|
||||
// OFFSET: LEGO1 0x100c9cc0 TEMPLATE
|
||||
// MxListParent<MxDSAction *>::Compare
|
||||
|
||||
// OFFSET: LEGO1 0x100c9d20 TEMPLATE
|
||||
// MxListParent<MxDSAction>::Destroy
|
||||
|
||||
// OFFSET: LEGO1 0x100c9cd0 TEMPLATE
|
||||
// MxListParent<MxDSAction>::~MxListParent<MxDSAction>
|
||||
// MxListParent<MxDSAction *>::Destroy
|
||||
|
||||
// OFFSET: LEGO1 0x100c9d30 TEMPLATE
|
||||
// MxList<MxDSAction>::~MxList<MxDSAction>
|
||||
// MxList<MxDSAction *>::~MxList<MxDSAction *>
|
||||
|
||||
#endif // MXDSACTIONLIST_H
|
||||
|
|
|
@ -5,12 +5,13 @@ DECOMP_SIZE_ASSERT(MxDSSelectAction, 0xb0)
|
|||
// OFFSET: LEGO1 0x100cb2b0
|
||||
MxDSSelectAction::MxDSSelectAction()
|
||||
{
|
||||
// TODO
|
||||
this->SetType(MxDSType_SelectAction);
|
||||
this->m_unk0xac = new MxStringList;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100cb8d0 STUB
|
||||
// OFFSET: LEGO1 0x100cb8d0
|
||||
MxDSSelectAction::~MxDSSelectAction()
|
||||
{
|
||||
// TODO
|
||||
if (this->m_unk0xac)
|
||||
delete this->m_unk0xac;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define MXDSSELECTACTION_H
|
||||
|
||||
#include "mxdsparallelaction.h"
|
||||
#include "mxstringlist.h"
|
||||
#include "decomp.h"
|
||||
|
||||
// VTABLE 0x100dcfc8
|
||||
|
@ -25,12 +26,9 @@ class MxDSSelectAction : public MxDSParallelAction
|
|||
return !strcmp(name, MxDSSelectAction::ClassName()) || MxDSParallelAction::IsA(name);
|
||||
}
|
||||
|
||||
undefined4 m_unk0x9c;
|
||||
undefined4 m_unk0xa0;
|
||||
undefined4 m_unk0xa4;
|
||||
undefined4 m_unk0xa8;
|
||||
undefined4 m_unk0xac;
|
||||
|
||||
private:
|
||||
MxString m_unk0x9c;
|
||||
MxStringList *m_unk0xac;
|
||||
};
|
||||
|
||||
#endif // MXDSSELECTACTION_H
|
||||
|
|
|
@ -4,19 +4,24 @@
|
|||
#include "mxtypes.h"
|
||||
#include "mxcore.h"
|
||||
|
||||
template <class T>
|
||||
// SIZE 0xc
|
||||
template <class T>
|
||||
class MxListEntry
|
||||
{
|
||||
public:
|
||||
MxListEntry() {}
|
||||
MxListEntry(T *p_obj, MxListEntry *p_prev) {
|
||||
MxListEntry(T p_obj, MxListEntry *p_prev) {
|
||||
m_obj = p_obj;
|
||||
m_prev = p_prev;
|
||||
m_next = NULL;
|
||||
}
|
||||
|
||||
T *m_obj;
|
||||
T GetValue() { return this->m_obj; }
|
||||
|
||||
friend class MxList<T>;
|
||||
friend class MxListCursor<T>;
|
||||
private:
|
||||
T m_obj;
|
||||
MxListEntry *m_prev;
|
||||
MxListEntry *m_next;
|
||||
};
|
||||
|
@ -33,12 +38,12 @@ class MxListParent : public MxCore
|
|||
}
|
||||
|
||||
virtual ~MxListParent() {}
|
||||
virtual MxS8 Compare(T *, T *) = 0;
|
||||
virtual MxS8 Compare(T, T) { return 0; };
|
||||
|
||||
static void Destroy(T *) {};
|
||||
static void Destroy(T) {};
|
||||
protected:
|
||||
MxU32 m_count; // +0x8
|
||||
void (*m_customDestructor)(T *); // +0xc
|
||||
void (*m_customDestructor)(T); // +0xc
|
||||
};
|
||||
|
||||
// VTABLE 0x100d6368
|
||||
|
@ -54,13 +59,12 @@ class MxList : protected MxListParent<T>
|
|||
|
||||
virtual ~MxList();
|
||||
|
||||
void Append(T*);
|
||||
void Append(T);
|
||||
void DeleteAll();
|
||||
MxU32 GetCount() { return m_count; }
|
||||
void SetDestroy(void (*p_customDestructor)(T *)) { this->m_customDestructor = p_customDestructor; }
|
||||
void SetDestroy(void (*p_customDestructor)(T)) { this->m_customDestructor = p_customDestructor; }
|
||||
|
||||
friend class MxListCursor<T>;
|
||||
|
||||
protected:
|
||||
MxListEntry<T> *m_first; // +0x10
|
||||
MxListEntry<T> *m_last; // +0x14
|
||||
|
@ -79,10 +83,10 @@ class MxListCursor : public MxCore
|
|||
m_match = NULL;
|
||||
}
|
||||
|
||||
MxBool Find(T *p_obj);
|
||||
MxBool Find(T p_obj);
|
||||
void Detach();
|
||||
MxBool Next(T*& p_obj);
|
||||
void SetValue(T *p_obj);
|
||||
MxBool Next(T& p_obj);
|
||||
void SetValue(T p_obj);
|
||||
void Head() { m_match = m_list->m_first; }
|
||||
void Reset() { m_match = NULL; }
|
||||
|
||||
|
@ -123,7 +127,7 @@ inline void MxList<T>::DeleteAll()
|
|||
break;
|
||||
|
||||
MxListEntry<T> *next = t->m_next;
|
||||
m_customDestructor(t->m_obj);
|
||||
m_customDestructor(t->GetValue());
|
||||
delete t;
|
||||
t = next;
|
||||
}
|
||||
|
@ -134,7 +138,7 @@ inline void MxList<T>::DeleteAll()
|
|||
}
|
||||
|
||||
template <class T>
|
||||
inline void MxList<T>::Append(T *p_newobj)
|
||||
inline void MxList<T>::Append(T p_newobj)
|
||||
{
|
||||
MxListEntry<T> *currentLast = this->m_last;
|
||||
MxListEntry<T> *newEntry = new MxListEntry<T>(p_newobj, currentLast);
|
||||
|
@ -169,7 +173,7 @@ inline void MxList<T>::_DeleteEntry(MxListEntry<T> *match)
|
|||
}
|
||||
|
||||
template <class T>
|
||||
inline MxBool MxListCursor<T>::Find(T *p_obj)
|
||||
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);
|
||||
|
@ -186,7 +190,7 @@ inline void MxListCursor<T>::Detach()
|
|||
}
|
||||
|
||||
template <class T>
|
||||
inline MxBool MxListCursor<T>::Next(T*& p_obj)
|
||||
inline MxBool MxListCursor<T>::Next(T& p_obj)
|
||||
{
|
||||
if (!m_match)
|
||||
m_match = m_list->m_first;
|
||||
|
@ -200,7 +204,7 @@ inline MxBool MxListCursor<T>::Next(T*& p_obj)
|
|||
}
|
||||
|
||||
template <class T>
|
||||
inline void MxListCursor<T>::SetValue(T *p_obj)
|
||||
inline void MxListCursor<T>::SetValue(T p_obj)
|
||||
{
|
||||
if (m_match)
|
||||
m_match->m_obj = p_obj;
|
||||
|
|
|
@ -8,7 +8,7 @@ class MxPresenter;
|
|||
// Unclear what the purpose of this class is
|
||||
// VTABLE 0x100d62f0
|
||||
// SIZE 0x18
|
||||
class MxPresenterListParent : public MxList<MxPresenter>
|
||||
class MxPresenterListParent : public MxList<MxPresenter*>
|
||||
{
|
||||
public:
|
||||
MxPresenterListParent() {
|
||||
|
@ -24,15 +24,15 @@ class MxPresenterList : public MxPresenterListParent
|
|||
virtual MxS8 Compare(MxPresenter *, MxPresenter *); // +0x14
|
||||
};
|
||||
|
||||
typedef MxListCursorChildChild<MxPresenter> MxPresenterListCursor;
|
||||
typedef MxListCursorChildChild<MxPresenter*> MxPresenterListCursor;
|
||||
|
||||
// OFFSET: LEGO1 0x1001cd20 TEMPLATE
|
||||
// MxListParent<MxPresenter *>::Compare
|
||||
|
||||
// OFFSET: LEGO1 0x1001cd30 TEMPLATE
|
||||
// MxListParent<MxPresenter>::Destroy
|
||||
|
||||
// OFFSET: LEGO1 0x1001cdd0 TEMPLATE
|
||||
// MxListParent<MxPresenter>::~MxListParent<MxPresenter>
|
||||
// MxListParent<MxPresenter *>::Destroy
|
||||
|
||||
// OFFSET: LEGO1 0x1001ce20 TEMPLATE
|
||||
// MxList<MxPresenter>::~MxList<MxPresenter>
|
||||
// MxList<MxPresenter *>::~MxList<MxPresenter *>
|
||||
|
||||
#endif // MXPRESENTERLIST_H
|
||||
|
|
23
LEGO1/mxstringlist.h
Normal file
23
LEGO1/mxstringlist.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
#ifndef MXSTRINGLIST_H
|
||||
#define MXSTRINGLIST_H
|
||||
|
||||
#include "mxlist.h"
|
||||
#include "mxstring.h"
|
||||
|
||||
// VTABLE 0x100dd040
|
||||
// SIZE 0x18
|
||||
class MxStringList : public MxList<MxString> {};
|
||||
|
||||
// OFFSET: LEGO1 0x100cb3c0 TEMPLATE
|
||||
// MxListParent<MxString>::Compare
|
||||
|
||||
// OFFSET: LEGO1 0x100cb470 TEMPLATE
|
||||
// MxListParent<MxString>::Destroy
|
||||
|
||||
// OFFSET: LEGO1 0x100cb4c0 TEMPLATE
|
||||
// MxList<MxString>::~MxList<MxString>
|
||||
|
||||
// OFFSET: LEGO1 0x100cc450 TEMPLATE
|
||||
// MxListEntry<MxString>::GetValue
|
||||
|
||||
#endif // MXSTRINGLIST_H
|
Loading…
Reference in a new issue