make xinput lazy load real xinput

This commit is contained in:
ConfiG 2023-08-04 20:29:28 +03:00
parent 1f7e6da304
commit 041d44cf0c
No known key found for this signature in database
GPG key ID: 44DA1983F524C11B
10 changed files with 44 additions and 27 deletions

View file

@ -7,8 +7,6 @@ ${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "Tento průvodce vás provede odi
; installer
${LangFileString} GEODE_TEXT_SYSTEM_XINPUT_MISSING "$0 nebyl nalezen. Geode je kompatibilní pouze s Windows 7 a vyšším."
${LangFileString} GEODE_TEXT_GD_MISSING "$\r$\n$\r$\nV této cestě se nenachází Geometry Dash!"
${LangFileString} GEODE_TEXT_MH_ALREADY_INSTALLED "V této cestě je již nainstalován Mega Hack v6/v7!$\r$\nGeode nefunguje s MHv6/v7 (MHv8 ale již kompatibilní bude).$\r$\nProsím, odinstalujte jej, než budete pokračovat."
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "V této cestě je již nainstalován jiný mod loader!$\r$\nGeode s žádným jiným mod loaderem dohromady nefunguje.$\r$\nProsím, odinstalujte jej, než budete pokračovat."

View file

@ -11,8 +11,6 @@ ${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "Setup will guide you through the
; installer
${LangFileString} GEODE_TEXT_SYSTEM_XINPUT_MISSING "$0 was not found. Geode is only compatible with Windows 7 and newer."
${LangFileString} GEODE_TEXT_GD_MISSING "$\r$\n$\r$\nThis path does not have Geometry Dash installed!"
${LangFileString} GEODE_TEXT_MH_ALREADY_INSTALLED "This path already has Mega Hack v6/v7 installed!$\r$\nGeode doesn't work with MHv6/v7 (MHv8 will be compatible with Geode).$\r$\nPlease, uninstall it before proceeding."
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "This path already has another mod loader installed!$\r$\nGeode doesn't work with any other mod loader.$\r$\nPlease, uninstall it before proceeding."

View file

@ -7,8 +7,6 @@ ${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "Saat tarvittavia ohjeita sitä m
; installer
${LangFileString} GEODE_TEXT_SYSTEM_XINPUT_MISSING "$0 ei löytynyt asennettuna koneesta. Geode on yhteensopiva ainoastaan Windows 7 ja uudempien versioiden kanssa."
${LangFileString} GEODE_TEXT_GD_MISSING "$\r$\n$\r$\nValitussa kansiossa ei ole Geometry Dash -peliä asennettuna."
${LangFileString} GEODE_TEXT_MH_ALREADY_INSTALLED "Valitussa kansiossa on jo Mega Hack v6/v7 asennettuna.$\r$\nGeode ei ole yhteensopiva MHv6/v7 kanssa (MHv8 on ensimmäinen yhteensopiva versio Geoden kanssa).$\r$\nPoistathan Mega Hackin ennen Geoden asentamista."
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "Valitussa kansiossa on jo joitain modeja asennettuna.$\r$\nGeode ei ole yhteensopiva .DLL-muotoisten modien tai niiden lataajien kanssa.$\r$\nPoistathan .DLL-muotoiset modit ja niiden lataajat ennen Geoden asentamista."

View file

@ -7,8 +7,6 @@ ${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "O instalador guiará você atrav
; installer
${LangFileString} GEODE_TEXT_SYSTEM_XINPUT_MISSING "$0 não foi encontrado. Geode só é compatível com Windows 7 pra cima."
${LangFileString} GEODE_TEXT_GD_MISSING "$\r$\n$\r$\nEsse caminho não tem Geometry Dash instalado!"
${LangFileString} GEODE_TEXT_MH_ALREADY_INSTALLED "Esse caminho já tem Mega Hack v6/v7 instalado!$\r$\nGeode não funciona com MHv6/v7 (MHv8 será compatível com Geode).$\r$\nPor favor, desinstale-o antes de proceder."
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "Esse caminho já tem outro mod loader instalado!$\r$\nGeode não funciona com nenhum outro mod loader.$\r$\nPor favor, desinstale-o antes de proceder."

View file

@ -7,8 +7,6 @@ ${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "Эта программа уда
; installer
${LangFileString} GEODE_TEXT_SYSTEM_XINPUT_MISSING "$0 не найден. Geode совместим только с Windows 7 и выше."
${LangFileString} GEODE_TEXT_GD_MISSING "$\r$\n$\r$\nПо этому пути не установлен Geometry Dash!"
${LangFileString} GEODE_TEXT_MH_ALREADY_INSTALLED "По этому пути уже установлен Mega Hack v6/v7!$\r$\nGeode не работает с MHv6/v7 (MHv8 будет совместим Geode).$\r$\nПожалуйста, удалите его перед продолжением."
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "По этому пути уже установлен другой загрузчик модов!$\r$\nGeode не работает с другими загрузчиками модов.$\r$\nПожалуйста, удалите его перед продолжением."

View file

@ -7,8 +7,6 @@ ${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "Este asistente te va a guiar dur
; installer
${LangFileString} GEODE_TEXT_SYSTEM_XINPUT_MISSING "$0 no se ha podido encontrar. Geode solo es compatible con Windows 7 en adelante"
${LangFileString} GEODE_TEXT_GD_MISSING "$\r$\n$\r$\n¡Geometry Dash no está instalado en esta ruta!"
${LangFileString} GEODE_TEXT_MH_ALREADY_INSTALLED "¡Mega Hack v6/v7 está instalado en esta ruta!$\r$\nGeode no es compatible con MHv6/v7 (MHv8 será compatible con Geode).$\r$\nPor favor, desinstálalo antes de seguir."
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "¡Hay otro mod loader instalado en esta ruta!$\r$\nGeode no funciona con ningún otro mod loader.$\r$\nPor favor, desinstálalo antes de seguir."

View file

@ -7,8 +7,6 @@ ${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "Este asistente le guiará durant
; installer
${LangFileString} GEODE_TEXT_SYSTEM_XINPUT_MISSING "$0 no se encontró. Geode solo es compatible con Windows 7 y versiones más recientes"
${LangFileString} GEODE_TEXT_GD_MISSING "$\r$\n$\r$\n¡Geometry Dash no está instalado en esta ruta!"
${LangFileString} GEODE_TEXT_MH_ALREADY_INSTALLED "¡Mega Hack v6/v7 está instalado en esta ruta!$\r$\nGeode no es compatible con MHv6/v7 (MHv8 será compatible con Geode).$\r$\nPor favor, desinstálelo antes de continuar."
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "¡Hay otro mod loader instalado en esta ruta!$\r$\nGeode no funciona con ningún otro mod loader.$\r$\nPor favor, desinstálelo antes de continuar."

View file

@ -7,8 +7,6 @@ ${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "Denna guide tar dig igenom avins
; installer
${LangFileString} GEODE_TEXT_SYSTEM_XINPUT_MISSING "$0 hittades inte på din dator. Geode är inte kompatibel med Windows 7 och senare."
${LangFileString} GEODE_TEXT_GD_MISSING "$\r$\n$\r$\nDen valda mappen innehåller ingen installation av Geometry Dash."
${LangFileString} GEODE_TEXT_MH_ALREADY_INSTALLED "Den valda mappen innehåller redan Mega Hack v6/v7.$\r$\nGeode är inte kompatibel med MHv6/v7 (MHv8 är den första versionen som är kompatibel med Geode).$\r$\nSe till att avinstallera Mega Hack innan du startar installationen av Geode."
${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "Den valda mappen innehåller redan några andra mod.$\r$\nGeode är inte kompatibel med .DLL-slag mod eller sin mod loader.$\r$\nSe till att avinstallera .DLL-slag mod och sin mod loader innan du startar installationen av Geode."

View file

@ -251,12 +251,6 @@ FunctionEnd
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
StrCpy $0 "$WINDIR\System32\xinput1_3.dll"
IfFileExists $0 findGamePath 0
MessageBox MB_ICONSTOP|MB_OK $(GEODE_TEXT_SYSTEM_XINPUT_MISSING)
Abort
Return
findGamePath:
Call FindGamePath
IfErrors 0 +3

View file

@ -1,10 +1,49 @@
#include <Windows.h>
#include <stdio.h>
#include <Xinput.h>
#pragma comment(linker, "/export:XInputGetState=xinput1_3.XInputGetState")
#pragma comment(linker, "/export:XInputSetState=xinput1_3.XInputSetState")
#pragma comment(linker, "/export:XInputGetCapabilities=xinput1_3.XInputGetCapabilities")
#pragma comment(linker, "/export:XInputGetDSoundAudioDeviceGuids=xinput1_3.XInputGetDSoundAudioDeviceGuids")
#ifndef MAX_PATH
#define MAX_PATH 260
#endif
HMODULE xinput = NULL;
DWORD(WINAPI* getState)(DWORD, XINPUT_STATE*) = NULL;
DWORD(WINAPI* setState)(DWORD, XINPUT_VIBRATION*) = NULL;
DWORD(WINAPI* getCapabilities)(DWORD, DWORD, XINPUT_CAPABILITIES*) = NULL;
DWORD(WINAPI* getDSoundAudioDeviceGuids)(DWORD, GUID*, GUID*) = NULL;
void lazyLoadXInput() {
if (xinput)
return;
char path[MAX_PATH];
GetSystemDirectoryA(path, MAX_PATH);
strcat_s(path, MAX_PATH, "\\XInput9_1_0.dll");
xinput = LoadLibraryA(path);
getState = (DWORD(WINAPI*)(DWORD, XINPUT_STATE*))GetProcAddress(xinput, "XInputGetState");
setState = (DWORD(WINAPI*)(DWORD, XINPUT_VIBRATION*))GetProcAddress(xinput, "XInputSetState");
getCapabilities = (DWORD(WINAPI*)(DWORD, DWORD, XINPUT_CAPABILITIES*))GetProcAddress(xinput, "XInputGetCapabilities");
getDSoundAudioDeviceGuids = (DWORD(WINAPI*)(DWORD, GUID*, GUID*))GetProcAddress(xinput, "XInputGetDSoundAudioDeviceGuids");
}
DWORD WINAPI xinputGetState(DWORD dwUserIndex, XINPUT_STATE* pState) {
lazyLoadXInput();
return getState(dwUserIndex, pState);
}
DWORD WINAPI xinputSetState(DWORD dwUserIndex, XINPUT_VIBRATION* pVibration) {
lazyLoadXInput();
return setState(dwUserIndex, pVibration);
}
DWORD WINAPI xinputGetCapabilities(DWORD dwUserIndex, DWORD dwFlags, XINPUT_CAPABILITIES* pCapabilities) {
lazyLoadXInput();
return getCapabilities(dwUserIndex, dwFlags, pCapabilities);
}
DWORD WINAPI xinputGetDSoundAudioDeviceGuids(DWORD dwUserIndex, GUID* pDSoundRenderGuid, GUID* pDSoundCaptureGuid) {
lazyLoadXInput();
return getDSoundAudioDeviceGuids(dwUserIndex, pDSoundRenderGuid, pDSoundCaptureGuid);
}
#pragma comment(linker, "/export:XInputGetState=_xinputGetState@8")
#pragma comment(linker, "/export:XInputSetState=_xinputSetState@8")
#pragma comment(linker, "/export:XInputGetCapabilities=_xinputGetCapabilities@12")
#pragma comment(linker, "/export:XInputGetDSoundAudioDeviceGuids=_xinputGetDSoundAudioDeviceGuids@12")
__declspec(dllimport) void fake();
__declspec(dllexport) void sussy_impostor_sus_red_sus_vote_red_red_was_not_the_impostor() { fake(); }