From 571a1e1adc8acfda235819ae884d56b343856ad2 Mon Sep 17 00:00:00 2001 From: PiKeyAr Date: Thu, 12 Dec 2024 23:25:08 +0900 Subject: [PATCH] Backend: Better detection of Direct3D 9 --- SADXModLoader/backend.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/SADXModLoader/backend.cpp b/SADXModLoader/backend.cpp index 14994990..c3300966 100644 --- a/SADXModLoader/backend.cpp +++ b/SADXModLoader/backend.cpp @@ -36,14 +36,13 @@ void __cdecl InitRenderBackend(int mode, std::wstring gamePath, std::wstring ext default: break; case DirectX9: - wstring d3d8oldpath = gamePath + L"\\d3d8.dll"; - if (FileExists(d3d8oldpath)) + bool d3d8to9DLL = false; // Handle of the DLL + if (GetModuleHandle(L"d3d9.dll") != nullptr) { - PrintDebug("D3D8to9: d3d8.dll found in game directory, aborting D3D8to9 hook\n"); + PrintDebug("D3D8to9: Direct3D 9 is already loaded, skipping D3D8to9 hook\n"); return; } - bool d3d8to9DLL = false; // Handle of the DLL wstring fullPath = extLibPath + L"D3D8M\\d3d8m.dll"; // Path to the DLL // Attempt to load the DLL