From d583e01f54a7f53d1955f8bc76169c02b807df2e Mon Sep 17 00:00:00 2001 From: german Date: Thu, 31 Dec 2020 20:40:55 -0600 Subject: Add multitouch support --- src/core/hle/service/hid/controllers/touchscreen.h | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 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 4d9042adc..6c7620420 100644 --- a/src/core/hle/service/hid/controllers/touchscreen.h +++ b/src/core/hle/service/hid/controllers/touchscreen.h @@ -30,6 +30,9 @@ public: void OnLoadInputDevices() override; private: + void updateTouchInputEvent(const std::tuple& touch_input, int& finger_id); + static const size_t MAX_FINGERS = 16; + struct Attributes { union { u32 raw{}; @@ -55,7 +58,7 @@ private: s64_le sampling_number; s64_le sampling_number2; s32_le entry_count; - std::array states; + std::array states; }; static_assert(sizeof(TouchScreenEntry) == 0x298, "TouchScreenEntry is an invalid size"); @@ -66,9 +69,21 @@ private: }; static_assert(sizeof(TouchScreenSharedMemory) == 0x3000, "TouchScreenSharedMemory is an invalid size"); + + struct Finger { + u64_le last_touch{}; + float x{}; + float y{}; + u32_le id{}; + bool pressed{}; + Attributes attribute; + }; + TouchScreenSharedMemory shared_memory{}; std::unique_ptr touch_device; std::unique_ptr touch_btn_device; - s64_le last_touch{}; + int mouse_finger_id{-1}; + int keyboar_finger_id{-1}; + std::array fingers; }; } // namespace Service::HID -- cgit v1.2.3