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 +++++ Source/Core/InputCommon/ControllerInterface/XInput/XInput.h | 9 +++++---- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'Source/Core/InputCommon/ControllerInterface/XInput') 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 diff --git a/Source/Core/InputCommon/ControllerInterface/XInput/XInput.h b/Source/Core/InputCommon/ControllerInterface/XInput/XInput.h index f2a81e3840..0b299e6324 100644 --- a/Source/Core/InputCommon/ControllerInterface/XInput/XInput.h +++ b/Source/Core/InputCommon/ControllerInterface/XInput/XInput.h @@ -92,8 +92,9 @@ public: Device(const XINPUT_CAPABILITIES& capabilities, u8 index); - std::string GetName() const override; - std::string GetSource() const override; + std::string GetName() const final override; + std::string GetSource() const final override; + std::optional GetPreferredId() const final override; void UpdateMotors(); @@ -104,5 +105,5 @@ private: const BYTE m_subtype; const u8 m_index; }; -} -} +} // namespace XInput +} // namespace ciface -- cgit v1.2.3