From 1f6d1ddab05a95d59d334433ad75cad49855f2c5 Mon Sep 17 00:00:00 2001 From: Misha <106913236+MishaProductions@users.noreply.github.com> Date: Wed, 8 Nov 2023 17:05:20 -0500 Subject: [PATCH 1/4] Lego video manager constructor and deconstructor (#275) * commit * Update legovideomanager.cpp * add offset comments * Update legovideomanager.h * Update legovideomanager.h --- LEGO1/legovideomanager.cpp | 49 ++++++++++++++++++++++++++++++++++---- LEGO1/legovideomanager.h | 38 ++++++++++++++++++++++------- 2 files changed, 75 insertions(+), 12 deletions(-) diff --git a/LEGO1/legovideomanager.cpp b/LEGO1/legovideomanager.cpp index 775c2e8c..55f3da33 100644 --- a/LEGO1/legovideomanager.cpp +++ b/LEGO1/legovideomanager.cpp @@ -2,16 +2,57 @@ DECOMP_SIZE_ASSERT(LegoVideoManager, 0x590); -// OFFSET: LEGO1 0x1007aa20 STUB +// OFFSET: LEGO1 0x1007aa20 LegoVideoManager::LegoVideoManager() { - // TODO + m_unk64 = 0; + m_3dManager = NULL; + m_unk6c = 0; + m_direct3d = 0; + m_unk0xe6 = FALSE; + memset(m_unk0x78, 0, sizeof(m_unk0x78)); + m_unk0x78[0] = 0x6c; + m_unk4e8 = 0; + m_isFullscreenMovie = FALSE; + m_palette = NULL; + m_prefCounter = NULL; + m_cursorMoved = FALSE; + m_cursorX = m_cursorY; + m_cursorYCopy = m_cursorY; + m_cursorXCopy = m_cursorY; + m_unk0x514 = 0; + m_unk0x500 = FALSE; + m_drawFPS = FALSE; + m_unk0x528 = 0; + m_arialFont = NULL; + m_unk0xe5 = FALSE; + m_unk0x554 = 0; + m_initialized = FALSE; } -// OFFSET: LEGO1 0x1007ab40 STUB +// OFFSET: LEGO1 0x1007ab40 LegoVideoManager::~LegoVideoManager() { - // TODO + Destroy(); + delete m_palette; +} + +// OFFSET: LEGO1 0x1007b5e0 +void LegoVideoManager::Destroy() +{ + // todo: delete m_unk0x512 + // todo: delete m_unk0x258 + if (m_arialFont != NULL) { + DeleteObject(m_arialFont); + m_arialFont = NULL; + } + + // delete m_unk64; //TODO: delete d3drm + + delete m_3dManager; + MxVideoManager::Destroy(); + // todo: delete m_unk4e8 + delete[] m_prefCounter; } // OFFSET: LEGO1 0x1007c560 STUB diff --git a/LEGO1/legovideomanager.h b/LEGO1/legovideomanager.h index b845e8a8..a6d2f89f 100644 --- a/LEGO1/legovideomanager.h +++ b/LEGO1/legovideomanager.h @@ -33,20 +33,42 @@ class LegoVideoManager : public MxVideoManager { this->m_videoParam.GetPalette()->SetOverrideSkyColor(p_shouldOverride); } + virtual void Destroy() override; // vtable+0x18 + private: undefined4 m_unk64; - Lego3DManager* m_3dManager; + Lego3DManager* m_3dManager; // 0x68 undefined4 m_unk6c; undefined4 m_unk70; - MxDirect3D* m_direct3d; - undefined m_pad0x78[0x6c]; + MxDirect3D* m_direct3d; // 0x74 + undefined4 m_unk0x78[27]; MxBool m_unk0xe4; - undefined m_pad0xe8[0x41c]; + MxBool m_unk0xe5; + MxBool m_unk0xe6; + PALETTEENTRY m_paletteEntries[256]; // 0xe7 + undefined m_padding0x4e7; + undefined4 m_unk4e8; + MxBool m_isFullscreenMovie; // 0x4ec + MxPalette* m_palette; // 0x4f0 + LARGE_INTEGER* m_prefCounter; // 0x4f4 + undefined m_padding0x4f4[8]; + MxBool m_unk0x500; MxBool m_cursorMoved; // 0x501 - undefined m_pad0x502[0x8]; - MxS32 m_cursorX; // 0x50c - MxS32 m_cursorY; // 0x510 - undefined m_pad0x514[0x7c]; + MxS32 m_cursorXCopy; // 0x504 + MxS32 m_cursorYCopy; // 0x508 + MxS32 m_cursorX; // 0x50c + MxS32 m_cursorY; // 0x510 + undefined4 m_unk0x514; + undefined m_pad0x518[0x10]; + undefined4 m_unk0x528; + MxBool m_drawFPS; // 0x52c + RECT m_fpsRect; // 0x530 + HFONT m_arialFont; // 0x540 + SIZE m_fpsSize; // 0x544 + undefined m_pad0x54c[8]; + undefined m_unk0x554; + MxBool m_initialized; // 0x555 + undefined m_pad0x556[0x39]; }; #endif // LEGOVIDEOMANAGER_H From 82697d71482185a98d53749f48c21c1a7f20bec5 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 9 Nov 2023 10:52:58 -0500 Subject: [PATCH 2/4] Add missing override keywords --- LEGO1/mxdsactionlist.h | 2 +- LEGO1/mxhashtable.h | 5 ++--- LEGO1/mxlist.h | 2 +- LEGO1/mxpresenterlist.h | 2 +- LEGO1/mxvariabletable.h | 4 ++-- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/LEGO1/mxdsactionlist.h b/LEGO1/mxdsactionlist.h index 3dc9798a..d3bafbbb 100644 --- a/LEGO1/mxdsactionlist.h +++ b/LEGO1/mxdsactionlist.h @@ -12,7 +12,7 @@ class MxDSActionList : public MxList { public: MxDSActionList() { this->m_unk18 = 0; } - virtual MxS8 Compare(MxDSAction*, MxDSAction*); // +0x14 + virtual MxS8 Compare(MxDSAction*, MxDSAction*) override; // +0x14 static void Destroy(MxDSAction* p_action); diff --git a/LEGO1/mxhashtable.h b/LEGO1/mxhashtable.h index f9a8df73..54ca16bd 100644 --- a/LEGO1/mxhashtable.h +++ b/LEGO1/mxhashtable.h @@ -63,13 +63,12 @@ class MxHashTable : protected HashTableParent { m_resizeOption = HASH_TABLE_OPT_NO_EXPAND; } - virtual ~MxHashTable(); + virtual ~MxHashTable() override; void Resize(); void Add(T*); - virtual MxS8 Compare(T*, T*) = 0; - + virtual MxS8 Compare(T*, T*) override = 0; virtual MxU32 Hash(T*) = 0; // FIXME: use of friend here? diff --git a/LEGO1/mxlist.h b/LEGO1/mxlist.h index 1d8e26c3..11f0e8ba 100644 --- a/LEGO1/mxlist.h +++ b/LEGO1/mxlist.h @@ -70,7 +70,7 @@ class MxList : protected MxListParent { m_first = NULL; } - virtual ~MxList(); + virtual ~MxList() override; void Append(T p_obj) { _InsertEntry(p_obj, this->m_last, NULL); }; void DeleteAll(); diff --git a/LEGO1/mxpresenterlist.h b/LEGO1/mxpresenterlist.h index b1a780bc..350d6c17 100644 --- a/LEGO1/mxpresenterlist.h +++ b/LEGO1/mxpresenterlist.h @@ -17,7 +17,7 @@ class MxPresenterListParent : public MxList { // SIZE 0x18 class MxPresenterList : public MxPresenterListParent { public: - virtual MxS8 Compare(MxPresenter*, MxPresenter*); // +0x14 + virtual MxS8 Compare(MxPresenter*, MxPresenter*) override; // +0x14 }; typedef MxListCursorChildChild MxPresenterListCursor; diff --git a/LEGO1/mxvariabletable.h b/LEGO1/mxvariabletable.h index 8bffab81..df34eb15 100644 --- a/LEGO1/mxvariabletable.h +++ b/LEGO1/mxvariabletable.h @@ -17,8 +17,8 @@ class MxVariableTable : public MxHashTable { // OFFSET: LEGO1 0x100afdb0 static void Destroy(MxVariable* p_obj) { p_obj->Destroy(); } - virtual MxS8 Compare(MxVariable*, MxVariable*); // +0x14 - virtual MxU32 Hash(MxVariable*); // +0x18 + virtual MxS8 Compare(MxVariable*, MxVariable*) override; // +0x14 + virtual MxU32 Hash(MxVariable*) override; // +0x18 }; // OFFSET: LEGO1 0x100b0bd0 TEMPLATE From e2f2ef6152d8e2aaf0452d37eab558420911233d Mon Sep 17 00:00:00 2001 From: Joshua Peisach Date: Fri, 10 Nov 2023 13:27:10 -0500 Subject: [PATCH 3/4] MxControlPresenter: destructor and ReadyTickle (#279) --- LEGO1/mxcontrolpresenter.cpp | 21 +++++++++++++++++++++ LEGO1/mxcontrolpresenter.h | 5 ++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/LEGO1/mxcontrolpresenter.cpp b/LEGO1/mxcontrolpresenter.cpp index 158e7460..443fe0dc 100644 --- a/LEGO1/mxcontrolpresenter.cpp +++ b/LEGO1/mxcontrolpresenter.cpp @@ -1,5 +1,8 @@ #include "mxcontrolpresenter.h" +#include "legoomni.h" +#include "mxticklemanager.h" + DECOMP_SIZE_ASSERT(MxControlPresenter, 0x5c) // OFFSET: LEGO1 0x10043f50 @@ -12,3 +15,21 @@ MxControlPresenter::MxControlPresenter() this->m_unk58 = 0; this->m_unk54 = 0; } + +// OFFSET: LEGO1 0x10044110 +MxControlPresenter::~MxControlPresenter() +{ + if (this->m_unk58) { + delete this->m_unk58; + } +} + +// OFFSET: LEGO1 0x10044610 +void MxControlPresenter::ReadyTickle() +{ + MxPresenter::ParseExtra(); + TickleManager()->UnregisterClient(this); + + m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; + m_currentTickleState = TickleState_Repeating; +} diff --git a/LEGO1/mxcontrolpresenter.h b/LEGO1/mxcontrolpresenter.h index 29a7121a..489451be 100644 --- a/LEGO1/mxcontrolpresenter.h +++ b/LEGO1/mxcontrolpresenter.h @@ -9,6 +9,7 @@ class MxControlPresenter : public MxCompositePresenter { public: MxControlPresenter(); + virtual ~MxControlPresenter() override; // OFFSET: LEGO1 0x10044000 inline virtual const char* ClassName() const override // vtable+0x0c @@ -23,13 +24,15 @@ class MxControlPresenter : public MxCompositePresenter { return !strcmp(name, MxControlPresenter::ClassName()) || MxCompositePresenter::IsA(name); } + virtual void ReadyTickle() override; // vtable+0x18 + private: undefined2 m_unk4c; MxS16 m_unk4e; undefined m_unk50; undefined2 m_unk52; undefined2 m_unk54; - undefined4 m_unk58; + undefined4* m_unk58; }; #endif // MXCONTROLPRESENTER_H From 04b503c79f2d9dd35aedf386f327966854940050 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sun, 12 Nov 2023 07:47:01 -0500 Subject: [PATCH 4/4] Bootstrap MxMediaPresenter (#274) * Bootstrap MxMediaPresenter * Add override --- CMakeLists.txt | 1 + LEGO1/mxdsactionlist.cpp | 8 +--- LEGO1/mxdschunk.h | 2 +- LEGO1/mxdssubscriber.cpp | 19 +++++++- LEGO1/mxdssubscriber.h | 9 ++++ LEGO1/mxmediapresenter.cpp | 88 ++++++++++++++++++++++++++++++------- LEGO1/mxmediapresenter.h | 17 ++++--- LEGO1/mxpresenter.cpp | 2 +- LEGO1/mxpresenter.h | 18 ++++---- LEGO1/mxpresenterlist.cpp | 8 +--- LEGO1/mxstreamchunklist.cpp | 19 ++++++++ LEGO1/mxstreamchunklist.h | 34 ++++++++++++++ 12 files changed, 176 insertions(+), 49 deletions(-) create mode 100644 LEGO1/mxstreamchunklist.cpp create mode 100644 LEGO1/mxstreamchunklist.h diff --git a/CMakeLists.txt b/CMakeLists.txt index f63e39e9..a297f7f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -170,6 +170,7 @@ add_library(lego1 SHARED LEGO1/mxsoundmanager.cpp LEGO1/mxsoundpresenter.cpp LEGO1/mxstillpresenter.cpp + LEGO1/mxstreamchunklist.cpp LEGO1/mxstreamcontroller.cpp LEGO1/mxstreamer.cpp LEGO1/mxstreamprovider.cpp diff --git a/LEGO1/mxdsactionlist.cpp b/LEGO1/mxdsactionlist.cpp index 394512e5..2959ffcd 100644 --- a/LEGO1/mxdsactionlist.cpp +++ b/LEGO1/mxdsactionlist.cpp @@ -6,13 +6,9 @@ DECOMP_SIZE_ASSERT(MxDSActionList, 0x1c); DECOMP_SIZE_ASSERT(MxDSActionListCursor, 0x10); // OFFSET: LEGO1 0x100c9c90 -MxS8 MxDSActionList::Compare(MxDSAction* p_var0, MxDSAction* p_var1) +MxS8 MxDSActionList::Compare(MxDSAction* p_a, MxDSAction* p_b) { - if (p_var1 == p_var0) - return 0; - if (p_var1 <= p_var0) - return 1; - return -1; + return p_a == p_b ? 0 : p_a < p_b ? -1 : 1; } // OFFSET: LEGO1 0x100c9cb0 diff --git a/LEGO1/mxdschunk.h b/LEGO1/mxdschunk.h index ba716de6..c061a50e 100644 --- a/LEGO1/mxdschunk.h +++ b/LEGO1/mxdschunk.h @@ -23,7 +23,7 @@ class MxDSChunk : public MxCore { return !strcmp(name, MxDSChunk::ClassName()) || MxCore::IsA(name); } -private: + // private: MxS16 m_length; // 0x8 MxLong m_buffer; // 0xc MxLong m_unk10; // 0x10 diff --git a/LEGO1/mxdssubscriber.cpp b/LEGO1/mxdssubscriber.cpp index d97b6946..530a3a09 100644 --- a/LEGO1/mxdssubscriber.cpp +++ b/LEGO1/mxdssubscriber.cpp @@ -1,13 +1,28 @@ #include "mxdssubscriber.h" -// OFFSET: LEGO1 0x100b7bb0 +DECOMP_SIZE_ASSERT(MxDSSubscriber, 0x4c); + +// OFFSET: LEGO1 0x100b7bb0 STUB MxDSSubscriber::MxDSSubscriber() { // TODO } -// OFFSET: LEGO1 0x100b7e00 +// OFFSET: LEGO1 0x100b7e00 STUB MxDSSubscriber::~MxDSSubscriber() { // TODO } + +// OFFSET: LEGO1 0x100b7ed0 STUB +MxResult MxDSSubscriber::FUN_100b7ed0(MxStreamController*, MxU32, MxS16) +{ + // TODO + return SUCCESS; +} + +// OFFSET: LEGO1 0x100b8390 STUB +void MxDSSubscriber::FUN_100b8390(MxDSChunk*) +{ + // TODO +} diff --git a/LEGO1/mxdssubscriber.h b/LEGO1/mxdssubscriber.h index c56835db..c8efc64d 100644 --- a/LEGO1/mxdssubscriber.h +++ b/LEGO1/mxdssubscriber.h @@ -1,7 +1,10 @@ #ifndef MXDSSUBSCRIBER_H #define MXDSSUBSCRIBER_H +#include "decomp.h" #include "mxcore.h" +#include "mxdschunk.h" +#include "mxstreamcontroller.h" // VTABLE 0x100dc698 // SIZE 0x4c @@ -22,6 +25,12 @@ class MxDSSubscriber : public MxCore { { return !strcmp(name, MxDSSubscriber::ClassName()) || MxCore::IsA(name); } + + MxResult FUN_100b7ed0(MxStreamController*, MxU32, MxS16); + void FUN_100b8390(MxDSChunk*); + +private: + undefined m_pad[0x44]; // 0x8 }; #endif // MXDSSUBSCRIBER_H diff --git a/LEGO1/mxmediapresenter.cpp b/LEGO1/mxmediapresenter.cpp index 4350c62c..d2ebd702 100644 --- a/LEGO1/mxmediapresenter.cpp +++ b/LEGO1/mxmediapresenter.cpp @@ -1,5 +1,8 @@ #include "mxmediapresenter.h" +#include "mxautolocker.h" +#include "mxstreamchunk.h" + DECOMP_SIZE_ASSERT(MxMediaPresenter, 0x50); // OFFSET: LEGO1 0x1000c550 @@ -8,26 +11,59 @@ MxMediaPresenter::~MxMediaPresenter() Destroy(TRUE); } -// OFFSET: LEGO1 0x100b5d10 STUB -MxResult MxMediaPresenter::Tickle() +// OFFSET: LEGO1 0x1000c5b0 +void MxMediaPresenter::Destroy() { - // TODO - return SUCCESS; + Destroy(FALSE); } // OFFSET: LEGO1 0x100b54e0 void MxMediaPresenter::Init() { - this->m_unk40 = NULL; - this->m_unk44 = NULL; - this->m_unk48 = NULL; - this->m_unk4c = NULL; + this->m_subscriber = NULL; + this->m_chunks = NULL; + this->m_cursor = NULL; + this->m_currentChunk = NULL; } -// OFFSET: LEGO1 0x100b54f0 STUB +// OFFSET: LEGO1 0x100b54f0 void MxMediaPresenter::Destroy(MxBool p_fromDestructor) +{ + { + MxAutoLocker lock(&m_criticalSection); + + if (m_currentChunk && m_subscriber) + m_subscriber->FUN_100b8390(m_currentChunk); + + if (m_subscriber) + delete m_subscriber; + + if (m_cursor) + delete m_cursor; + + if (m_chunks) { + MxStreamChunkListCursor cursor(m_chunks); + MxStreamChunk* chunk; + + while (cursor.Next(chunk)) + if (chunk->m_unk18) + delete[] chunk->m_unk18; + + delete m_chunks; + } + + Init(); + } + + if (!p_fromDestructor) + MxPresenter::Destroy(); +} + +// OFFSET: LEGO1 0x100b5d10 STUB +MxResult MxMediaPresenter::Tickle() { // TODO + return SUCCESS; } // OFFSET: LEGO1 0x100b5d90 STUB @@ -56,16 +92,34 @@ void MxMediaPresenter::Enable(MxBool p_enable) // TODO } -// OFFSET: LEGO1 0x1000c5b0 -void MxMediaPresenter::Destroy() +// OFFSET: LEGO1 0x100b5700 +MxResult MxMediaPresenter::StartAction(MxStreamController* p_controller, MxDSAction* p_action) { - Destroy(FALSE); -} + MxResult result = FAILURE; + MxAutoLocker lock(&m_criticalSection); -// OFFSET: LEGO1 0x100b5700 STUB -MxLong MxMediaPresenter::StartAction(MxStreamController* p_controller, MxDSAction* p_action) -{ - return 0; + if (MxPresenter::StartAction(p_controller, p_action) == SUCCESS) { + if (m_action->GetFlags() & MxDSAction::Flag_Looping) { + m_chunks = new MxStreamChunkList; + m_cursor = new MxStreamChunkListCursor(m_chunks); + + if (!m_chunks && !m_cursor) + goto done; + } + + if (p_controller) { + m_subscriber = new MxDSSubscriber; + + if (!m_subscriber || + m_subscriber->FUN_100b7ed0(p_controller, p_action->GetObjectId(), p_action->GetUnknown24()) != SUCCESS) + goto done; + } + + result = SUCCESS; + } + +done: + return result; } // OFFSET: LEGO1 0x100b5bc0 STUB diff --git a/LEGO1/mxmediapresenter.h b/LEGO1/mxmediapresenter.h index 59ca015b..6c40f93b 100644 --- a/LEGO1/mxmediapresenter.h +++ b/LEGO1/mxmediapresenter.h @@ -2,15 +2,18 @@ #define MXMEDIAPRESENTER_H #include "decomp.h" +#include "mxdssubscriber.h" #include "mxpresenter.h" +#include "mxstreamchunklist.h" // VTABLE 0x100d4cd8 +// SIZE 0x50 class MxMediaPresenter : public MxPresenter { public: inline MxMediaPresenter() { Init(); } virtual ~MxMediaPresenter() override; - virtual MxResult Tickle() override; + virtual MxResult Tickle() override; // vtable+0x8 // OFFSET: LEGO1 0x1000c5c0 inline virtual const char* ClassName() const override // vtable+0xc @@ -29,17 +32,17 @@ class MxMediaPresenter : public MxPresenter { virtual void RepeatingTickle() override; virtual void DoneTickle() override; virtual void Destroy() override; - virtual MxLong StartAction(MxStreamController*, MxDSAction*) override; + virtual MxResult StartAction(MxStreamController*, MxDSAction*) override; virtual void EndAction() override; virtual void Enable(MxBool p_enable) override; virtual void VTable0x58(); - undefined4 m_unk40; - undefined4 m_unk44; - undefined4 m_unk48; - undefined4 m_unk4c; - protected: + MxDSSubscriber* m_subscriber; // 0x40 + MxStreamChunkList* m_chunks; // 0x44 + MxStreamChunkListCursor* m_cursor; // 0x48 + MxStreamChunk* m_currentChunk; // 0x4c + void Init(); void Destroy(MxBool p_fromDestructor); }; diff --git a/LEGO1/mxpresenter.cpp b/LEGO1/mxpresenter.cpp index e4121602..1ff02c7a 100644 --- a/LEGO1/mxpresenter.cpp +++ b/LEGO1/mxpresenter.cpp @@ -116,7 +116,7 @@ MxResult MxPresenter::Tickle() } // OFFSET: LEGO1 0x100b4d80 -MxLong MxPresenter::StartAction(MxStreamController*, MxDSAction* p_action) +MxResult MxPresenter::StartAction(MxStreamController*, MxDSAction* p_action) { MxAutoLocker lock(&this->m_criticalSection); diff --git a/LEGO1/mxpresenter.h b/LEGO1/mxpresenter.h index 9427e79d..a126a370 100644 --- a/LEGO1/mxpresenter.h +++ b/LEGO1/mxpresenter.h @@ -54,15 +54,15 @@ class MxPresenter : public MxCore { __declspec(dllexport) virtual void ParseExtra(); // vtable+0x30 public: - virtual MxResult AddToManager(); // vtable+0x34 - virtual void Destroy(); // vtable+0x38 - __declspec(dllexport) virtual MxLong StartAction(MxStreamController*, MxDSAction*); // vtable+0x3c - __declspec(dllexport) virtual void EndAction(); // vtable+0x40 - virtual void SetTickleState(TickleState p_tickleState); // vtable+0x44 - virtual MxBool HasTickleStatePassed(TickleState p_tickleState); // vtable+0x48 - virtual undefined4 PutData(); // vtable+0x4c - virtual MxBool IsHit(MxS32 p_x, MxS32 p_y); // vtable+0x50 - __declspec(dllexport) virtual void Enable(MxBool p_enable); // vtable+0x54 + virtual MxResult AddToManager(); // vtable+0x34 + virtual void Destroy(); // vtable+0x38 + __declspec(dllexport) virtual MxResult StartAction(MxStreamController*, MxDSAction*); // vtable+0x3c + __declspec(dllexport) virtual void EndAction(); // vtable+0x40 + virtual void SetTickleState(TickleState p_tickleState); // vtable+0x44 + virtual MxBool HasTickleStatePassed(TickleState p_tickleState); // vtable+0x48 + virtual undefined4 PutData(); // vtable+0x4c + virtual MxBool IsHit(MxS32 p_x, MxS32 p_y); // vtable+0x50 + __declspec(dllexport) virtual void Enable(MxBool p_enable); // vtable+0x54 MxBool IsEnabled(); diff --git a/LEGO1/mxpresenterlist.cpp b/LEGO1/mxpresenterlist.cpp index fb95aa99..f6ed6594 100644 --- a/LEGO1/mxpresenterlist.cpp +++ b/LEGO1/mxpresenterlist.cpp @@ -6,11 +6,7 @@ DECOMP_SIZE_ASSERT(MxPresenterList, 0x18); DECOMP_SIZE_ASSERT(MxPresenterListCursor, 0x10); // OFFSET: LEGO1 0x1001cd00 -MxS8 MxPresenterList::Compare(MxPresenter* p_var0, MxPresenter* p_var1) +MxS8 MxPresenterList::Compare(MxPresenter* p_a, MxPresenter* p_b) { - if (p_var1 == p_var0) - return 0; - if (p_var1 <= p_var0) - return 1; - return -1; + return p_a == p_b ? 0 : p_a < p_b ? -1 : 1; } diff --git a/LEGO1/mxstreamchunklist.cpp b/LEGO1/mxstreamchunklist.cpp new file mode 100644 index 00000000..8c76452e --- /dev/null +++ b/LEGO1/mxstreamchunklist.cpp @@ -0,0 +1,19 @@ +#include "mxstreamchunklist.h" + +#include "mxstreamchunk.h" + +DECOMP_SIZE_ASSERT(MxStreamChunkList, 0x18); +DECOMP_SIZE_ASSERT(MxStreamChunkListCursor, 0x10); + +// OFFSET: LEGO1 0x100b5900 +MxS8 MxStreamChunkList::Compare(MxStreamChunk* p_a, MxStreamChunk* p_b) +{ + return p_a == p_b ? 0 : p_a < p_b ? -1 : 1; +} + +// OFFSET: LEGO1 0x100b5920 +void MxStreamChunkList::Destroy(MxStreamChunk* p_chunk) +{ + if (p_chunk) + delete p_chunk; +} diff --git a/LEGO1/mxstreamchunklist.h b/LEGO1/mxstreamchunklist.h new file mode 100644 index 00000000..3a19950b --- /dev/null +++ b/LEGO1/mxstreamchunklist.h @@ -0,0 +1,34 @@ +#ifndef MXSTREAMCHUNKLIST_H +#define MXSTREAMCHUNKLIST_H + +#include "decomp.h" +#include "mxlist.h" + +class MxStreamChunk; + +// VTABLE 0x100dc600 +// SIZE 0x18 +class MxStreamChunkList : public MxList { +public: + MxStreamChunkList() { m_customDestructor = Destroy; } + + virtual MxS8 Compare(MxStreamChunk*, MxStreamChunk*) override; // +0x14 + + static void Destroy(MxStreamChunk* p_chunk); +}; + +typedef MxListCursorChild MxStreamChunkListCursor; + +// OFFSET: LEGO1 0x100b5930 TEMPLATE +// MxListParent::Compare + +// OFFSET: LEGO1 0x100b5990 TEMPLATE +// MxListParent::Destroy + +// OFFSET: LEGO1 0x100b59a0 TEMPLATE +// MxList::~MxList + +// OFFSET: LEGO1 0x100b5b10 TEMPLATE +// MxList::`scalar deleting destructor' + +#endif // MXSTREAMCHUNKLIST_H