diff --git a/Source/Core/DolphinQt/Config/Mapping/MappingCommon.cpp b/Source/Core/DolphinQt/Config/Mapping/MappingCommon.cpp index 5b8c6da567..07632e8dc5 100644 --- a/Source/Core/DolphinQt/Config/Mapping/MappingCommon.cpp +++ b/Source/Core/DolphinQt/Config/Mapping/MappingCommon.cpp @@ -26,11 +26,6 @@ constexpr auto INPUT_DETECT_MAXIMUM_TIME = std::chrono::seconds(5); // Ignore the mouse-click when queuing more buttons with "alternate mappings" enabled. constexpr auto INPUT_DETECT_ENDING_IGNORE_TIME = std::chrono::milliseconds(50); -bool ContainsAnalogInput(const ciface::Core::InputDetector::Results& results) -{ - return std::ranges::any_of(results, [](auto& detection) { return detection.smoothness > 1; }); -} - class MappingProcessor : public QObject { public: @@ -102,7 +97,7 @@ public: // Skip "Modifier" mappings when using analog inputs. auto* next_button = m_clicked_mapping_buttons.front(); if (next_button->GetControlType() == MappingButton::ControlType::ModifierInput && - ContainsAnalogInput(results)) + std::ranges::any_of(results, &ciface::Core::InputDetector::Detection::IsAnalogPress)) { // Clear "Modifier" mapping and queue the next button. SetButtonExpression(next_button, ""); diff --git a/Source/Core/InputCommon/ControllerInterface/CoreDevice.h b/Source/Core/InputCommon/ControllerInterface/CoreDevice.h index 95f9f5b88e..5318a102f9 100644 --- a/Source/Core/InputCommon/ControllerInterface/CoreDevice.h +++ b/Source/Core/InputCommon/ControllerInterface/CoreDevice.h @@ -217,6 +217,8 @@ public: Clock::time_point press_time; std::optional release_time; ControlState smoothness = 0; + + bool IsAnalogPress() const { return smoothness > 1.00001; } }; Device::Input* FindInput(std::string_view name, const Device* def_dev) const; diff --git a/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp b/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp index 9660d9ede8..505fd0260c 100644 --- a/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp +++ b/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp @@ -139,7 +139,7 @@ void RemoveSpuriousTriggerCombinations(Core::InputDetector::Results* detections) const auto is_spurious = [&](const auto& detection) { return std::ranges::any_of(*detections, [&](const auto& d) { // This is a spurious digital detection if a "smooth" (analog) detection is temporally near. - return &d != &detection && d.smoothness > 1 && d.smoothness > detection.smoothness && + return &d != &detection && d.IsAnalogPress() && !detection.IsAnalogPress() && abs(d.press_time - detection.press_time) < SPURIOUS_TRIGGER_COMBO_THRESHOLD; }); };