diff options
| author | liamwhite <liamwhite@users.noreply.github.com> | 2022-11-19 13:21:01 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-19 13:21:01 -0500 |
| commit | bcbc25eeb3027445f55050baa9ecd09289141dad (patch) | |
| tree | c3e93e0ca9dc41a492898520b5c8e7c28f1f7954 /src/core/hid/emulated_console.h | |
| parent | b0365a81c2aaec3b9328d1375a0ea52457db293e (diff) | |
| parent | aa075a0c08335b1d145b2885eb0ba2f395b74f90 (diff) | |
Merge pull request #9191 from german77/touching_souls
core: hid: Implement true multitouch support
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 @@ #include <functional> #include <memory> #include <mutex> +#include <optional> #include <unordered_map> #include "common/common_funcs.h" @@ -20,6 +21,8 @@ #include "core/hid/motion_input.h" namespace Core::HID { +static constexpr std::size_t MaxTouchDevices = 32; +static constexpr std::size_t MaxActiveTouchInputs = 16; struct ConsoleMotionInfo { Common::Input::MotionStatus raw_status{}; @@ -27,13 +30,13 @@ struct ConsoleMotionInfo { }; using ConsoleMotionDevices = std::unique_ptr<Common::Input::InputDevice>; -using TouchDevices = std::array<std::unique_ptr<Common::Input::InputDevice>, 16>; +using TouchDevices = std::array<std::unique_ptr<Common::Input::InputDevice>, MaxTouchDevices>; using ConsoleMotionParams = Common::ParamPackage; -using TouchParams = std::array<Common::ParamPackage, 16>; +using TouchParams = std::array<Common::ParamPackage, MaxTouchDevices>; using ConsoleMotionValues = ConsoleMotionInfo; -using TouchValues = std::array<Common::Input::TouchStatus, 16>; +using TouchValues = std::array<Common::Input::TouchStatus, MaxTouchDevices>; struct TouchFinger { u64 last_touch{}; @@ -55,7 +58,7 @@ struct ConsoleMotion { bool is_at_rest{}; }; -using TouchFingerState = std::array<TouchFinger, 16>; +using TouchFingerState = std::array<TouchFinger, MaxActiveTouchInputs>; struct ConsoleStatus { // Data from input_common @@ -166,6 +169,10 @@ private: */ void SetTouch(const Common::Input::CallbackStatus& callback, std::size_t index); + std::optional<std::size_t> GetIndexFromFingerId(std::size_t finger_id) const; + + std::optional<std::size_t> GetNextFreeIndex() const; + /** * Triggers a callback that something has changed on the console status * @param type Input type of the event to trigger |
