From 403b3dddb42917d0ced41b6f966c4deee7e19430 Mon Sep 17 00:00:00 2001 From: Misha <106913236+MishaProductions@users.noreply.github.com> Date: Wed, 13 Dec 2023 16:44:14 -0500 Subject: [PATCH] Implement MxDiskStreamController::VTable0x20 (#325) * push code * fixes * Update mxdiskstreamcontroller.h * Update mxdsstreamingaction.h * Match MxDiskStreamController::VTable0x20 * Move declaration * Remove cast --------- Co-authored-by: Christian Semmler --- LEGO1/mxdiskstreamcontroller.cpp | 36 +++++++++++++++++++++++++++++--- LEGO1/mxdiskstreamcontroller.h | 3 +++ LEGO1/mxdsaction.h | 1 + LEGO1/mxdsobject.h | 2 ++ LEGO1/mxdsstreamingaction.h | 5 +++++ 5 files changed, 44 insertions(+), 3 deletions(-) diff --git a/LEGO1/mxdiskstreamcontroller.cpp b/LEGO1/mxdiskstreamcontroller.cpp index b9acfb9d..285b94e7 100644 --- a/LEGO1/mxdiskstreamcontroller.cpp +++ b/LEGO1/mxdiskstreamcontroller.cpp @@ -2,6 +2,7 @@ #include "mxautolocker.h" #include "mxdiskstreamprovider.h" +#include "mxdsstreamingaction.h" #include "mxomni.h" #include "mxticklemanager.h" @@ -71,11 +72,40 @@ MxResult MxDiskStreamController::VTable0x30(MxDSAction* p_action) return FAILURE; } -// STUB: LEGO1 0x100c7ff0 +// FUNCTION: LEGO1 0x100c7f40 +void MxDiskStreamController::FUN_100c7f40(MxDSStreamingAction* p_streamingaction) +{ + MxAutoLocker lock(&this->m_criticalSection); + if (p_streamingaction) { + m_list0x64.push_back(p_streamingaction); + } +} + +// FUNCTION: LEGO1 0x100c7ff0 MxResult MxDiskStreamController::VTable0x20(MxDSAction* p_action) { - // TODO - return FAILURE; + MxAutoLocker lock(&this->m_criticalSection); + MxDSStreamingAction* entry = + (MxDSStreamingAction*) m_list0x80.Find(p_action, FALSE); // TODO: is this a seperate class? + + if (entry) { + MxDSStreamingAction* action = new MxDSStreamingAction(*p_action, 0); + action->SetUnknown28(entry->GetUnknown28()); + action->SetUnknown84(entry->GetUnknown84()); + action->SetOrigin(entry->GetOrigin()); + action->SetUnknowna0(entry->GetUnknowna4()); + + FUN_100c7f40(action); + + if (VTable0x2c(p_action, entry->GetUnknown94()) != SUCCESS) + return FAILURE; + } + else if (MxStreamController::VTable0x20(p_action) != SUCCESS) + return FAILURE; + + m_unk0x70 = 1; + m_unk0xc4 = 1; + return SUCCESS; } // STUB: LEGO1 0x100c8160 diff --git a/LEGO1/mxdiskstreamcontroller.h b/LEGO1/mxdiskstreamcontroller.h index 2e320fa0..e77c75db 100644 --- a/LEGO1/mxdiskstreamcontroller.h +++ b/LEGO1/mxdiskstreamcontroller.h @@ -3,6 +3,7 @@ #include "decomp.h" #include "mxdsbuffer.h" +#include "mxdsstreamingaction.h" #include "mxstl/stlcompat.h" #include "mxstreamcontroller.h" #include "mxtypes.h" @@ -48,6 +49,8 @@ class MxDiskStreamController : public MxStreamController { MxCriticalSection m_critical9c; // 0x9c MxStreamListMxDSAction m_list0xb8; // 0xb8 undefined m_unk0xc4; // 0xc4 + + void FUN_100c7f40(MxDSStreamingAction* p_streamingaction); }; // TEMPLATE: LEGO1 0x100c7330 diff --git a/LEGO1/mxdsaction.h b/LEGO1/mxdsaction.h index 94421b1f..6ea57a4a 100644 --- a/LEGO1/mxdsaction.h +++ b/LEGO1/mxdsaction.h @@ -63,6 +63,7 @@ class MxDSAction : public MxDSObject { inline MxS32 GetLoopCount() { return m_loopCount; } inline void SetLoopCount(MxS32 p_loopCount) { m_loopCount = p_loopCount; } inline const Vector3Data& GetLocation() const { return m_location; } + inline MxCore* GetUnknown84() { return m_unk0x84; } inline void SetUnknown84(MxCore* p_unk0x84) { m_unk0x84 = p_unk0x84; } inline MxCore* GetOrigin() { return m_origin; } inline void SetOrigin(MxCore* p_origin) { m_origin = p_origin; } diff --git a/LEGO1/mxdsobject.h b/LEGO1/mxdsobject.h index 3f47f13e..dfa967cf 100644 --- a/LEGO1/mxdsobject.h +++ b/LEGO1/mxdsobject.h @@ -38,10 +38,12 @@ class MxDSObject : public MxCore { inline MxU32 GetObjectId() { return this->m_objectId; } inline const MxAtomId& GetAtomId() { return this->m_atomId; } inline MxS16 GetUnknown24() { return this->m_unk0x24; } + inline undefined4 GetUnknown28() { return this->m_unk0x28; } inline void SetType(MxDSType p_type) { this->m_type = p_type; } inline void SetObjectId(MxU32 p_objectId) { this->m_objectId = p_objectId; } inline void SetUnknown24(MxS16 p_unk0x24) { this->m_unk0x24 = p_unk0x24; } + inline void SetUnknown28(undefined4 p_unk0x28) { this->m_unk0x28 = p_unk0x28; } private: MxU32 m_sizeOnDisk; // 0x8 diff --git a/LEGO1/mxdsstreamingaction.h b/LEGO1/mxdsstreamingaction.h index 63c22b8d..4e5f0979 100644 --- a/LEGO1/mxdsstreamingaction.h +++ b/LEGO1/mxdsstreamingaction.h @@ -31,6 +31,11 @@ class MxDSStreamingAction : public MxDSAction { void SetInternalAction(MxDSAction* p_dsAction); void FUN_100cd2d0(); + inline MxU32 GetUnknown94() { return m_unk0x94; } + inline MxDSBuffer* GetUnknowna0() { return m_unk0xa0; } + inline MxDSBuffer* GetUnknowna4() { return m_unk0xa4; } + inline void SetUnknowna0(MxDSBuffer* p_unk0xa0) { m_unk0xa0 = p_unk0xa0; } + private: MxU32 m_unk0x94; MxU32 m_bufferOffset;