From 22d45d27e562de4f4b6bda35b57d8d430aa86d71 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Thu, 12 Nov 2026 11:08:06 +0000 Subject: [PATCH] Decompile fn_19321 (ReplayFileList::Refresh) Batch #18000 by eAthena: 0 byte-identical, 1 confirmed by peer review. - fn_19321 ReplayFileList::Refresh: logic confirmed by peer review Peer-reviewed-by: ragnarok-clanker, Yommy, bibinir Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Client/Replay/Replay.cpp | 15 ++++++++------- Source/Client/Replay/Replay.h | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Source/Client/Replay/Replay.cpp b/Source/Client/Replay/Replay.cpp index 339358c14..74825ea06 100644 --- a/Source/Client/Replay/Replay.cpp +++ b/Source/Client/Replay/Replay.cpp @@ -639,28 +639,28 @@ __declspec(noinline) void ReplayFileList::Clear() { // OFFSET: 0x00B84B60 // FUNCTION: fn_19321 -void ReplayFileList::Refresh() { +bool ReplayFileList::Refresh() { this->Clear(); + BOOL more = TRUE; char directory[260] = {}; GetCurrentDirectoryA(sizeof(directory), directory); - std::string pattern(directory, std::strlen(directory)); + std::string pattern(directory); pattern.append("\\Replay\\*.rrf", 13); WIN32_FIND_DATAA found; HANDLE search = FindFirstFileA(pattern.c_str(), &found); if (search != INVALID_HANDLE_VALUE) { - BOOL more = TRUE; - while (more) { if ((found.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) { - const std::size_t length = std::strlen(found.cFileName); - const char* extension = found.cFileName + length - 4; + const char* extension = found.cFileName + std::strlen(found.cFileName) - 4; + const BOOL isReplay = extension[3] == 'f' && extension[2] == 'r' && extension[1] == 'r' && extension[0] == '.'; - if (extension[0] == '.' && extension[1] == 'r' && extension[2] == 'r' && extension[3] == 'f') { + if (isReplay) { ReplayFileEntry entry = {}; + const std::size_t length = std::strlen(found.cFileName); std::memcpy(entry.name, found.cFileName, length); entry.name[length] = '\0'; entry.index = 0; @@ -680,6 +680,7 @@ void ReplayFileList::Refresh() { } FindClose(search); + return true; } // OFFSET: 0x00B84300 diff --git a/Source/Client/Replay/Replay.h b/Source/Client/Replay/Replay.h index 2cb09443e..6603b68bf 100644 --- a/Source/Client/Replay/Replay.h +++ b/Source/Client/Replay/Replay.h @@ -200,7 +200,7 @@ public: } void Clear(); - void Refresh(); + bool Refresh(); const char* FileName(int index) const; char* SetPath(const char* value); bool Select(int index);