From f015c99a5193400a9798616c0a265e5c66916c55 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Fri, 25 Oct 2019 19:33:59 -0500 Subject: ControllerInterface: Add platform consistent names for modifier keys. --- .../InputCommon/ControllerInterface/Device.cpp | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'Source/Core/InputCommon/ControllerInterface/Device.cpp') diff --git a/Source/Core/InputCommon/ControllerInterface/Device.cpp b/Source/Core/InputCommon/ControllerInterface/Device.cpp index cd056af0d8..e57e1c7682 100644 --- a/Source/Core/InputCommon/ControllerInterface/Device.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Device.cpp @@ -103,6 +103,39 @@ bool Device::FullAnalogSurface::IsMatchingName(std::string_view name) const return old_name == name; } +Device::CombinedInput::CombinedInput(std::string name, const Inputs& inputs) + : m_name(std::move(name)), m_inputs(inputs) +{ +} + +ControlState Device::CombinedInput::GetState() const +{ + ControlState result = 0; + + if (m_inputs.first) + result = m_inputs.first->GetState(); + + if (m_inputs.second) + result = std::max(result, m_inputs.second->GetState()); + + return result; +} + +std::string Device::CombinedInput::GetName() const +{ + return m_name; +} + +bool Device::CombinedInput::IsDetectable() +{ + return false; +} + +void Device::AddCombinedInput(std::string name, const std::pair& inputs) +{ + AddInput(new CombinedInput(std::move(name), {FindInput(inputs.first), FindInput(inputs.second)})); +} + // // DeviceQualifier :: ToString // -- cgit v1.2.3