diff options
| author | bunnei <bunneidev@gmail.com> | 2021-03-29 18:00:47 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-29 18:00:47 -0700 |
| commit | f234531f92bab2e35fd88594c61943777ff44677 (patch) | |
| tree | c3933a963b8c0bccc6fe60522c602a02054e8601 /src/core/hle/service/hid/controllers/touchscreen.cpp | |
| parent | fb7dcbf7af4fc718bccd3641dcdf997a4310da53 (diff) | |
| parent | 7c26a9aefee00221df0d42d6cb753f4931473675 (diff) | |
Merge pull request #6109 from german77/gestureID
HID: Initialize correctly the gesture finger_id and filter invalid inputs
Diffstat (limited to 'src/core/hle/service/hid/controllers/touchscreen.cpp')
| -rw-r--r-- | src/core/hle/service/hid/controllers/touchscreen.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
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 @@ #include <algorithm> #include <cstring> #include "common/common_types.h" +#include "common/logging/log.h" #include "core/core_timing.h" #include "core/frontend/emu_window.h" #include "core/frontend/input.h" @@ -118,6 +119,10 @@ std::optional<std::size_t> Controller_Touchscreen::GetUnusedFingerID() const { std::size_t Controller_Touchscreen::UpdateTouchInputEvent( const std::tuple<float, float, bool>& touch_input, std::size_t finger_id) { const auto& [x, y, pressed] = touch_input; + if (finger_id > MAX_FINGERS) { + LOG_ERROR(Service_HID, "Invalid finger id {}", finger_id); + return MAX_FINGERS; + } if (pressed) { Attributes attribute{}; if (finger_id == MAX_FINGERS) { |
