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).
This commit is contained in:
ragnarok-clanker 2026-11-12 11:08:06 +00:00
commit 22d45d27e5
2 changed files with 9 additions and 8 deletions

View file

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

View file

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