diff --git a/cnc-ddraw.vcxproj b/cnc-ddraw.vcxproj index edfd7ab..c7d6352 100644 --- a/cnc-ddraw.vcxproj +++ b/cnc-ddraw.vcxproj @@ -49,6 +49,7 @@ + @@ -84,6 +85,7 @@ + diff --git a/cnc-ddraw.vcxproj.filters b/cnc-ddraw.vcxproj.filters index 34b47a6..7de9def 100644 --- a/cnc-ddraw.vcxproj.filters +++ b/cnc-ddraw.vcxproj.filters @@ -162,6 +162,9 @@ Source Files + + Source Files + @@ -281,6 +284,9 @@ Header Files + + Header Files + diff --git a/inc/indeo.h b/inc/indeo.h new file mode 100644 index 0000000..a83e007 --- /dev/null +++ b/inc/indeo.h @@ -0,0 +1,7 @@ +#ifndef INDEO_H +#define INDEO_H + +void indeo_enable(); +void indeo_disable(); + +#endif diff --git a/src/dllmain.c b/src/dllmain.c index c131c54..ff0874c 100644 --- a/src/dllmain.c +++ b/src/dllmain.c @@ -9,6 +9,7 @@ #include "debug.h" #include "config.h" #include "hook.h" +#include "indeo.h" #include "versionhelpers.h" @@ -120,6 +121,7 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved) set_aware(); } + indeo_enable(); timeBeginPeriod(1); hook_init(); break; @@ -133,6 +135,7 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved) cfg_save(); + indeo_disable(); timeEndPeriod(1); dinput_hook_exit(); hook_exit(); diff --git a/src/indeo.c b/src/indeo.c new file mode 100644 index 0000000..fbaa113 --- /dev/null +++ b/src/indeo.c @@ -0,0 +1,61 @@ +#include + + +void indeo_enable() +{ + HKEY hkey; + LONG status = + RegCreateKeyExA( + HKEY_CURRENT_USER, + "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Drivers32", + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_WRITE | KEY_QUERY_VALUE, + NULL, + &hkey, + NULL); + + if (status == ERROR_SUCCESS) + { + LPCTSTR iv31 = "ir32_32.dll"; + RegSetValueExA(hkey, "vidc.iv31", 0, REG_SZ, iv31, strlen(iv31) + 1); + + LPCTSTR iv32 = "ir32_32.dll"; + RegSetValueExA(hkey, "vidc.iv32", 0, REG_SZ, iv32, strlen(iv32) + 1); + + LPCTSTR iv41 = "ir41_32.ax"; + RegSetValueExA(hkey, "vidc.iv41", 0, REG_SZ, iv41, strlen(iv41) + 1); + + LPCTSTR iv50 = "ir50_32.dll"; + RegSetValueExA(hkey, "vidc.iv50", 0, REG_SZ, iv50, strlen(iv50) + 1); + + RegCloseKey(hkey); + } +} + +void indeo_disable() +{ + HKEY hkey; + LONG status = + RegCreateKeyExA( + HKEY_CURRENT_USER, + "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Drivers32", + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_WRITE | KEY_QUERY_VALUE, + NULL, + &hkey, + NULL); + + if (status == ERROR_SUCCESS) + { + RegDeleteValueA(hkey, "vidc.iv31"); + RegDeleteValueA(hkey, "vidc.iv32"); + RegDeleteValueA(hkey, "vidc.iv41"); + RegDeleteValueA(hkey, "vidc.iv50"); + + RegCloseKey(hkey); + } +}