summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp
diff options
context:
space:
mode:
authorJordan Woyak <jordan.woyak@gmail.com>2025-01-29 02:02:46 -0600
committerJordan Woyak <jordan.woyak@gmail.com>2025-02-01 01:54:10 -0600
commit6e7e808b6614f98674dba7290bea2ea044c4d5d2 (patch)
tree1057bab0dbecfea831f2532f0756de8695851e9d /Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp
parentcd3993708f25ecbfb62eea9cdd8279bc002a01d1 (diff)
DolphinQt/Mapping: Add setting to enable waiting for alternate mappings
using the OR-operator.
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp')
-rw-r--r--Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp27
1 files changed, 21 insertions, 6 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp b/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp
index cb06a7ed30..3765ef24a6 100644
--- a/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp
@@ -51,11 +51,10 @@ std::string GetExpressionForControl(const std::string& control_name,
return expr;
}
-std::string
-BuildExpression(const std::vector<ciface::Core::DeviceContainer::InputDetection>& detections,
- const ciface::Core::DeviceQualifier& default_device, Quote quote)
+std::string BuildExpression(const Core::InputDetector::Results& detections,
+ const ciface::Core::DeviceQualifier& default_device, Quote quote)
{
- std::vector<const ciface::Core::DeviceContainer::InputDetection*> pressed_inputs;
+ std::vector<const Core::InputDetector::Detection*> pressed_inputs;
std::vector<std::string> alternations;
@@ -135,8 +134,7 @@ BuildExpression(const std::vector<ciface::Core::DeviceContainer::InputDetection>
return fmt::to_string(fmt::join(alternations, "|"));
}
-void RemoveSpuriousTriggerCombinations(
- std::vector<ciface::Core::DeviceContainer::InputDetection>* detections)
+void RemoveSpuriousTriggerCombinations(Core::InputDetector::Results* detections)
{
const auto is_spurious = [&](const auto& detection) {
return std::ranges::any_of(*detections, [&](const auto& d) {
@@ -149,4 +147,21 @@ void RemoveSpuriousTriggerCombinations(
std::erase_if(*detections, is_spurious);
}
+void RemoveDetectionsAfterTimePoint(Core::InputDetector::Results* results,
+ Core::DeviceContainer::Clock::time_point after)
+{
+ const auto is_after_time = [&](const Core::InputDetector::Detection& detection) {
+ return detection.release_time.value_or(after) >= after;
+ };
+
+ std::erase_if(*results, is_after_time);
+}
+
+bool ContainsCompleteDetection(const Core::InputDetector::Results& results)
+{
+ return std::ranges::any_of(results, [](const Core::InputDetector::Detection& detection) {
+ return detection.release_time.has_value();
+ });
+}
+
} // namespace ciface::MappingCommon