diff options
| author | JMC47 <JMC4789@gmail.com> | 2025-03-28 18:25:04 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-28 18:25:04 -0400 |
| commit | 7d794897c4043b9ee8b278340cfeff02923512f4 (patch) | |
| tree | 05205ca6145a2450d3b3cc5e14526f83f8a379da /Source/Core/InputCommon/ControllerInterface | |
| parent | e0032b3e2c821f11c1c2964d4901399e88429898 (diff) | |
| parent | 9e9faf3be1582ac5cdcaa46dc60287b10c921aa2 (diff) | |
Merge pull request #13434 from JosJuice/android-non-blocking-input-detection
Android: Don't use separate thread for MotionAlertDialog
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface')
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/CoreDevice.cpp | 23 | ||||
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/CoreDevice.h | 12 |
2 files changed, 6 insertions, 29 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/CoreDevice.cpp b/Source/Core/InputCommon/ControllerInterface/CoreDevice.cpp index 3a29d4c98f..5a370cadc8 100644 --- a/Source/Core/InputCommon/ControllerInterface/CoreDevice.cpp +++ b/Source/Core/InputCommon/ControllerInterface/CoreDevice.cpp @@ -335,29 +335,6 @@ bool DeviceContainer::HasConnectedDevice(const DeviceQualifier& qualifier) const return device != nullptr && device->IsValid(); } -// Wait for inputs on supplied devices. -// Inputs are only considered if they are first seen in a neutral state. -// This is useful for crazy flightsticks that have certain buttons that are always held down -// and also properly handles detection when using "FullAnalogSurface" inputs. -// Multiple detections are returned until the various timeouts have been reached. -auto DeviceContainer::DetectInput(const std::vector<std::string>& device_strings, - std::chrono::milliseconds initial_wait, - std::chrono::milliseconds confirmation_wait, - std::chrono::milliseconds maximum_wait) const - -> std::vector<InputDetection> -{ - InputDetector input_detector; - input_detector.Start(*this, device_strings); - - while (!input_detector.IsComplete()) - { - Common::SleepCurrentThread(10); - input_detector.Update(initial_wait, confirmation_wait, maximum_wait); - } - - return input_detector.TakeResults(); -} - struct InputDetector::Impl { struct InputState diff --git a/Source/Core/InputCommon/ControllerInterface/CoreDevice.h b/Source/Core/InputCommon/ControllerInterface/CoreDevice.h index 54d7b46110..f30dd4f405 100644 --- a/Source/Core/InputCommon/ControllerInterface/CoreDevice.h +++ b/Source/Core/InputCommon/ControllerInterface/CoreDevice.h @@ -230,20 +230,20 @@ public: bool HasConnectedDevice(const DeviceQualifier& qualifier) 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; - std::recursive_mutex& GetDevicesMutex() const { return m_devices_mutex; } protected: // Exclusively needed when reading/writing the "m_devices" array. - // Not needed when individually readring/writing a single device ptr. + // Not needed when individually reading/writing a single device ptr. mutable std::recursive_mutex m_devices_mutex; std::vector<std::shared_ptr<Device>> m_devices; }; +// Wait for inputs on supplied devices. +// Inputs are only considered if they are first seen in a neutral state. +// This is useful for wacky flight sticks that have certain buttons that are always held down +// and also properly handles detection when using "FullAnalogSurface" inputs. +// Multiple detections are returned until the various timeouts have been reached. class InputDetector { public: |
