diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/hid/controllers/gesture.cpp | 11 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/touchscreen.cpp | 5 |
2 files changed, 13 insertions, 3 deletions
diff --git a/src/core/hle/service/hid/controllers/gesture.cpp b/src/core/hle/service/hid/controllers/gesture.cpp index e7063f8ef..93c43a203 100644 --- a/src/core/hle/service/hid/controllers/gesture.cpp +++ b/src/core/hle/service/hid/controllers/gesture.cpp | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #include <cstring> | 5 | #include <cstring> |
| 6 | #include "common/common_types.h" | 6 | #include "common/common_types.h" |
| 7 | #include "common/logging/log.h" | ||
| 7 | #include "core/core_timing.h" | 8 | #include "core/core_timing.h" |
| 8 | #include "core/frontend/emu_window.h" | 9 | #include "core/frontend/emu_window.h" |
| 9 | #include "core/hle/service/hid/controllers/gesture.h" | 10 | #include "core/hle/service/hid/controllers/gesture.h" |
| @@ -19,9 +20,9 @@ Controller_Gesture::~Controller_Gesture() = default; | |||
| 19 | 20 | ||
| 20 | void Controller_Gesture::OnInit() { | 21 | void Controller_Gesture::OnInit() { |
| 21 | for (std::size_t id = 0; id < MAX_FINGERS; ++id) { | 22 | for (std::size_t id = 0; id < MAX_FINGERS; ++id) { |
| 22 | mouse_finger_id[id] = MAX_FINGERS; | 23 | mouse_finger_id[id] = MAX_POINTS; |
| 23 | keyboard_finger_id[id] = MAX_FINGERS; | 24 | keyboard_finger_id[id] = MAX_POINTS; |
| 24 | udp_finger_id[id] = MAX_FINGERS; | 25 | udp_finger_id[id] = MAX_POINTS; |
| 25 | } | 26 | } |
| 26 | } | 27 | } |
| 27 | 28 | ||
| @@ -142,6 +143,10 @@ std::optional<std::size_t> Controller_Gesture::GetUnusedFingerID() const { | |||
| 142 | std::size_t Controller_Gesture::UpdateTouchInputEvent( | 143 | std::size_t Controller_Gesture::UpdateTouchInputEvent( |
| 143 | const std::tuple<float, float, bool>& touch_input, std::size_t finger_id) { | 144 | const std::tuple<float, float, bool>& touch_input, std::size_t finger_id) { |
| 144 | const auto& [x, y, pressed] = touch_input; | 145 | const auto& [x, y, pressed] = touch_input; |
| 146 | if (finger_id > MAX_POINTS) { | ||
| 147 | LOG_ERROR(Service_HID, "Invalid finger id {}", finger_id); | ||
| 148 | return MAX_POINTS; | ||
| 149 | } | ||
| 145 | if (pressed) { | 150 | if (pressed) { |
| 146 | if (finger_id == MAX_POINTS) { | 151 | if (finger_id == MAX_POINTS) { |
| 147 | const auto first_free_id = GetUnusedFingerID(); | 152 | const auto first_free_id = GetUnusedFingerID(); |
diff --git a/src/core/hle/service/hid/controllers/touchscreen.cpp b/src/core/hle/service/hid/controllers/touchscreen.cpp index 5219f2dad..be60492a4 100644 --- a/src/core/hle/service/hid/controllers/touchscreen.cpp +++ b/src/core/hle/service/hid/controllers/touchscreen.cpp | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include <cstring> | 6 | #include <cstring> |
| 7 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 8 | #include "common/logging/log.h" | ||
| 8 | #include "core/core_timing.h" | 9 | #include "core/core_timing.h" |
| 9 | #include "core/frontend/emu_window.h" | 10 | #include "core/frontend/emu_window.h" |
| 10 | #include "core/frontend/input.h" | 11 | #include "core/frontend/input.h" |
| @@ -118,6 +119,10 @@ std::optional<std::size_t> Controller_Touchscreen::GetUnusedFingerID() const { | |||
| 118 | std::size_t Controller_Touchscreen::UpdateTouchInputEvent( | 119 | std::size_t Controller_Touchscreen::UpdateTouchInputEvent( |
| 119 | const std::tuple<float, float, bool>& touch_input, std::size_t finger_id) { | 120 | const std::tuple<float, float, bool>& touch_input, std::size_t finger_id) { |
| 120 | const auto& [x, y, pressed] = touch_input; | 121 | const auto& [x, y, pressed] = touch_input; |
| 122 | if (finger_id > MAX_FINGERS) { | ||
| 123 | LOG_ERROR(Service_HID, "Invalid finger id {}", finger_id); | ||
| 124 | return MAX_FINGERS; | ||
| 125 | } | ||
| 121 | if (pressed) { | 126 | if (pressed) { |
| 122 | Attributes attribute{}; | 127 | Attributes attribute{}; |
| 123 | if (finger_id == MAX_FINGERS) { | 128 | if (finger_id == MAX_FINGERS) { |