From 3b306073372407fa4641d6803df1b7e10471fef1 Mon Sep 17 00:00:00 2001 From: Misha <106913236+MishaProductions@users.noreply.github.com> Date: Mon, 11 Dec 2023 16:17:25 -0500 Subject: [PATCH] implement a few mxstreamercontroller vtables (#323) * implement a few mxstreamercontroller vtables * Update mxstreamcontroller.cpp --- LEGO1/mxramstreamcontroller.cpp | 16 ++++++++++---- LEGO1/mxramstreamcontroller.h | 2 +- LEGO1/mxstreamcontroller.cpp | 37 +++++++++++++++++++++++++++------ LEGO1/mxstreamcontroller.h | 5 +++-- 4 files changed, 47 insertions(+), 13 deletions(-) diff --git a/LEGO1/mxramstreamcontroller.cpp b/LEGO1/mxramstreamcontroller.cpp index e16e6190..f97486c2 100644 --- a/LEGO1/mxramstreamcontroller.cpp +++ b/LEGO1/mxramstreamcontroller.cpp @@ -42,11 +42,19 @@ MxResult MxRAMStreamController::vtable0x20(MxDSAction* p_action) return FAILURE; } -// STUB: LEGO1 0x100c6320 -MxResult MxRAMStreamController::vtable0x24(undefined4 p_unknown) +// FUNCTION: LEGO1 0x100c6320 +MxResult MxRAMStreamController::vtable0x24(MxDSAction* p_action) { - // TODO STUB - return FAILURE; + MxDSAction action; + do { + if (m_action0x60 != NULL) { + delete m_action0x60; + m_action0x60 = NULL; + } + action = *p_action; + MxStreamController::vtable0x24(&action); + } while (m_action0x60 != NULL); + return SUCCESS; } // STUB: LEGO1 0x100d0d80 diff --git a/LEGO1/mxramstreamcontroller.h b/LEGO1/mxramstreamcontroller.h index 26e9a4e1..fad2a80c 100644 --- a/LEGO1/mxramstreamcontroller.h +++ b/LEGO1/mxramstreamcontroller.h @@ -26,7 +26,7 @@ class MxRAMStreamController : public MxStreamController { virtual MxResult Open(const char* p_filename) override; virtual MxResult vtable0x20(MxDSAction* p_action) override; - virtual MxResult vtable0x24(undefined4 p_unknown) override; + virtual MxResult vtable0x24(MxDSAction* p_action) override; private: MxDSBuffer m_buffer; diff --git a/LEGO1/mxstreamcontroller.cpp b/LEGO1/mxstreamcontroller.cpp index cdc8eff3..6fafb2c7 100644 --- a/LEGO1/mxstreamcontroller.cpp +++ b/LEGO1/mxstreamcontroller.cpp @@ -117,11 +117,20 @@ MxResult MxStreamController::vtable0x20(MxDSAction* p_action) return result; } -// STUB: LEGO1 0x100c1740 -MxResult MxStreamController::vtable0x24(undefined4 p_unknown) +// FUNCTION: LEGO1 0x100c1740 +MxResult MxStreamController::vtable0x24(MxDSAction* p_action) { - // TODO STUB - return FAILURE; + MxAutoLocker locker(&m_criticalSection); + vtable0x30(p_action); + m_action0x60 = m_unkList0x54.Find(p_action, TRUE); + if (m_action0x60 == NULL) { + return FAILURE; + } + else { + p_action->SetUnknown24(m_action0x60->GetUnknown24()); + p_action->SetObjectId(m_action0x60->GetObjectId()); + return FUN_100c1f00(m_action0x60); + } } // FUNCTION: LEGO1 0x100c1800 @@ -153,9 +162,25 @@ MxResult MxStreamController::vtable0x2c(MxDSAction* p_action, MxU32 p_bufferval) return FUN_100c1800(p_action, (p_bufferval / m_provider->GetFileSize()) * m_provider->GetFileSize()); } -// STUB: LEGO1 0x100c1ce0 -MxResult MxStreamController::vtable0x30(undefined4 p_unknown) +// FUNCTION: LEGO1 0x100c1ce0 +MxResult MxStreamController::vtable0x30(MxDSAction* p_unknown) { + MxAutoLocker locker(&m_criticalSection); + MxResult result = FAILURE; + MxDSAction* action = m_unkList0x3c.Find(p_unknown, TRUE); + if (action != NULL) { + MxNextActionDataStart* data = m_nextActionList.Find(action->GetObjectId(), action->GetUnknown24()); + delete action; + delete data; + result = SUCCESS; + } + return result; +} + +// STUB: LEGO1 0x100c1f00 +MxResult MxStreamController::FUN_100c1f00(MxDSAction* p_action) +{ + // TODO return FAILURE; } diff --git a/LEGO1/mxstreamcontroller.h b/LEGO1/mxstreamcontroller.h index 80ff9e35..767b4cba 100644 --- a/LEGO1/mxstreamcontroller.h +++ b/LEGO1/mxstreamcontroller.h @@ -36,14 +36,15 @@ class MxStreamController : public MxCore { virtual MxResult vtable0x18(undefined4 p_unknown, undefined4 p_unknown2); // vtable+0x18 virtual MxResult vtable0x1C(undefined4 p_unknown, undefined4 p_unknown2); // vtable+0x1c virtual MxResult vtable0x20(MxDSAction* p_action); // vtable+0x20 - virtual MxResult vtable0x24(undefined4 p_unknown); // vtable+0x24 + virtual MxResult vtable0x24(MxDSAction* p_unknown); // vtable+0x24 MxResult FUN_100c1800(MxDSAction* p_action, MxU32 p_val); virtual MxResult vtable0x28(); // vtable+0x28 virtual MxResult vtable0x2c(MxDSAction* p_action, MxU32 p_bufferval); // vtable+0x2c - virtual MxResult vtable0x30(undefined4 p_unknown); // vtable+0x30 + virtual MxResult vtable0x30(MxDSAction* p_unknown); // vtable+0x30 MxBool FUN_100c20d0(MxDSObject& p_obj); MxResult FUN_100c1a00(MxDSAction* p_action, MxU32 p_bufferval); + MxResult FUN_100c1f00(MxDSAction* p_action); inline MxAtomId& GetAtom() { return atom; };