diff options
author | Emma Miler <emma.pi@protonmail.com> | 2022-09-25 01:36:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-25 01:36:41 +0200 |
commit | c3b61514eeaebe0d6e592437081f10d2f757cba1 (patch) | |
tree | ce7ae53ec4e3734cbb9bdac85ed66a031df679ee /NorthstarDLL/hooks.cpp | |
parent | 122f84f14d6177cc4c78b817ab71712185e0b47f (diff) | |
download | NorthstarLauncher-c3b61514eeaebe0d6e592437081f10d2f757cba1.tar.gz NorthstarLauncher-c3b61514eeaebe0d6e592437081f10d2f757cba1.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
Diffstat (limited to 'NorthstarDLL/hooks.cpp')
-rw-r--r-- | NorthstarDLL/hooks.cpp | 27 |
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) |