diff --git a/src/hook.c b/src/hook.c index a7a4b27..e53f062 100644 --- a/src/hook.c +++ b/src/hook.c @@ -607,13 +607,6 @@ void hook_init(BOOL initial_hook) /* Switch to 3 if we can be sure that ddraw.dll will not be unloaded from the process */ g_config.hook = 3; } - -#if defined(__GNUC__) - if (g_config.hook == 4) - { - g_config.hook = 3; - } -#endif } if (!g_hook_active || g_config.hook == 3 || g_config.hook == 4) diff --git a/src/winapi_hooks.c b/src/winapi_hooks.c index ca4f9a2..a24a6fe 100644 --- a/src/winapi_hooks.c +++ b/src/winapi_hooks.c @@ -1114,9 +1114,23 @@ FARPROC WINAPI fake_GetProcAddress(HMODULE hModule, LPCSTR lpProcName) } #endif + BOOL hook = g_config.hook == 3; + +#if defined(__GNUC__) + if (g_config.hook == 4 && hModule && HIWORD(lpProcName)) + { + if (strcmp(lpProcName, "DirectInputCreateA") == 0 || + strcmp(lpProcName, "DirectInputCreateEx") == 0 || + strcmp(lpProcName, "DirectInput8Create") == 0) + { + hook = TRUE; + } + } +#endif + FARPROC proc = real_GetProcAddress(hModule, lpProcName); - if (g_config.hook != 3 || !hModule || !HIWORD(lpProcName)) + if (!hook || !hModule || !HIWORD(lpProcName)) return proc; for (int i = 0; g_hook_hooklist[i].module_name[0]; i++)