From d26c1ce24d9108114d7eab97cfc2ab4f3eea28ee Mon Sep 17 00:00:00 2001 From: Michael M Date: Fri, 10 Nov 2017 12:30:37 -0800 Subject: Add hotplug support to DInput and XInput controller backends --- Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp') diff --git a/Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp b/Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp index 8c518335a0..f3e984d897 100644 --- a/Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp +++ b/Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp @@ -92,6 +92,8 @@ void PopulateDevices() if (!hXInput) return; + g_controller_interface.RemoveDevice([](const auto* dev) { return dev->GetSource() == "XInput"; }); + XINPUT_CAPABILITIES caps; for (int i = 0; i != 4; ++i) if (ERROR_SUCCESS == PXInputGetCapabilities(i, 0, &caps)) -- cgit v1.2.3 From eadbdd6bc389cd89c3e3e57a31dabaeadf161865 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Sat, 9 Mar 2019 09:57:37 -0600 Subject: ControllerInterface/Win32: Prevent devcies from losing their "id" on a hotplug event. --- Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp') diff --git a/Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp b/Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp index f3e984d897..d6ecdb9d81 100644 --- a/Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp +++ b/Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp @@ -194,6 +194,11 @@ void Device::UpdateMotors() } } +std::optional Device::GetPreferredId() const +{ + return m_index; +} + // GET name/source/id std::string Device::Button::GetName() const -- cgit v1.2.3