From 06c7ba2c3787c764892f90c39c5f9cf47b71aef9 Mon Sep 17 00:00:00 2001 From: Joshua Peisach Date: Fri, 29 Sep 2023 17:53:02 -0400 Subject: [PATCH] MxDiskStreamProvider constructor (#131) * MxDiskStreamProvider constructor * Add work-in-progress list struct to MxDiskStreamProvider --------- Co-authored-by: Christian Semmler --- LEGO1/mxdiskstreamprovider.cpp | 8 +++++-- LEGO1/mxdiskstreamprovider.h | 41 +++++++++++++++++++++++++++------- LEGO1/mxstreamprovider.h | 7 +++++- 3 files changed, 45 insertions(+), 11 deletions(-) diff --git a/LEGO1/mxdiskstreamprovider.cpp b/LEGO1/mxdiskstreamprovider.cpp index 38d5cddc..4dcb02cf 100644 --- a/LEGO1/mxdiskstreamprovider.cpp +++ b/LEGO1/mxdiskstreamprovider.cpp @@ -2,6 +2,8 @@ #include "mxthread.h" +DECOMP_SIZE_ASSERT(MxDiskStreamProvider, 0x60); + // OFFSET: LEGO1 0x100d0f30 MxResult MxDiskStreamProviderThread::Run() { @@ -15,7 +17,9 @@ MxResult MxDiskStreamProviderThread::Run() // OFFSET: LEGO1 0x100d0f70 MxDiskStreamProvider::MxDiskStreamProvider() { - // TODO + this->m_pFile = NULL; + this->m_remainingWork = 0; + this->m_unk35 = 0; } // OFFSET: LEGO1 0x100d1240 @@ -31,7 +35,7 @@ MxResult MxDiskStreamProvider::WaitForWorkToComplete() while (m_remainingWork != 0) { m_busySemaphore.Wait(INFINITE); - if (m_unk1 != 0) + if (m_unk35 != 0) PerformWork(); } return SUCCESS; diff --git a/LEGO1/mxdiskstreamprovider.h b/LEGO1/mxdiskstreamprovider.h index 58679055..b6ff8c18 100644 --- a/LEGO1/mxdiskstreamprovider.h +++ b/LEGO1/mxdiskstreamprovider.h @@ -1,6 +1,7 @@ #ifndef MXDISKSTREAMPROVIDER_H #define MXDISKSTREAMPROVIDER_H +#include "decomp.h" #include "mxstreamprovider.h" #include "mxthread.h" #include "mxcriticalsection.h" @@ -22,6 +23,32 @@ private: MxDiskStreamProvider *m_target; }; +// TODO +struct MxDiskStreamListNode { + MxDiskStreamListNode *m_unk00; + MxDiskStreamListNode *m_unk04; + undefined4 m_unk08; +}; + +// TODO +struct MxDiskStreamList { + inline MxDiskStreamList() { + undefined unk; + this->m_unk00 = unk; + + MxDiskStreamListNode *node = new MxDiskStreamListNode(); + node->m_unk00 = node; + node->m_unk04 = node; + + this->m_head = node; + this->m_count = 0; + } + + undefined m_unk00; + MxDiskStreamListNode *m_head; + MxU32 m_count; +}; + // VTABLE 0x100dd138 class MxDiskStreamProvider : public MxStreamProvider { @@ -48,14 +75,12 @@ public: void PerformWork(); private: - MxDiskStreamProviderThread m_thread; - MxSemaphore m_busySemaphore; - byte m_remainingWork; - byte m_unk1; - MxCriticalSection m_criticalSection; - byte unk2[4]; - void* unk3; - void *unk4; + MxDiskStreamProviderThread m_thread; // 0x10 + MxSemaphore m_busySemaphore; // 0x2c + undefined m_remainingWork; // 0x34 + undefined m_unk35; // 0x35 + MxCriticalSection m_criticalSection; // 0x38 + MxDiskStreamList m_list; }; #endif // MXDISKSTREAMPROVIDER_H diff --git a/LEGO1/mxstreamprovider.h b/LEGO1/mxstreamprovider.h index b70b6446..2daf75ab 100644 --- a/LEGO1/mxstreamprovider.h +++ b/LEGO1/mxstreamprovider.h @@ -8,6 +8,11 @@ class MxStreamProvider : public MxCore { public: + inline MxStreamProvider() { + this->m_pLookup = NULL; + this->m_pFile = NULL; + } + // OFFSET: LEGO1 0x100d07e0 inline virtual const char *ClassName() const override // vtable+0x0c { @@ -20,7 +25,7 @@ public: return !strcmp(name, MxStreamProvider::ClassName()) || MxCore::IsA(name); } -private: +protected: void *m_pLookup; MxDSFile* m_pFile; };