Decompile 2 functions in Source/File/FileEnumeration.cpp, Source/File/FileEnumeration.h
Batch #868 by ragnarok-clanker: 0 byte-identical, 2 confirmed by peer review. - fn_18246 EnumerateFileNames: logic confirmed by peer review - fn_18247 EnumerateFileNames: logic confirmed by peer review Reviewed-by: ragnarok-clanker Adds to the build: Source/File/FileEnumeration.cpp
This commit is contained in:
parent
bf6a44c117
commit
0b7a9c54d5
3 changed files with 61 additions and 6 deletions
43
Source/File/FileEnumeration.cpp
Normal file
43
Source/File/FileEnumeration.cpp
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
#include "File/FileEnumeration.h"
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
do {
|
||||
if (found.cFileName[0] == '.' && (found.cFileName[1] == 0 || (found.cFileName[1] == '.' && found.cFileName[2] == 0))) {
|
||||
continue;
|
||||
}
|
||||
names.push_back(std::string(found.cFileName));
|
||||
} while (FindNextFileA(handle, &found));
|
||||
FindClose(handle);
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
do {
|
||||
if (found.cFileName[0] == '.' && (found.cFileName[1] == 0 || (found.cFileName[1] == '.' && found.cFileName[2] == 0))) {
|
||||
continue;
|
||||
}
|
||||
names.push_back(std::string(found.cFileName));
|
||||
} while (FindNextFileA(handle, &found));
|
||||
FindClose(handle);
|
||||
}
|
||||
11
Source/File/FileEnumeration.h
Normal file
11
Source/File/FileEnumeration.h
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#ifndef RAGNAROK_SOURCE_FILE_FILEENUMERATION_H
|
||||
#define RAGNAROK_SOURCE_FILE_FILEENUMERATION_H
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
void EnumerateFileNames(std::list<std::string>& names, const char* directory, const char* pattern);
|
||||
void EnumerateFileNames(std::vector<std::string>& names, const char* directory, const char* pattern);
|
||||
|
||||
#endif
|
||||
13
compile.json
13
compile.json
|
|
@ -387,6 +387,7 @@
|
|||
"Source/Contents/World/WorldViewSpatial.cpp": 3,
|
||||
"Source/File/CommonObject.cpp": 1,
|
||||
"Source/File/File.cpp": 1,
|
||||
"Source/File/FileEnumeration.cpp": 1,
|
||||
"Source/File/MapName.cpp": 1,
|
||||
"Source/File/ResourcePath.cpp": 1,
|
||||
"Source/File/ShortcutFilename.cpp": 1,
|
||||
|
|
@ -582,18 +583,20 @@
|
|||
"Source/Utility/Async/NMessageQueue.cpp": 0,
|
||||
"Source/Utility/Async/NObject.cpp": 0,
|
||||
"Source/Utility/Async/NRecycleObjectPoolMgr.cpp": 0,
|
||||
"Source/Utility/Text/Base64.cpp": 0,
|
||||
"Source/Utility/Cipher/Rijndael.cpp": 0,
|
||||
"Source/Utility/Cipher/XorBytes.cpp": 0,
|
||||
"Source/Utility/GuidParse.cpp": 0,
|
||||
"Source/Utility/Hash/MD5.cpp": 0,
|
||||
"Source/Utility/Hash/XxHash32.cpp": 0,
|
||||
"Source/Utility/Lexicon/LexiconBoundary.cpp": 0,
|
||||
"Source/Utility/Lexicon/LexiconMatcher.cpp": 0,
|
||||
"Source/Utility/Lexicon/LexiconSerializer.cpp": 0,
|
||||
"Source/Utility/Hash/MD5.cpp": 0,
|
||||
"Source/Utility/Math/AffineLookAt.cpp": 0,
|
||||
"Source/Utility/Math/AffineMatrix.cpp": 0,
|
||||
"Source/Utility/Math/ClientAngles.cpp": 0,
|
||||
"Source/Utility/Math/RayTriangle.cpp": 0,
|
||||
"Source/Utility/Math/RadialGrid.cpp": 0,
|
||||
"Source/Utility/Cipher/Rijndael.cpp": 0,
|
||||
"Source/Utility/Math/RayTriangle.cpp": 0,
|
||||
"Source/Utility/Text/Base64.cpp": 0,
|
||||
"Source/Utility/Text/FormatString.cpp": 0,
|
||||
"Source/Utility/Text/GroupedInteger.cpp": 0,
|
||||
"Source/Utility/Text/LanguageCharset.cpp": 0,
|
||||
|
|
@ -602,8 +605,6 @@
|
|||
"Source/Utility/Threading/NSyncObject.cpp": 0,
|
||||
"Source/Utility/Threading/NThread.cpp": 0,
|
||||
"Source/Utility/Timestamp.cpp": 0,
|
||||
"Source/Utility/Cipher/XorBytes.cpp": 0,
|
||||
"Source/Utility/Hash/XxHash32.cpp": 0,
|
||||
"ThirdParty/jsoncpp/src/lib_json/json_reader.cpp": 8,
|
||||
"ThirdParty/jsoncpp/src/lib_json/json_value.cpp": 8,
|
||||
"ThirdParty/jsoncpp/src/lib_json/json_writer.cpp": 8,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue