diff --git a/source/dllmain.cpp b/source/dllmain.cpp index 2a45be4..520171d 100644 --- a/source/dllmain.cpp +++ b/source/dllmain.cpp @@ -882,6 +882,52 @@ std::filesystem::path WINAPI GetOverloadedFilePath(std::filesystem::path lpFilen return {}; } +bool WINAPI GetOverloadedFilePathA(const char* lpFilename, char* out, size_t out_size) +{ + try + { + if (!sFileLoaderPath.empty()) + { + auto path = GetOverloadedFilePath(lpFilename); + if (!path.empty()) + { + if (out && out_size) + { + if (!std::filesystem::path(lpFilename).is_absolute()) + path = lexicallyRelativeCaseIns(path, gamePath); + out[path.string().copy(out, out_size, 0)] = '\0'; + } + return true; + } + } + } + catch (...) {} + return false; +} + +bool WINAPI GetOverloadedFilePathW(const wchar_t* lpFilename, wchar_t* out, size_t out_size) +{ + try + { + if (!sFileLoaderPath.empty()) + { + auto path = GetOverloadedFilePath(lpFilename); + if (!path.empty()) + { + if (out && out_size) + { + if (!std::filesystem::path(lpFilename).is_absolute()) + path = lexicallyRelativeCaseIns(path, gamePath); + out[path.wstring().copy(out, out_size, 0)] = '\0'; + } + return true; + } + } + } + catch (...) {} + return false; +} + std::filesystem::path GetFilePathForOverload(auto path) { try diff --git a/source/x64.def b/source/x64.def index 6ee2a2c..f75a3a0 100644 --- a/source/x64.def +++ b/source/x64.def @@ -1,7 +1,8 @@ LIBRARY "UAL" EXPORTS IsUltimateASILoader = IsUltimateASILoader -GetOverloadedFilePath = GetOverloadedFilePath +GetOverloadedFilePathA = GetOverloadedFilePathA +GetOverloadedFilePathW = GetOverloadedFilePathW GetMemoryModule = GetMemoryModule LIBRARY "dinput8" diff --git a/source/x86.def b/source/x86.def index f85f792..eee540c 100644 --- a/source/x86.def +++ b/source/x86.def @@ -1,7 +1,8 @@ LIBRARY "UAL" EXPORTS IsUltimateASILoader = IsUltimateASILoader -GetOverloadedFilePath = GetOverloadedFilePath +GetOverloadedFilePathA = GetOverloadedFilePathA +GetOverloadedFilePathW = GetOverloadedFilePathW GetMemoryModule = GetMemoryModule LIBRARY "vorbisfile"