From 42a82794a81bd4b2cd9248d7165640d1297fddd0 Mon Sep 17 00:00:00 2001 From: Misha <106913236+MishaProductions@users.noreply.github.com> Date: Sun, 5 Nov 2023 10:25:38 -0500 Subject: [PATCH] Implement MxStreamController::vtable0x2c (#265) * MxStreamController::vtable0x2c * Add size comment --------- Co-authored-by: Christian Semmler --- LEGO1/mxnextactiondatastart.h | 14 ++++++++++++++ LEGO1/mxstreamcontroller.cpp | 29 +++++++++++++++++++++++++++-- LEGO1/mxstreamcontroller.h | 8 +++++--- 3 files changed, 46 insertions(+), 5 deletions(-) diff --git a/LEGO1/mxnextactiondatastart.h b/LEGO1/mxnextactiondatastart.h index cf38242c..1ef99a70 100644 --- a/LEGO1/mxnextactiondatastart.h +++ b/LEGO1/mxnextactiondatastart.h @@ -4,8 +4,17 @@ #include "mxcore.h" // VTABLE 0x100dc9a0 +// SIZE 0x14 class MxNextActionDataStart : public MxCore { public: + // inlined constructor at 0x100c1847 + inline MxNextActionDataStart(MxU32 p_objectId, MxS16 p_unk24val, MxU32 p_data) + { + m_objectId = p_objectId; + m_unk24val = p_unk24val; + m_data = p_data; + } + // OFFSET: LEGO1 0x100c1900 inline virtual const char* ClassName() const override // vtable+0xc { @@ -18,6 +27,11 @@ class MxNextActionDataStart : public MxCore { { return !strcmp(name, MxNextActionDataStart::ClassName()) || MxCore::IsA(name); } + +private: + MxU32 m_objectId; + MxS16 m_unk24val; + MxU32 m_data; }; #endif // MXNEXTACTIONDATASTART_H diff --git a/LEGO1/mxstreamcontroller.cpp b/LEGO1/mxstreamcontroller.cpp index 72f77b33..1fb3ae03 100644 --- a/LEGO1/mxstreamcontroller.cpp +++ b/LEGO1/mxstreamcontroller.cpp @@ -2,6 +2,9 @@ #include "legoomni.h" #include "mxautolocker.h" +#include "mxnextactiondatastart.h" + +DECOMP_SIZE_ASSERT(MxNextActionDataStart, 0x14) // OFFSET: LEGO1 0x100c0b90 STUB MxStreamController::MxStreamController() @@ -74,16 +77,32 @@ MxResult MxStreamController::vtable0x24(undefined4 p_unknown) return FAILURE; } +// OFFSET: LEGO1 0x100c1800 STUB +MxResult MxStreamController::FUN_100c1800(MxDSAction* p_action, MxU32 p_val) +{ + MxNextActionDataStart* dataActionStart = + new MxNextActionDataStart(p_action->GetObjectId(), p_action->GetUnknown24(), p_val); + if (dataActionStart == NULL) { + return FAILURE; + } + // TODO: insert dataActionStart to a list + return FAILURE; +} + // OFFSET: LEGO1 0x100b9420 MxResult MxStreamController::vtable0x28() { return SUCCESS; } -// OFFSET: LEGO1 0x100c1c10 STUB +// OFFSET: LEGO1 0x100c1c10 MxResult MxStreamController::vtable0x2c(MxDSAction* p_action, MxU32 p_bufferval) { - return FAILURE; + MxAutoLocker locker(&m_criticalSection); + if (FUN_100c1a00(p_action, p_bufferval) != SUCCESS) { + return FAILURE; + } + return FUN_100c1800(p_action, (p_bufferval / m_provider->GetFileSize()) * m_provider->GetFileSize()); } // OFFSET: LEGO1 0x100c1ce0 STUB @@ -91,3 +110,9 @@ MxResult MxStreamController::vtable0x30(undefined4 p_unknown) { return FAILURE; } + +// OFFSET: LEGO1 0x100c1a00 STUB +MxResult MxStreamController::FUN_100c1a00(MxDSAction* p_action, MxU32 p_bufferval) +{ + return FAILURE; +} diff --git a/LEGO1/mxstreamcontroller.h b/LEGO1/mxstreamcontroller.h index 4bee2f4c..6422d12d 100644 --- a/LEGO1/mxstreamcontroller.h +++ b/LEGO1/mxstreamcontroller.h @@ -35,11 +35,13 @@ class MxStreamController : public MxCore { 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 vtable0x28(); // vtable+0x28 - virtual MxResult vtable0x2c(MxDSAction* p_action, MxU32 p_bufferval); // vtable+0x2c - virtual MxResult vtable0x30(undefined4 p_unknown); // vtable+0x30 + 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 MxBool FUN_100c20d0(MxDSObject& p_obj); + MxResult FUN_100c1a00(MxDSAction* p_action, MxU32 p_bufferval); inline MxAtomId& GetAtom() { return atom; };