1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-15 06:04:49 +01:00

improve mingw build - always hook dinput

This commit is contained in:
FunkyFr3sh 2023-11-04 04:45:41 +01:00
parent d95423f5e6
commit c43f38fad3
2 changed files with 15 additions and 8 deletions

View File

@ -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)

View File

@ -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++)