aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmma Miler <emma.pi@protonmail.com>2022-09-25 01:36:41 +0200
committerGeckoEidechse <gecko.eidechse+git@pm.me>2022-10-04 00:10:25 +0200
commitadaeb557eeb90e41275058ab3f3a0ca75e6ea0a4 (patch)
treebce9f74152d5536e52991a798840bc11a8b623f5
parent212f50df366d35fa91cc78be3451c7836c9b3faa (diff)
downloadNorthstarLauncher-adaeb557eeb90e41275058ab3f3a0ca75e6ea0a4.tar.gz
NorthstarLauncher-adaeb557eeb90e41275058ab3f3a0ca75e6ea0a4.zip
Replace XInput library with updated one (#278)
* Replace XInput library with updated one This code adds better compatibility with newer controllers and different controller types Also adds ASLR to the loaded library * Formatting
-rw-r--r--NorthstarDLL/hooks.cpp27
1 files changed, 21 insertions, 6 deletions
diff --git a/NorthstarDLL/hooks.cpp b/NorthstarDLL/hooks.cpp
index 7f1d3b84..72ae727a 100644
--- a/NorthstarDLL/hooks.cpp
+++ b/NorthstarDLL/hooks.cpp
@@ -210,14 +210,29 @@ void CallAllPendingDLLLoadCallbacks()
HMODULE LoadLibraryExAHook(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
{
- HMODULE moduleAddress = LoadLibraryExAOriginal(lpLibFileName, hFile, dwFlags);
-
- if (moduleAddress)
+ if (!strncmp(lpLibFileName, "XInput1_3.dll", 14))
{
- CallLoadLibraryACallbacks(lpLibFileName, moduleAddress);
+ HMODULE moduleAddress = LoadLibraryExAOriginal("XInput9_1_0.dll", hFile, dwFlags);
+ if (moduleAddress)
+ {
+ CallLoadLibraryACallbacks(lpLibFileName, moduleAddress);
+ }
+ else
+ {
+ MessageBoxA(0, "Could not find XInput9_1_0.dll", "Northstar", MB_ICONERROR);
+ exit(-1);
+ }
+ return moduleAddress;
+ }
+ else
+ {
+ HMODULE moduleAddress = LoadLibraryExAOriginal(lpLibFileName, hFile, dwFlags);
+ if (moduleAddress)
+ {
+ CallLoadLibraryACallbacks(lpLibFileName, moduleAddress);
+ }
+ return moduleAddress;
}
-
- return moduleAddress;
}
HMODULE LoadLibraryAHook(LPCSTR lpLibFileName)