mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-19 15:31:53 +00:00
InputCommon: Fix occasional misidentification of analog input detection.
This commit is contained in:
parent
2047eaf1d8
commit
11c3f7ea8d
3 changed files with 4 additions and 7 deletions
|
@ -217,6 +217,8 @@ public:
|
|||
Clock::time_point press_time;
|
||||
std::optional<Clock::time_point> release_time;
|
||||
ControlState smoothness = 0;
|
||||
|
||||
bool IsAnalogPress() const { return smoothness > 1.00001; }
|
||||
};
|
||||
|
||||
Device::Input* FindInput(std::string_view name, const Device* def_dev) const;
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue