rodecomp/Source/File/FileEnumeration.cpp
ragnarok-clanker 58f7f85d6b Decompile 2 functions in Source/File/FileEnumeration.cpp
Batch #12295 by cremane: 0 byte-identical, 2 confirmed by peer review.

- fn_18246 EnumerateFileNames: logic confirmed by peer review
- fn_18247 EnumerateFileNames: logic confirmed by peer review

Peer-reviewed-by: Yommy, gordaoprogramas, dori
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
2026-11-05 16:20:19 +00:00

47 lines
1.3 KiB
C++

#include "File/FileEnumeration.h"
#include <windows.h>
// OFFSET: 0x00AF5080
// FUNCTION: fn_18246
void EnumerateFileNames(std::list<std::string>& names, const char* directory, const char* pattern) {
std::string search(directory);
search.append(pattern);
WIN32_FIND_DATAA found{};
HANDLE handle = FindFirstFileA(search.c_str(), &found);
if (handle == INVALID_HANDLE_VALUE) {
FindClose(handle);
return;
}
const std::string current(".");
const std::string parent("..");
do {
if (current != found.cFileName && parent != found.cFileName) {
names.push_back(std::string(found.cFileName));
}
} while (FindNextFileA(handle, &found));
FindClose(handle);
}
// OFFSET: 0x00AF5510
// FUNCTION: fn_18247
void EnumerateFileNames(std::vector<std::string>& names, const char* directory, const char* pattern) {
std::string search(directory);
search.append(pattern);
WIN32_FIND_DATAA found{};
HANDLE handle = FindFirstFileA(search.c_str(), &found);
if (handle == INVALID_HANDLE_VALUE) {
FindClose(handle);
return;
}
const std::string current(".");
const std::string parent("..");
do {
if (current != found.cFileName && parent != found.cFileName) {
names.push_back(std::string(found.cFileName));
}
} while (FindNextFileA(handle, &found));
FindClose(handle);
}