From cfe28a2b26fa6c10d2e2de3ea65900c50b51da4d Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Tue, 26 Dec 2023 20:33:53 -0500 Subject: [PATCH] Implement/match MxStreamController::FUN_100c1f00 (#367) --- LEGO1/mxdschunk.h | 10 +++++----- LEGO1/mxstreamcontroller.cpp | 31 ++++++++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/LEGO1/mxdschunk.h b/LEGO1/mxdschunk.h index ec4a8cbe..70209596 100644 --- a/LEGO1/mxdschunk.h +++ b/LEGO1/mxdschunk.h @@ -56,11 +56,11 @@ public: } protected: - MxU16 m_flags; // 0x8 - undefined4 m_objectId; // 0xc - MxLong m_time; // 0x10 - MxU32 m_length; // 0x14 - MxU8* m_data; // 0x18 + MxU16 m_flags; // 0x8 + MxU32 m_objectId; // 0xc + MxLong m_time; // 0x10 + MxU32 m_length; // 0x14 + MxU8* m_data; // 0x18 }; #endif // MXDSCHUNK_H diff --git a/LEGO1/mxstreamcontroller.cpp b/LEGO1/mxstreamcontroller.cpp index 726a8fa1..02d43a01 100644 --- a/LEGO1/mxstreamcontroller.cpp +++ b/LEGO1/mxstreamcontroller.cpp @@ -3,6 +3,7 @@ #include "legoomni.h" #include "legoutil.h" #include "mxautolocker.h" +#include "mxdsmultiaction.h" #include "mxdsstreamingaction.h" #include "mxnextactiondatastart.h" #include "mxstl/stlcompat.h" @@ -252,11 +253,35 @@ MxPresenter* MxStreamController::FUN_100c1e70(MxDSAction& p_action) return result; } -// STUB: LEGO1 0x100c1f00 +// FUNCTION: LEGO1 0x100c1f00 MxResult MxStreamController::FUN_100c1f00(MxDSAction* p_action) { - // TODO - return FAILURE; + MxAutoLocker lock(&m_criticalSection); + + MxU32 objectId = p_action->GetObjectId(); + MxStreamChunk* chunk = new MxStreamChunk; + + if (!chunk) + return FAILURE; + + chunk->SetFlags(MxDSChunk::Flag_Bit3); + chunk->SetObjectId(objectId); + + if (chunk->SendChunk(m_subscriberList, FALSE, p_action->GetUnknown24()) != SUCCESS) + delete chunk; + + if (p_action->IsA("MxDSMultiAction")) { + MxDSActionList* actions = ((MxDSMultiAction*) p_action)->GetActionList(); + MxDSActionListCursor cursor(actions); + MxDSAction* action; + + while (cursor.Next(action)) { + if (FUN_100c1f00(action) != SUCCESS) + return FAILURE; + } + } + + return SUCCESS; } // STUB: LEGO1 0x100c20b0