mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2025-01-26 12:59:18 +01:00
Windows: Try to use xinput9_1_0.dll if XInput 1.4 and 1.3 are not available.
XInput "9.1.0" ships with Windows Vista and 7 systems, but it lacks some features, including support for detecting Guide button presses.
This commit is contained in:
parent
76fc378837
commit
a506f1cbc7
@ -84,11 +84,15 @@ WIN_LoadXInputDLL(void)
|
|||||||
s_pXInputDLL = LoadLibrary(L"XInput1_4.dll"); /* 1.4 Ships with Windows 8. */
|
s_pXInputDLL = LoadLibrary(L"XInput1_4.dll"); /* 1.4 Ships with Windows 8. */
|
||||||
if (!s_pXInputDLL) {
|
if (!s_pXInputDLL) {
|
||||||
version = (1 << 16) | 3;
|
version = (1 << 16) | 3;
|
||||||
s_pXInputDLL = LoadLibrary(L"XInput1_3.dll"); /* 1.3 Ships with Vista and Win7, can be installed as a redistributable component. */
|
s_pXInputDLL = LoadLibrary(L"XInput1_3.dll"); /* 1.3 can be installed as a redistributable component. */
|
||||||
}
|
}
|
||||||
if (!s_pXInputDLL) {
|
if (!s_pXInputDLL) {
|
||||||
s_pXInputDLL = LoadLibrary(L"bin\\XInput1_3.dll");
|
s_pXInputDLL = LoadLibrary(L"bin\\XInput1_3.dll");
|
||||||
}
|
}
|
||||||
|
if (!s_pXInputDLL) {
|
||||||
|
/* "9.1.0" Ships with Vista and Win7, and is more limited than 1.3+ (e.g. XInputGetStateEx is not available.) */
|
||||||
|
s_pXInputDLL = LoadLibrary(L"XInput9_1_0.dll");
|
||||||
|
}
|
||||||
if (!s_pXInputDLL) {
|
if (!s_pXInputDLL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -99,6 +103,9 @@ WIN_LoadXInputDLL(void)
|
|||||||
|
|
||||||
/* 100 is the ordinal for _XInputGetStateEx, which returns the same struct as XinputGetState, but with extra data in wButtons for the guide button, we think... */
|
/* 100 is the ordinal for _XInputGetStateEx, which returns the same struct as XinputGetState, but with extra data in wButtons for the guide button, we think... */
|
||||||
SDL_XInputGetState = (XInputGetState_t)GetProcAddress((HMODULE)s_pXInputDLL, (LPCSTR)100);
|
SDL_XInputGetState = (XInputGetState_t)GetProcAddress((HMODULE)s_pXInputDLL, (LPCSTR)100);
|
||||||
|
if (!SDL_XInputGetState) {
|
||||||
|
SDL_XInputGetState = (XInputGetState_t)GetProcAddress((HMODULE)s_pXInputDLL, "XInputGetState");
|
||||||
|
}
|
||||||
SDL_XInputSetState = (XInputSetState_t)GetProcAddress((HMODULE)s_pXInputDLL, "XInputSetState");
|
SDL_XInputSetState = (XInputSetState_t)GetProcAddress((HMODULE)s_pXInputDLL, "XInputSetState");
|
||||||
SDL_XInputGetCapabilities = (XInputGetCapabilities_t)GetProcAddress((HMODULE)s_pXInputDLL, "XInputGetCapabilities");
|
SDL_XInputGetCapabilities = (XInputGetCapabilities_t)GetProcAddress((HMODULE)s_pXInputDLL, "XInputGetCapabilities");
|
||||||
if (!SDL_XInputGetState || !SDL_XInputSetState || !SDL_XInputGetCapabilities) {
|
if (!SDL_XInputGetState || !SDL_XInputSetState || !SDL_XInputGetCapabilities) {
|
||||||
|
Loading…
Reference in New Issue
Block a user