MxDiskStreamProvider constructor (#131)

* MxDiskStreamProvider constructor

* Add work-in-progress list struct to MxDiskStreamProvider

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Joshua Peisach
2023-09-29 17:53:02 -04:00
committed by GitHub
parent 0dc8dd641a
commit 06c7ba2c37
3 changed files with 45 additions and 11 deletions

View File

@@ -2,6 +2,8 @@
#include "mxthread.h" #include "mxthread.h"
DECOMP_SIZE_ASSERT(MxDiskStreamProvider, 0x60);
// OFFSET: LEGO1 0x100d0f30 // OFFSET: LEGO1 0x100d0f30
MxResult MxDiskStreamProviderThread::Run() MxResult MxDiskStreamProviderThread::Run()
{ {
@@ -15,7 +17,9 @@ MxResult MxDiskStreamProviderThread::Run()
// OFFSET: LEGO1 0x100d0f70 // OFFSET: LEGO1 0x100d0f70
MxDiskStreamProvider::MxDiskStreamProvider() MxDiskStreamProvider::MxDiskStreamProvider()
{ {
// TODO this->m_pFile = NULL;
this->m_remainingWork = 0;
this->m_unk35 = 0;
} }
// OFFSET: LEGO1 0x100d1240 // OFFSET: LEGO1 0x100d1240
@@ -31,7 +35,7 @@ MxResult MxDiskStreamProvider::WaitForWorkToComplete()
while (m_remainingWork != 0) while (m_remainingWork != 0)
{ {
m_busySemaphore.Wait(INFINITE); m_busySemaphore.Wait(INFINITE);
if (m_unk1 != 0) if (m_unk35 != 0)
PerformWork(); PerformWork();
} }
return SUCCESS; return SUCCESS;

View File

@@ -1,6 +1,7 @@
#ifndef MXDISKSTREAMPROVIDER_H #ifndef MXDISKSTREAMPROVIDER_H
#define MXDISKSTREAMPROVIDER_H #define MXDISKSTREAMPROVIDER_H
#include "decomp.h"
#include "mxstreamprovider.h" #include "mxstreamprovider.h"
#include "mxthread.h" #include "mxthread.h"
#include "mxcriticalsection.h" #include "mxcriticalsection.h"
@@ -22,6 +23,32 @@ private:
MxDiskStreamProvider *m_target; 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 // VTABLE 0x100dd138
class MxDiskStreamProvider : public MxStreamProvider class MxDiskStreamProvider : public MxStreamProvider
{ {
@@ -48,14 +75,12 @@ public:
void PerformWork(); void PerformWork();
private: private:
MxDiskStreamProviderThread m_thread; MxDiskStreamProviderThread m_thread; // 0x10
MxSemaphore m_busySemaphore; MxSemaphore m_busySemaphore; // 0x2c
byte m_remainingWork; undefined m_remainingWork; // 0x34
byte m_unk1; undefined m_unk35; // 0x35
MxCriticalSection m_criticalSection; MxCriticalSection m_criticalSection; // 0x38
byte unk2[4]; MxDiskStreamList m_list;
void* unk3;
void *unk4;
}; };
#endif // MXDISKSTREAMPROVIDER_H #endif // MXDISKSTREAMPROVIDER_H

View File

@@ -8,6 +8,11 @@
class MxStreamProvider : public MxCore class MxStreamProvider : public MxCore
{ {
public: public:
inline MxStreamProvider() {
this->m_pLookup = NULL;
this->m_pFile = NULL;
}
// OFFSET: LEGO1 0x100d07e0 // OFFSET: LEGO1 0x100d07e0
inline virtual const char *ClassName() const override // vtable+0x0c inline virtual const char *ClassName() const override // vtable+0x0c
{ {
@@ -20,7 +25,7 @@ public:
return !strcmp(name, MxStreamProvider::ClassName()) || MxCore::IsA(name); return !strcmp(name, MxStreamProvider::ClassName()) || MxCore::IsA(name);
} }
private: protected:
void *m_pLookup; void *m_pLookup;
MxDSFile* m_pFile; MxDSFile* m_pFile;
}; };