diff options
| author | 2022-11-20 09:31:20 -0600 | |
|---|---|---|
| committer | 2022-11-20 09:31:20 -0600 | |
| commit | db7bcd51ae09c4ef25e08096de563903f61e2380 (patch) | |
| tree | 5ae9977b48e1aff118fae3ebffb215b0b4afa887 /src/core/hid/emulated_console.h | |
| parent | service: nfc: Implement nfc user (diff) | |
| parent | Merge pull request #9238 from german77/cabinet_applet (diff) | |
| download | yuzu-db7bcd51ae09c4ef25e08096de563903f61e2380.tar.gz yuzu-db7bcd51ae09c4ef25e08096de563903f61e2380.tar.xz yuzu-db7bcd51ae09c4ef25e08096de563903f61e2380.zip | |
Merge branch 'master' into nfc_impl
Diffstat (limited to 'src/core/hid/emulated_console.h')
| -rw-r--r-- | src/core/hid/emulated_console.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/core/hid/emulated_console.h b/src/core/hid/emulated_console.h index 1c510cd19..697ecd2d6 100644 --- a/src/core/hid/emulated_console.h +++ b/src/core/hid/emulated_console.h | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include <functional> | 7 | #include <functional> |
| 8 | #include <memory> | 8 | #include <memory> |
| 9 | #include <mutex> | 9 | #include <mutex> |
| 10 | #include <optional> | ||
| 10 | #include <unordered_map> | 11 | #include <unordered_map> |
| 11 | 12 | ||
| 12 | #include "common/common_funcs.h" | 13 | #include "common/common_funcs.h" |
| @@ -20,6 +21,8 @@ | |||
| 20 | #include "core/hid/motion_input.h" | 21 | #include "core/hid/motion_input.h" |
| 21 | 22 | ||
| 22 | namespace Core::HID { | 23 | namespace Core::HID { |
| 24 | static constexpr std::size_t MaxTouchDevices = 32; | ||
| 25 | static constexpr std::size_t MaxActiveTouchInputs = 16; | ||
| 23 | 26 | ||
| 24 | struct ConsoleMotionInfo { | 27 | struct ConsoleMotionInfo { |
| 25 | Common::Input::MotionStatus raw_status{}; | 28 | Common::Input::MotionStatus raw_status{}; |
| @@ -27,13 +30,13 @@ struct ConsoleMotionInfo { | |||
| 27 | }; | 30 | }; |
| 28 | 31 | ||
| 29 | using ConsoleMotionDevices = std::unique_ptr<Common::Input::InputDevice>; | 32 | using ConsoleMotionDevices = std::unique_ptr<Common::Input::InputDevice>; |
| 30 | using TouchDevices = std::array<std::unique_ptr<Common::Input::InputDevice>, 16>; | 33 | using TouchDevices = std::array<std::unique_ptr<Common::Input::InputDevice>, MaxTouchDevices>; |
| 31 | 34 | ||
| 32 | using ConsoleMotionParams = Common::ParamPackage; | 35 | using ConsoleMotionParams = Common::ParamPackage; |
| 33 | using TouchParams = std::array<Common::ParamPackage, 16>; | 36 | using TouchParams = std::array<Common::ParamPackage, MaxTouchDevices>; |
| 34 | 37 | ||
| 35 | using ConsoleMotionValues = ConsoleMotionInfo; | 38 | using ConsoleMotionValues = ConsoleMotionInfo; |
| 36 | using TouchValues = std::array<Common::Input::TouchStatus, 16>; | 39 | using TouchValues = std::array<Common::Input::TouchStatus, MaxTouchDevices>; |
| 37 | 40 | ||
| 38 | struct TouchFinger { | 41 | struct TouchFinger { |
| 39 | u64 last_touch{}; | 42 | u64 last_touch{}; |
| @@ -55,7 +58,7 @@ struct ConsoleMotion { | |||
| 55 | bool is_at_rest{}; | 58 | bool is_at_rest{}; |
| 56 | }; | 59 | }; |
| 57 | 60 | ||
| 58 | using TouchFingerState = std::array<TouchFinger, 16>; | 61 | using TouchFingerState = std::array<TouchFinger, MaxActiveTouchInputs>; |
| 59 | 62 | ||
| 60 | struct ConsoleStatus { | 63 | struct ConsoleStatus { |
| 61 | // Data from input_common | 64 | // Data from input_common |
| @@ -166,6 +169,10 @@ private: | |||
| 166 | */ | 169 | */ |
| 167 | void SetTouch(const Common::Input::CallbackStatus& callback, std::size_t index); | 170 | void SetTouch(const Common::Input::CallbackStatus& callback, std::size_t index); |
| 168 | 171 | ||
| 172 | std::optional<std::size_t> GetIndexFromFingerId(std::size_t finger_id) const; | ||
| 173 | |||
| 174 | std::optional<std::size_t> GetNextFreeIndex() const; | ||
| 175 | |||
| 169 | /** | 176 | /** |
| 170 | * Triggers a callback that something has changed on the console status | 177 | * Triggers a callback that something has changed on the console status |
| 171 | * @param type Input type of the event to trigger | 178 | * @param type Input type of the event to trigger |