Add MxStreamController::~MxStreamController (#355)

This commit is contained in:
Christian Semmler 2023-12-24 08:52:26 -05:00 committed by GitHub
parent 24a3a8f3fd
commit bbe5d6f810
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 44 additions and 21 deletions

View file

@ -72,7 +72,7 @@ MxResult MxDiskStreamProvider::SetResourceToGet(MxStreamController* p_resource)
}
// STUB: LEGO1 0x100d15e0
void MxDiskStreamProvider::VTable0x20(undefined4)
void MxDiskStreamProvider::VTable0x20(MxDSAction* p_action)
{
// TODO
}

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -7,24 +7,23 @@
#include "mxstl/stlcompat.h"
template <class T>
class MxStreamList : public list<T> {};
class MxStreamList : public list<T> {
public:
MxBool PopFront(T& p_obj)
{
if (empty())
return FALSE;
p_obj = front();
pop_front();
return TRUE;
}
};
// SIZE 0xc
class MxStreamListMxDSAction : public MxStreamList<MxDSAction*> {
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

View file

@ -12,6 +12,6 @@ MxResult MxStreamProvider::SetResourceToGet(MxStreamController* p_resource)
}
// FUNCTION: LEGO1 0x100d07d0
void MxStreamProvider::VTable0x20(undefined4)
void MxStreamProvider::VTable0x20(MxDSAction* p_action)
{
}

View file

@ -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