From d403ff70b53aab2a0cebc1776fb8a4c4d26f94b6 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Mon, 25 Dec 2023 11:30:49 -0500 Subject: [PATCH] Mostly match MxDiskStreamController::FUN_100c8540 --- LEGO1/mxdiskstreamcontroller.cpp | 25 +++++++++++++------------ LEGO1/mxnextactiondatastart.h | 6 +++--- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/LEGO1/mxdiskstreamcontroller.cpp b/LEGO1/mxdiskstreamcontroller.cpp index f7316cd8..a1e7d7ff 100644 --- a/LEGO1/mxdiskstreamcontroller.cpp +++ b/LEGO1/mxdiskstreamcontroller.cpp @@ -60,11 +60,10 @@ MxResult MxDiskStreamController::FUN_100c7890(MxDSStreamingAction* p_action) if (p_action == NULL) { return FAILURE; } - else { - m_list0x80.push_back(p_action); - FUN_100c7970(); - return SUCCESS; - } + + m_list0x80.push_back(p_action); + FUN_100c7970(); + return SUCCESS; } // FUNCTION: LEGO1 0x100c7960 @@ -216,6 +215,7 @@ MxDSStreamingAction* MxDiskStreamController::FUN_100c7db0() streamingAction->GetUnknown24() == data->GetUnknown24() && streamingAction->GetBufferOffset() == data->GetData()) { m_nextActionList.erase(it); + data->SetData(m_provider->GetFileSize() + data->GetData()); m_nextActionList.push_back(data); @@ -339,21 +339,22 @@ void MxDiskStreamController::InsertToList74(MxDSBuffer* p_buffer) void MxDiskStreamController::FUN_100c8540() { MxAutoLocker lock(&this->m_criticalSection); - for (list::iterator it = m_list0x74.begin(); it != m_list0x74.end(); it++) { + for (list::iterator it = m_list0x74.begin(); it != m_list0x74.end();) { MxDSBuffer* buf = *it; if (buf->GetRefCount() == 0) { - m_list0x74.erase(it); + m_list0x74.erase(it++); FUN_100c7ce0(buf); } + else + it++; } - if (m_nextActionList.size() == 0 && m_list0x64.size() != 0) { - do { + if (m_nextActionList.empty()) { + while (!m_list0x64.empty()) { MxDSStreamingAction* action = (MxDSStreamingAction*) m_list0x64.front(); - m_list0xb8.pop_front(); - + m_list0x64.pop_front(); FUN_100c7cb0(action); - } while (m_list0x64.size() != 0); + } } } diff --git a/LEGO1/mxnextactiondatastart.h b/LEGO1/mxnextactiondatastart.h index 09510a17..6da9d764 100644 --- a/LEGO1/mxnextactiondatastart.h +++ b/LEGO1/mxnextactiondatastart.h @@ -34,9 +34,9 @@ class MxNextActionDataStart : public MxCore { inline void SetData(MxU32 p_data) { m_data = p_data; } private: - MxU32 m_objectId; - MxS16 m_unk0x24; - MxU32 m_data; + MxU32 m_objectId; // 0x8 + MxS16 m_unk0x24; // 0xc + MxU32 m_data; // 0x10 }; #endif // MXNEXTACTIONDATASTART_H