summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerInterface/Device.h
diff options
context:
space:
mode:
authorJordan Woyak <jordan.woyak@gmail.com>2020-02-12 16:49:17 -0600
committerJordan Woyak <jordan.woyak@gmail.com>2020-09-25 22:51:32 -0500
commit48b76ff90f62183d5ad25a33ce9855b22e33dd97 (patch)
treea12c5f73f2b2a8769ee633441667a3bd00e98763 /Source/Core/InputCommon/ControllerInterface/Device.h
parentd8ad8c386121e9c937360b102289231d86693dd1 (diff)
InputCommon: Improve input detection to produce buton combinations.
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/Device.h')
-rw-r--r--Source/Core/InputCommon/ControllerInterface/Device.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/Device.h b/Source/Core/InputCommon/ControllerInterface/Device.h
index fa97a79a59..2612f59627 100644
--- a/Source/Core/InputCommon/ControllerInterface/Device.h
+++ b/Source/Core/InputCommon/ControllerInterface/Device.h
@@ -4,6 +4,7 @@
#pragma once
+#include <chrono>
#include <memory>
#include <mutex>
#include <optional>
@@ -194,6 +195,17 @@ public:
class DeviceContainer
{
public:
+ using Clock = std::chrono::steady_clock;
+
+ struct InputDetection
+ {
+ std::shared_ptr<Device> device;
+ Device::Input* input;
+ Clock::time_point press_time;
+ std::optional<Clock::time_point> release_time;
+ ControlState smoothness;
+ };
+
Device::Input* FindInput(std::string_view name, const Device* def_dev) const;
Device::Output* FindOutput(std::string_view name, const Device* def_dev) const;
@@ -203,8 +215,10 @@ public:
bool HasConnectedDevice(const DeviceQualifier& qualifier) const;
- std::vector<std::pair<std::shared_ptr<Device>, Device::Input*>>
- DetectInput(u32 wait_ms, const std::vector<std::string>& device_strings) const;
+ std::vector<InputDetection> DetectInput(const std::vector<std::string>& device_strings,
+ std::chrono::milliseconds initial_wait,
+ std::chrono::milliseconds confirmation_wait,
+ std::chrono::milliseconds maximum_wait) const;
protected:
mutable std::recursive_mutex m_devices_mutex;