From 9eefc82c8ce1ba38af32ba89f999167c1526d08a Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 23 Dec 2023 08:40:39 -0500 Subject: [PATCH] Bootstrap MxDSSubscriber (#352) * Bootstrap MxDSSubscriber * Fix offset comment --- LEGO1/mxdssubscriber.cpp | 51 +++++++++++++++++++++++++++++++----- LEGO1/mxdssubscriber.h | 18 +++++++++++-- LEGO1/mxmediapresenter.cpp | 2 +- LEGO1/mxstreamcontroller.cpp | 12 +++++++++ LEGO1/mxstreamcontroller.h | 8 +++--- 5 files changed, 78 insertions(+), 13 deletions(-) diff --git a/LEGO1/mxdssubscriber.cpp b/LEGO1/mxdssubscriber.cpp index b7a6d50b..49d145f0 100644 --- a/LEGO1/mxdssubscriber.cpp +++ b/LEGO1/mxdssubscriber.cpp @@ -1,24 +1,61 @@ #include "mxdssubscriber.h" +#include "mxstreamcontroller.h" + DECOMP_SIZE_ASSERT(MxDSSubscriber, 0x4c); -// STUB: LEGO1 0x100b7bb0 +// FUNCTION: LEGO1 0x100b7bb0 MxDSSubscriber::MxDSSubscriber() { - // TODO + m_unk0x48 = -1; + m_objectId = -1; + m_unk0x20 = NULL; + m_unk0x3c = NULL; } -// STUB: LEGO1 0x100b7e00 +// FUNCTION: LEGO1 0x100b7e00 MxDSSubscriber::~MxDSSubscriber() { - // TODO + if (m_controller) + m_controller->FUN_100c1620(this); + + FUN_100b8030(); + + if (m_unk0x20) + delete m_unk0x20; + m_unk0x20 = NULL; + + if (m_unk0x3c) + delete m_unk0x3c; + m_unk0x3c = NULL; } -// STUB: LEGO1 0x100b7ed0 -MxResult MxDSSubscriber::FUN_100b7ed0(MxStreamController*, MxU32, MxS16) +// FUNCTION: LEGO1 0x100b7ed0 +MxResult MxDSSubscriber::Create(MxStreamController* p_controller, MxU32 p_objectId, MxS16 p_unk0x48) +{ + m_objectId = p_objectId; + m_unk0x48 = p_unk0x48; + + if (!p_controller) + return FAILURE; + m_controller = p_controller; + + m_unk0x20 = new MxStreamChunkListCursor(&m_unk0x08); + if (!m_unk0x20) + return FAILURE; + + m_unk0x3c = new MxStreamChunkListCursor(&m_unk0x24); + if (!m_unk0x3c) + return FAILURE; + + m_controller->FUN_100c15d0(this); + return SUCCESS; +} + +// STUB: LEGO1 0x100b8030 +void MxDSSubscriber::FUN_100b8030() { // TODO - return SUCCESS; } // STUB: LEGO1 0x100b8250 diff --git a/LEGO1/mxdssubscriber.h b/LEGO1/mxdssubscriber.h index 2cba7416..748acb84 100644 --- a/LEGO1/mxdssubscriber.h +++ b/LEGO1/mxdssubscriber.h @@ -5,6 +5,7 @@ #include "mxcore.h" #include "mxdschunk.h" #include "mxstreamchunk.h" +#include "mxstreamchunklist.h" class MxStreamController; @@ -28,13 +29,26 @@ class MxDSSubscriber : public MxCore { return !strcmp(p_name, MxDSSubscriber::ClassName()) || MxCore::IsA(p_name); } - MxResult FUN_100b7ed0(MxStreamController*, MxU32, MxS16); + MxResult Create(MxStreamController* p_controller, MxU32 p_objectId, MxS16 p_unk0x48); + void FUN_100b8030(); MxStreamChunk* FUN_100b8250(); MxStreamChunk* FUN_100b8360(); void FUN_100b8390(MxStreamChunk*); private: - undefined m_pad[0x44]; // 0x8 + MxStreamChunkList m_unk0x08; // 0x08 + MxStreamChunkListCursor* m_unk0x20; // 0x20 + MxStreamChunkList m_unk0x24; // 0x24 + MxStreamChunkListCursor* m_unk0x3c; // 0x3c + MxStreamController* m_controller; // 0x40 + MxU32 m_objectId; // 0x44 + MxS16 m_unk0x48; // 0x48 }; +// SYNTHETIC: LEGO1 0x100b7de0 +// MxDSSubscriber::`scalar deleting destructor' + +// TEMPLATE: LEGO1 0x100b7d00 +// MxStreamChunkList::~MxStreamChunkList + #endif // MXDSSUBSCRIBER_H diff --git a/LEGO1/mxmediapresenter.cpp b/LEGO1/mxmediapresenter.cpp index 9a13adf5..b3eb2274 100644 --- a/LEGO1/mxmediapresenter.cpp +++ b/LEGO1/mxmediapresenter.cpp @@ -124,7 +124,7 @@ MxResult MxMediaPresenter::StartAction(MxStreamController* p_controller, MxDSAct m_subscriber = new MxDSSubscriber; if (!m_subscriber || - m_subscriber->FUN_100b7ed0(p_controller, p_action->GetObjectId(), p_action->GetUnknown24()) != SUCCESS) + m_subscriber->Create(p_controller, p_action->GetObjectId(), p_action->GetUnknown24()) != SUCCESS) goto done; } diff --git a/LEGO1/mxstreamcontroller.cpp b/LEGO1/mxstreamcontroller.cpp index c6aa8996..f97a7e76 100644 --- a/LEGO1/mxstreamcontroller.cpp +++ b/LEGO1/mxstreamcontroller.cpp @@ -52,6 +52,18 @@ MxResult MxStreamController::Open(const char* p_filename) return SUCCESS; } +// STUB: LEGO1 0x100c15d0 +void MxStreamController::FUN_100c15d0(MxDSSubscriber* p_subscriber) +{ + // TODO +} + +// STUB: LEGO1 0x100c1620 +void MxStreamController::FUN_100c1620(MxDSSubscriber* p_subscriber) +{ + // TODO +} + // FUNCTION: LEGO1 0x100c1690 MxResult MxStreamController::VTable0x20(MxDSAction* p_action) { diff --git a/LEGO1/mxstreamcontroller.h b/LEGO1/mxstreamcontroller.h index 468782b1..ce204aa4 100644 --- a/LEGO1/mxstreamcontroller.h +++ b/LEGO1/mxstreamcontroller.h @@ -7,6 +7,7 @@ #include "mxcriticalsection.h" #include "mxdsaction.h" #include "mxdsobject.h" +#include "mxdssubscriber.h" #include "mxstl/stlcompat.h" #include "mxstreamlist.h" #include "mxstreamprovider.h" @@ -18,7 +19,6 @@ class MxDSStreamingAction; class MxStreamController : public MxCore { public: MxStreamController(); - virtual ~MxStreamController() override; // vtable+0x0 // FUNCTION: LEGO1 0x100c0f10 @@ -43,12 +43,14 @@ class MxStreamController : public MxCore { virtual MxResult VTable0x2c(MxDSAction* p_action, MxU32 p_bufferval); // vtable+0x2c virtual MxResult VTable0x30(MxDSAction* p_action); // vtable+0x30 + void FUN_100c15d0(MxDSSubscriber* p_subscriber); + void FUN_100c1620(MxDSSubscriber* p_subscriber); MxResult FUN_100c1800(MxDSAction* p_action, MxU32 p_val); - MxBool FUN_100c20d0(MxDSObject& p_obj); MxResult FUN_100c1a00(MxDSAction* p_action, MxU32 p_bufferval); MxPresenter* FUN_100c1e70(MxDSAction& p_action); - MxResult InsertActionToList54(MxDSAction* p_action); MxResult FUN_100c1f00(MxDSAction* p_action); + MxBool FUN_100c20d0(MxDSObject& p_obj); + MxResult InsertActionToList54(MxDSAction* p_action); inline MxAtomId& GetAtom() { return m_atom; }; inline MxStreamListMxDSAction& GetUnk0x54() { return m_unk0x54; };