diff options
| author | 2021-10-30 22:23:10 -0500 | |
|---|---|---|
| committer | 2021-11-24 20:30:26 -0600 | |
| commit | 2b1b0c2a30e242b08ec120e09803ec54d5445703 (patch) | |
| tree | 9a10400a7e4403b288eee3aae8a52f1d5be912de /src/core/hid/emulated_controller.h | |
| parent | input_common: Revert deleted TAS functions (diff) | |
| download | yuzu-2b1b0c2a30e242b08ec120e09803ec54d5445703.tar.gz yuzu-2b1b0c2a30e242b08ec120e09803ec54d5445703.tar.xz yuzu-2b1b0c2a30e242b08ec120e09803ec54d5445703.zip | |
kraken: Address comments from review
start lion review
Diffstat (limited to 'src/core/hid/emulated_controller.h')
| -rw-r--r-- | src/core/hid/emulated_controller.h | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/src/core/hid/emulated_controller.h b/src/core/hid/emulated_controller.h index fea401365..dd9a93364 100644 --- a/src/core/hid/emulated_controller.h +++ b/src/core/hid/emulated_controller.h | |||
| @@ -4,10 +4,13 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <array> | ||
| 7 | #include <functional> | 8 | #include <functional> |
| 9 | #include <memory> | ||
| 8 | #include <mutex> | 10 | #include <mutex> |
| 9 | #include <unordered_map> | 11 | #include <unordered_map> |
| 10 | 12 | ||
| 13 | #include "common/common_types.h" | ||
| 11 | #include "common/input.h" | 14 | #include "common/input.h" |
| 12 | #include "common/param_package.h" | 15 | #include "common/param_package.h" |
| 13 | #include "common/point.h" | 16 | #include "common/point.h" |
| @@ -20,20 +23,22 @@ | |||
| 20 | namespace Core::HID { | 23 | namespace Core::HID { |
| 21 | const std::size_t max_emulated_controllers = 2; | 24 | const std::size_t max_emulated_controllers = 2; |
| 22 | struct ControllerMotionInfo { | 25 | struct ControllerMotionInfo { |
| 23 | Input::MotionStatus raw_status{}; | 26 | Common::Input::MotionStatus raw_status{}; |
| 24 | MotionInput emulated{}; | 27 | MotionInput emulated{}; |
| 25 | }; | 28 | }; |
| 26 | 29 | ||
| 27 | using ButtonDevices = | 30 | using ButtonDevices = |
| 28 | std::array<std::unique_ptr<Input::InputDevice>, Settings::NativeButton::NumButtons>; | 31 | std::array<std::unique_ptr<Common::Input::InputDevice>, Settings::NativeButton::NumButtons>; |
| 29 | using StickDevices = | 32 | using StickDevices = |
| 30 | std::array<std::unique_ptr<Input::InputDevice>, Settings::NativeAnalog::NumAnalogs>; | 33 | std::array<std::unique_ptr<Common::Input::InputDevice>, Settings::NativeAnalog::NumAnalogs>; |
| 31 | using ControllerMotionDevices = | 34 | using ControllerMotionDevices = |
| 32 | std::array<std::unique_ptr<Input::InputDevice>, Settings::NativeMotion::NumMotions>; | 35 | std::array<std::unique_ptr<Common::Input::InputDevice>, Settings::NativeMotion::NumMotions>; |
| 33 | using TriggerDevices = | 36 | using TriggerDevices = |
| 34 | std::array<std::unique_ptr<Input::InputDevice>, Settings::NativeTrigger::NumTriggers>; | 37 | std::array<std::unique_ptr<Common::Input::InputDevice>, Settings::NativeTrigger::NumTriggers>; |
| 35 | using BatteryDevices = std::array<std::unique_ptr<Input::InputDevice>, max_emulated_controllers>; | 38 | using BatteryDevices = |
| 36 | using OutputDevices = std::array<std::unique_ptr<Input::OutputDevice>, max_emulated_controllers>; | 39 | std::array<std::unique_ptr<Common::Input::InputDevice>, max_emulated_controllers>; |
| 40 | using OutputDevices = | ||
| 41 | std::array<std::unique_ptr<Common::Input::OutputDevice>, max_emulated_controllers>; | ||
| 37 | 42 | ||
| 38 | using ButtonParams = std::array<Common::ParamPackage, Settings::NativeButton::NumButtons>; | 43 | using ButtonParams = std::array<Common::ParamPackage, Settings::NativeButton::NumButtons>; |
| 39 | using StickParams = std::array<Common::ParamPackage, Settings::NativeAnalog::NumAnalogs>; | 44 | using StickParams = std::array<Common::ParamPackage, Settings::NativeAnalog::NumAnalogs>; |
| @@ -42,13 +47,14 @@ using TriggerParams = std::array<Common::ParamPackage, Settings::NativeTrigger:: | |||
| 42 | using BatteryParams = std::array<Common::ParamPackage, max_emulated_controllers>; | 47 | using BatteryParams = std::array<Common::ParamPackage, max_emulated_controllers>; |
| 43 | using OutputParams = std::array<Common::ParamPackage, max_emulated_controllers>; | 48 | using OutputParams = std::array<Common::ParamPackage, max_emulated_controllers>; |
| 44 | 49 | ||
| 45 | using ButtonValues = std::array<Input::ButtonStatus, Settings::NativeButton::NumButtons>; | 50 | using ButtonValues = std::array<Common::Input::ButtonStatus, Settings::NativeButton::NumButtons>; |
| 46 | using SticksValues = std::array<Input::StickStatus, Settings::NativeAnalog::NumAnalogs>; | 51 | using SticksValues = std::array<Common::Input::StickStatus, Settings::NativeAnalog::NumAnalogs>; |
| 47 | using TriggerValues = std::array<Input::TriggerStatus, Settings::NativeTrigger::NumTriggers>; | 52 | using TriggerValues = |
| 53 | std::array<Common::Input::TriggerStatus, Settings::NativeTrigger::NumTriggers>; | ||
| 48 | using ControllerMotionValues = std::array<ControllerMotionInfo, Settings::NativeMotion::NumMotions>; | 54 | using ControllerMotionValues = std::array<ControllerMotionInfo, Settings::NativeMotion::NumMotions>; |
| 49 | using ColorValues = std::array<Input::BodyColorStatus, max_emulated_controllers>; | 55 | using ColorValues = std::array<Common::Input::BodyColorStatus, max_emulated_controllers>; |
| 50 | using BatteryValues = std::array<Input::BatteryStatus, max_emulated_controllers>; | 56 | using BatteryValues = std::array<Common::Input::BatteryStatus, max_emulated_controllers>; |
| 51 | using VibrationValues = std::array<Input::VibrationStatus, max_emulated_controllers>; | 57 | using VibrationValues = std::array<Common::Input::VibrationStatus, max_emulated_controllers>; |
| 52 | 58 | ||
| 53 | struct AnalogSticks { | 59 | struct AnalogSticks { |
| 54 | AnalogStickState left{}; | 60 | AnalogStickState left{}; |
| @@ -307,35 +313,35 @@ private: | |||
| 307 | * @param callback: A CallbackStatus containing the button status | 313 | * @param callback: A CallbackStatus containing the button status |
| 308 | * @param index: Button ID of the to be updated | 314 | * @param index: Button ID of the to be updated |
| 309 | */ | 315 | */ |
| 310 | void SetButton(Input::CallbackStatus callback, std::size_t index); | 316 | void SetButton(Common::Input::CallbackStatus callback, std::size_t index); |
| 311 | 317 | ||
| 312 | /** | 318 | /** |
| 313 | * Updates the analog stick status of the controller | 319 | * Updates the analog stick status of the controller |
| 314 | * @param callback: A CallbackStatus containing the analog stick status | 320 | * @param callback: A CallbackStatus containing the analog stick status |
| 315 | * @param index: stick ID of the to be updated | 321 | * @param index: stick ID of the to be updated |
| 316 | */ | 322 | */ |
| 317 | void SetStick(Input::CallbackStatus callback, std::size_t index); | 323 | void SetStick(Common::Input::CallbackStatus callback, std::size_t index); |
| 318 | 324 | ||
| 319 | /** | 325 | /** |
| 320 | * Updates the trigger status of the controller | 326 | * Updates the trigger status of the controller |
| 321 | * @param callback: A CallbackStatus containing the trigger status | 327 | * @param callback: A CallbackStatus containing the trigger status |
| 322 | * @param index: trigger ID of the to be updated | 328 | * @param index: trigger ID of the to be updated |
| 323 | */ | 329 | */ |
| 324 | void SetTrigger(Input::CallbackStatus callback, std::size_t index); | 330 | void SetTrigger(Common::Input::CallbackStatus callback, std::size_t index); |
| 325 | 331 | ||
| 326 | /** | 332 | /** |
| 327 | * Updates the motion status of the controller | 333 | * Updates the motion status of the controller |
| 328 | * @param callback: A CallbackStatus containing gyro and accelerometer data | 334 | * @param callback: A CallbackStatus containing gyro and accelerometer data |
| 329 | * @param index: motion ID of the to be updated | 335 | * @param index: motion ID of the to be updated |
| 330 | */ | 336 | */ |
| 331 | void SetMotion(Input::CallbackStatus callback, std::size_t index); | 337 | void SetMotion(Common::Input::CallbackStatus callback, std::size_t index); |
| 332 | 338 | ||
| 333 | /** | 339 | /** |
| 334 | * Updates the battery status of the controller | 340 | * Updates the battery status of the controller |
| 335 | * @param callback: A CallbackStatus containing the battery status | 341 | * @param callback: A CallbackStatus containing the battery status |
| 336 | * @param index: Button ID of the to be updated | 342 | * @param index: Button ID of the to be updated |
| 337 | */ | 343 | */ |
| 338 | void SetBattery(Input::CallbackStatus callback, std::size_t index); | 344 | void SetBattery(Common::Input::CallbackStatus callback, std::size_t index); |
| 339 | 345 | ||
| 340 | /** | 346 | /** |
| 341 | * Triggers a callback that something has changed on the controller status | 347 | * Triggers a callback that something has changed on the controller status |