mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-05 15:48:51 +00:00
InputCommon: Improve input detection to produce buton combinations.
This commit is contained in:
parent
d8ad8c3861
commit
48b76ff90f
4 changed files with 215 additions and 65 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue