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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 11 deletions

View file

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

View file

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

View file

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