diff --git a/LEGO1/mxdiskstreamprovider.cpp b/LEGO1/mxdiskstreamprovider.cpp index dfdf8158..e55287fd 100644 --- a/LEGO1/mxdiskstreamprovider.cpp +++ b/LEGO1/mxdiskstreamprovider.cpp @@ -72,7 +72,7 @@ MxResult MxDiskStreamProvider::SetResourceToGet(MxStreamController* p_resource) } // STUB: LEGO1 0x100d15e0 -void MxDiskStreamProvider::VTable0x20(undefined4) +void MxDiskStreamProvider::VTable0x20(MxDSAction* p_action) { // TODO } diff --git a/LEGO1/mxdiskstreamprovider.h b/LEGO1/mxdiskstreamprovider.h index b5a2e9ff..55d4f0f2 100644 --- a/LEGO1/mxdiskstreamprovider.h +++ b/LEGO1/mxdiskstreamprovider.h @@ -50,7 +50,7 @@ class MxDiskStreamProvider : public MxStreamProvider { virtual MxResult SetResourceToGet(MxStreamController* p_resource) override; // vtable+0x14 virtual MxU32 GetFileSize() override; // vtable+0x18 virtual MxS32 GetStreamBuffersNum() override; // vtable+0x1c - virtual void VTable0x20(undefined4) override; // vtable+0x20 + virtual void VTable0x20(MxDSAction* p_action) override; // vtable+0x20 virtual MxU32 GetLengthInDWords() override; // vtable+0x24 virtual MxU32* GetBufferForDWords() override; // vtable+0x28 diff --git a/LEGO1/mxstreamcontroller.cpp b/LEGO1/mxstreamcontroller.cpp index f97a7e76..ed681b8c 100644 --- a/LEGO1/mxstreamcontroller.cpp +++ b/LEGO1/mxstreamcontroller.cpp @@ -31,14 +31,37 @@ MxDSStreamingAction* MxStreamController::VTable0x28() MxStreamController::MxStreamController() { m_provider = NULL; - m_unk0x2c = 0; // TODO: probably also NULL + m_unk0x2c = NULL; m_action0x60 = NULL; } -// STUB: LEGO1 0x100c1290 +// FUNCTION: LEGO1 0x100c1290 MxStreamController::~MxStreamController() { - // TODO + MxAutoLocker lock(&m_criticalSection); + + MxDSSubscriber* subscriber; + while (m_subscriberList.PopFront(subscriber)) + delete subscriber; + + MxDSAction* action; + while (m_unk0x3c.PopFront(action)) + delete action; + + if (m_provider) { + MxStreamProvider* provider = m_provider; + m_provider = NULL; + provider->VTable0x20(&MxDSAction()); + delete provider; + } + + if (m_unk0x2c) { + delete m_unk0x2c; + m_unk0x2c = NULL; + } + + while (m_unk0x54.PopFront(action)) + delete action; } // FUNCTION: LEGO1 0x100c1520 diff --git a/LEGO1/mxstreamcontroller.h b/LEGO1/mxstreamcontroller.h index ce204aa4..d3310338 100644 --- a/LEGO1/mxstreamcontroller.h +++ b/LEGO1/mxstreamcontroller.h @@ -59,7 +59,7 @@ class MxStreamController : public MxCore { MxCriticalSection m_criticalSection; // 0x8 MxAtomId m_atom; // 0x24 MxStreamProvider* m_provider; // 0x28 - undefined4 m_unk0x2c; // 0x2c + undefined4* m_unk0x2c; // 0x2c MxStreamListMxDSSubscriber m_subscriberList; // 0x30 MxStreamListMxDSAction m_unk0x3c; // 0x3c MxStreamListMxNextActionDataStart m_nextActionList; // 0x48 diff --git a/LEGO1/mxstreamlist.h b/LEGO1/mxstreamlist.h index abe48779..9b65c53d 100644 --- a/LEGO1/mxstreamlist.h +++ b/LEGO1/mxstreamlist.h @@ -7,24 +7,23 @@ #include "mxstl/stlcompat.h" template -class MxStreamList : public list {}; +class MxStreamList : public list { +public: + MxBool PopFront(T& p_obj) + { + if (empty()) + return FALSE; + + p_obj = front(); + pop_front(); + return TRUE; + } +}; // SIZE 0xc class MxStreamListMxDSAction : public MxStreamList { public: MxDSAction* Find(MxDSAction* p_action, MxBool p_delete); - - // Could move this to MxStreamList - MxBool PopFront(MxDSAction*& p_obj) - { - if (!empty()) { - p_obj = front(); - pop_front(); - return TRUE; - } - - return FALSE; - } }; // SIZE 0xc diff --git a/LEGO1/mxstreamprovider.cpp b/LEGO1/mxstreamprovider.cpp index 9d77121b..740b2c65 100644 --- a/LEGO1/mxstreamprovider.cpp +++ b/LEGO1/mxstreamprovider.cpp @@ -12,6 +12,6 @@ MxResult MxStreamProvider::SetResourceToGet(MxStreamController* p_resource) } // FUNCTION: LEGO1 0x100d07d0 -void MxStreamProvider::VTable0x20(undefined4) +void MxStreamProvider::VTable0x20(MxDSAction* p_action) { } diff --git a/LEGO1/mxstreamprovider.h b/LEGO1/mxstreamprovider.h index 66f75be2..ecbe9ab4 100644 --- a/LEGO1/mxstreamprovider.h +++ b/LEGO1/mxstreamprovider.h @@ -6,6 +6,7 @@ #include "mxdsfile.h" class MxStreamController; +class MxDSAction; // VTABLE: LEGO1 0x100dd100 // SIZE 0x10 @@ -28,7 +29,7 @@ class MxStreamProvider : public MxCore { virtual MxResult SetResourceToGet(MxStreamController* p_resource); // vtable+0x14 virtual MxU32 GetFileSize() = 0; // vtable+0x18 virtual MxS32 GetStreamBuffersNum() = 0; // vtable+0x1c - virtual void VTable0x20(undefined4); // vtable+0x20 + virtual void VTable0x20(MxDSAction* p_action); // vtable+0x20 virtual MxU32 GetLengthInDWords() = 0; // vtable+0x24 virtual MxU32* GetBufferForDWords() = 0; // vtable+0x28