Fixed unnecessary path searching for loading external wrapper

(ref. https://github.com/sfall-team/sfall/issues/504#issuecomment-1962314458)
This commit is contained in:
NovaRain
2024-02-24 20:47:31 +08:00
parent 3db8ed3381
commit c540ce8e72
2 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -1263,7 +1263,7 @@ void Graphics::init() {
if (!h) {
dlogr(" Failed", DL_INIT);
MessageBoxA(0, "You have selected DirectX graphics mode, but " _DLL_NAME " is missing.\n"
"Switch back to DirectDraw (Mode=0), or install an up to date version of DirectX 9.0c.", 0, MB_TASKMODAL | MB_ICONERROR);
"Switch back to DirectDraw (Mode=0), or install an up-to-date version of DirectX 9.0c.", 0, MB_TASKMODAL | MB_ICONERROR);
#undef _DLL_NAME
ExitProcess(-1);
}
+3 -2
View File
@@ -313,11 +313,12 @@ defaultIni:
static void LoadOriginalDll(DWORD fdwReason) {
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
ddraw.dll = LoadLibraryA("wrapper\\ddraw.dll"); // external DirectDraw wrapper
char path[MAX_PATH];
GetFullPathNameA("wrapper\\ddraw.dll", MAX_PATH, path, NULL);
ddraw.dll = LoadLibraryA(path); // external DirectDraw wrapper
if (ddraw.dll) {
sfall::extWrapper = true;
} else {
char path[MAX_PATH];
CopyMemory(path + GetSystemDirectoryA(path, MAX_PATH - 10), "\\ddraw.dll", 11); // path to original dll
ddraw.dll = LoadLibraryA(path);
}