Mostly match MxDiskStreamProvider::FUN_100d1780

This commit is contained in:
Christian Semmler 2023-12-25 12:00:31 -05:00
parent d403ff70b5
commit 503941c11a
4 changed files with 28 additions and 27 deletions

View File

@ -341,6 +341,7 @@ void MxDiskStreamController::FUN_100c8540()
MxAutoLocker lock(&this->m_criticalSection);
for (list<MxDSBuffer*>::iterator it = m_list0x74.begin(); it != m_list0x74.end();) {
MxDSBuffer* buf = *it;
// TODO: Match
if (buf->GetRefCount() == 0) {
m_list0x74.erase(it++);
FUN_100c7ce0(buf);

View File

@ -96,34 +96,35 @@ MxResult MxDiskStreamProvider::WaitForWorkToComplete()
// FUNCTION: LEGO1 0x100d1780
MxResult MxDiskStreamProvider::FUN_100d1780(MxDSStreamingAction* p_action)
{
if (m_remainingWork != 0) {
if (p_action->GetUnknown94() > 0 && !p_action->GetUnknowna0()) {
MxDSBuffer* buffer = new MxDSBuffer();
if (buffer) {
if (buffer->AllocateBuffer(GetFileSize(), MxDSBufferType_Allocate) == SUCCESS) {
p_action->SetUnknowna0(buffer);
}
else {
delete buffer;
return FAILURE;
}
}
if (m_remainingWork == 0)
return FAILURE;
if (p_action->GetUnknown9c() > 0 && !p_action->GetUnknowna0()) {
MxDSBuffer* buffer = new MxDSBuffer();
if (!buffer)
return FAILURE;
if (buffer->AllocateBuffer(GetFileSize(), MxDSBufferType_Allocate) != SUCCESS) {
delete buffer;
return FAILURE;
}
if (p_action->GetUnknowna0()->GetWriteOffset() < 0x20000) {
g_unk0x10102878++;
}
{
MxAutoLocker lock(&m_criticalSection);
m_list.push_back(p_action);
}
m_unk0x35 = 1;
m_busySemaphore.Release(1);
return SUCCESS;
p_action->SetUnknowna0(buffer);
}
return FAILURE;
if (p_action->GetUnknowna0()->GetWriteOffset() < 0x20000) {
g_unk0x10102878++;
}
{
MxAutoLocker lock(&m_criticalSection);
m_list.push_back(p_action);
}
m_unk0x35 = 1;
m_busySemaphore.Release(1);
return SUCCESS;
}
// FUNCTION: LEGO1 0x100d18f0

View File

@ -27,7 +27,6 @@ class MxDiskStreamProviderThread : public MxThread {
class MxDiskStreamProvider : public MxStreamProvider {
public:
MxDiskStreamProvider();
virtual ~MxDiskStreamProvider() override;
// FUNCTION: LEGO1 0x100d1160

View File

@ -32,7 +32,7 @@ class MxDSStreamingAction : public MxDSAction {
void FUN_100cd2d0();
inline MxU32 GetUnknown94() { return m_unk0x94; }
inline MxU32 GetUnknown9c() { return m_unk0x9c; }
inline MxS32 GetUnknown9c() { return m_unk0x9c; }
inline MxDSBuffer* GetUnknowna0() { return m_unk0xa0; }
inline MxDSBuffer* GetUnknowna4() { return m_unk0xa4; }
inline MxDSAction* GetInternalAction() { return m_internalAction; }