From 9f962b647708a9abe0cfbe54db682338bb7cb12d Mon Sep 17 00:00:00 2001 From: ricardoofnl Date: Thu, 3 Sep 2026 02:14:01 +0700 Subject: [PATCH] [saco] Match `CDownloadManager::FUNC_1000C010` and its empty worker proc; `_beginthread` per slot --- saco/net/downloader.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ saco/net/downloader.h | 1 + 2 files changed, 41 insertions(+) diff --git a/saco/net/downloader.cpp b/saco/net/downloader.cpp index ebed738..56059d5 100644 --- a/saco/net/downloader.cpp +++ b/saco/net/downloader.cpp @@ -2,6 +2,46 @@ //---------------------------------------------------- +// retail spawns the workers on an empty body +void __cdecl DownloadThreadProc(void *pParam) +{ +} + +//---------------------------------------------------- + +// spawns a worker for every idle slot and clears its request block +bool CDownloadManager::FUNC_1000C010() +{ + for(int i = 0; i < MAX_DOWNLOAD_SLOTS; i++) + { + if(m_Slots[i].field_6) + continue; + + m_Slots[i].dwThread = _beginthread(DownloadThreadProc, 0, &m_Slots[i]); + if(m_Slots[i].dwThread == -1) + { + m_Slots[i].field_6 = 0; + m_Slots[i].field_10D = 1; + m_Slots[i].field_10E = -1; + return false; + } + + m_Slots[i].field_10E = -1; + m_Slots[i].dwSlotId = i + 1; + m_Slots[i].field_6 = 1; + m_Slots[i].field_7 = 0; + m_Slots[i].field_4 = 0; + m_Slots[i].field_10D = 0; + memset(m_Slots[i].szPath, 0, sizeof(m_Slots[i].szPath)); + memset(m_Slots[i].Request, 0, sizeof(m_Slots[i].Request)); + } + + m_bSlotsReady = 1; + return true; +} + +//---------------------------------------------------- + // flags every slot for cancellation and drops the ready bit so the next // request re-spawns the workers void CDownloadManager::FUNC_1000C0C0() diff --git a/saco/net/downloader.h b/saco/net/downloader.h index 967bf94..8110373 100644 --- a/saco/net/downloader.h +++ b/saco/net/downloader.h @@ -31,6 +31,7 @@ public: BYTE m_bSlotsReady; DOWNLOAD_SLOT m_Slots[MAX_DOWNLOAD_SLOTS]; + bool FUNC_1000C010(); // .text:1000C010 void FUNC_1000C0C0(); // .text:1000C0C0 };