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.
This commit is contained in:
Silent 2020-08-22 22:52:54 +02:00
parent 1c4bbc8cde
commit 8def7420c4
No known key found for this signature in database
GPG Key ID: AE53149BB0C45AF1
1 changed files with 11 additions and 7 deletions

View File

@ -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.