From 8def7420c4272c12a4d6b7a83ef5b6a84d0c3e65 Mon Sep 17 00:00:00 2001 From: Silent Date: Sat, 22 Aug 2020 22:52:54 +0200 Subject: [PATCH] XInput: Try to use XInput 1.3 if 1.4 is not present This simple change enables the use of Guide button for Windows 7 users, provided they have DirectX End-User Runtimes installed. XInput 9.1.0 does not have the hidden XInputGetStateEx export, so it was not possible to poll for Guide button. --- .../xinput_controller_interface.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/frontend-common/xinput_controller_interface.cpp b/src/frontend-common/xinput_controller_interface.cpp index 2833db177..076746f3b 100644 --- a/src/frontend-common/xinput_controller_interface.cpp +++ b/src/frontend-common/xinput_controller_interface.cpp @@ -23,15 +23,19 @@ ControllerInterface::Backend XInputControllerInterface::GetBackend() const bool XInputControllerInterface::Initialize(CommonHostInterface* host_interface) { - m_xinput_module = LoadLibraryA("xinput1_4.dll"); + m_xinput_module = LoadLibraryW(L"xinput1_4"); if (!m_xinput_module) { - m_xinput_module = LoadLibraryA("xinput9_1_0.dll"); - if (!m_xinput_module) - { - Log_ErrorPrintf("Failed to load XInput module."); - return false; - } + m_xinput_module = LoadLibraryW(L"xinput1_3"); + } + if (!m_xinput_module) + { + m_xinput_module = LoadLibraryW(L"xinput9_1_0"); + } + if (!m_xinput_module) + { + Log_ErrorPrintf("Failed to load XInput module."); + return false; } // Try the hidden version of XInputGetState(), which lets us query the guide button.