diff options
| author | 2022-05-22 20:34:32 -0500 | |
|---|---|---|
| committer | 2022-05-23 11:01:14 -0500 | |
| commit | c82806f9cb88f390ae3fb048ba7ff2bb138fa3ec (patch) | |
| tree | 60f52dfd3e59f1424d03ab71a8cb28b9b845d486 /src/core/hle | |
| parent | Merge pull request #8342 from lat9nq/clang-latest-stdc++ (diff) | |
| download | yuzu-c82806f9cb88f390ae3fb048ba7ff2bb138fa3ec.tar.gz yuzu-c82806f9cb88f390ae3fb048ba7ff2bb138fa3ec.tar.xz yuzu-c82806f9cb88f390ae3fb048ba7ff2bb138fa3ec.zip | |
input_common: touch: Rewrite touch driver to support multiple touch points
Diffstat (limited to 'src/core/hle')
| -rw-r--r-- | src/core/hle/service/hid/controllers/touchscreen.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/hle/service/hid/controllers/touchscreen.cpp b/src/core/hle/service/hid/controllers/touchscreen.cpp index 108ce5a41..1da8d3eb0 100644 --- a/src/core/hle/service/hid/controllers/touchscreen.cpp +++ b/src/core/hle/service/hid/controllers/touchscreen.cpp | |||
| @@ -44,7 +44,6 @@ void Controller_Touchscreen::OnUpdate(const Core::Timing::CoreTiming& core_timin | |||
| 44 | for (std::size_t id = 0; id < MAX_FINGERS; id++) { | 44 | for (std::size_t id = 0; id < MAX_FINGERS; id++) { |
| 45 | const auto& current_touch = touch_status[id]; | 45 | const auto& current_touch = touch_status[id]; |
| 46 | auto& finger = fingers[id]; | 46 | auto& finger = fingers[id]; |
| 47 | finger.position = current_touch.position; | ||
| 48 | finger.id = current_touch.id; | 47 | finger.id = current_touch.id; |
| 49 | 48 | ||
| 50 | if (finger.attribute.start_touch) { | 49 | if (finger.attribute.start_touch) { |
| @@ -61,13 +60,18 @@ void Controller_Touchscreen::OnUpdate(const Core::Timing::CoreTiming& core_timin | |||
| 61 | if (!finger.pressed && current_touch.pressed) { | 60 | if (!finger.pressed && current_touch.pressed) { |
| 62 | finger.attribute.start_touch.Assign(1); | 61 | finger.attribute.start_touch.Assign(1); |
| 63 | finger.pressed = true; | 62 | finger.pressed = true; |
| 63 | finger.position = current_touch.position; | ||
| 64 | continue; | 64 | continue; |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | if (finger.pressed && !current_touch.pressed) { | 67 | if (finger.pressed && !current_touch.pressed) { |
| 68 | finger.attribute.raw = 0; | 68 | finger.attribute.raw = 0; |
| 69 | finger.attribute.end_touch.Assign(1); | 69 | finger.attribute.end_touch.Assign(1); |
| 70 | continue; | ||
| 70 | } | 71 | } |
| 72 | |||
| 73 | // Only update position if touch is not on a special frame | ||
| 74 | finger.position = current_touch.position; | ||
| 71 | } | 75 | } |
| 72 | 76 | ||
| 73 | std::array<Core::HID::TouchFinger, MAX_FINGERS> active_fingers; | 77 | std::array<Core::HID::TouchFinger, MAX_FINGERS> active_fingers; |