From bc95c001c81a215ebde6a4c8b151b89f488f822b Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Fri, 1 Nov 2024 23:16:47 -0500 Subject: InputCommon: Move input mapping function into a class for non-blocking usage. --- .../InputCommon/ControllerInterface/CoreDevice.h | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'Source/Core/InputCommon/ControllerInterface/CoreDevice.h') diff --git a/Source/Core/InputCommon/ControllerInterface/CoreDevice.h b/Source/Core/InputCommon/ControllerInterface/CoreDevice.h index cd8256396e..0370fce894 100644 --- a/Source/Core/InputCommon/ControllerInterface/CoreDevice.h +++ b/Source/Core/InputCommon/ControllerInterface/CoreDevice.h @@ -245,5 +245,32 @@ protected: mutable std::recursive_mutex m_devices_mutex; std::vector> m_devices; }; + +class InputDetector +{ +public: + using Detection = DeviceContainer::InputDetection; + + InputDetector(); + ~InputDetector(); + + void Start(const DeviceContainer& container, const std::vector& device_strings); + void Update(std::chrono::milliseconds initial_wait, std::chrono::milliseconds confirmation_wait, + std::chrono::milliseconds maximum_wait); + bool IsComplete() const; + + const std::vector& GetResults() const; + + // move-return'd to prevent copying. + std::vector TakeResults(); + +private: + struct Impl; + + Clock::time_point m_start_time; + std::vector m_detections; + std::unique_ptr m_state; +}; + } // namespace Core } // namespace ciface -- cgit v1.2.3