From d8df9a16bd4f4517b024c17446a94915493d7f3d Mon Sep 17 00:00:00 2001 From: german Date: Fri, 1 Jan 2021 12:32:29 -0600 Subject: Allow to return up to 16 touch inputs per engine --- src/core/hle/service/hid/controllers/touchscreen.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/core/hle/service/hid/controllers/touchscreen.h') diff --git a/src/core/hle/service/hid/controllers/touchscreen.h b/src/core/hle/service/hid/controllers/touchscreen.h index 03f399344..e39ab89ee 100644 --- a/src/core/hle/service/hid/controllers/touchscreen.h +++ b/src/core/hle/service/hid/controllers/touchscreen.h @@ -30,13 +30,17 @@ public: void OnLoadInputDevices() override; private: + static constexpr size_t MAX_FINGERS = 16; + + // Returns an unused finger id, if there is no fingers available std::nullopt will be returned + std::optional GetUnusedFingerID() const; + // If the touch is new it tries to assing a new finger id, if there is no fingers avaliable no // changes will be made. Updates the coordinates if the finger id it's already set. If the touch // ends delays the output by one frame to set the end_touch flag before finally freeing the // finger id - void updateTouchInputEvent(const std::tuple& touch_input, - size_t& finger_id); - static const size_t MAX_FINGERS = 16; + size_t UpdateTouchInputEvent(const std::tuple& touch_input, + size_t finger_id); struct Attributes { union { @@ -88,9 +92,9 @@ private: std::unique_ptr touch_mouse_device; std::unique_ptr touch_udp_device; std::unique_ptr touch_btn_device; - size_t mouse_finger_id{-1}; - size_t keyboard_finger_id{-1}; - size_t udp_finger_id{-1}; + std::array mouse_finger_id; + std::array keyboard_finger_id; + std::array udp_finger_id; std::array fingers; }; } // namespace Service::HID -- cgit v1.2.3