diff options
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/hid/emulated_console.cpp | 15 | ||||
| -rw-r--r-- | src/core/hid/input_converter.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/touchscreen.cpp | 6 |
3 files changed, 20 insertions, 5 deletions
diff --git a/src/core/hid/emulated_console.cpp b/src/core/hid/emulated_console.cpp index fd220ccb5..aac45907d 100644 --- a/src/core/hid/emulated_console.cpp +++ b/src/core/hid/emulated_console.cpp | |||
| @@ -27,12 +27,19 @@ void EmulatedConsole::SetTouchParams() { | |||
| 27 | // We can't use mouse as touch if native mouse is enabled | 27 | // We can't use mouse as touch if native mouse is enabled |
| 28 | touch_params[index++] = Common::ParamPackage{"engine:mouse,axis_x:10,axis_y:11,button:0"}; | 28 | touch_params[index++] = Common::ParamPackage{"engine:mouse,axis_x:10,axis_y:11,button:0"}; |
| 29 | } | 29 | } |
| 30 | touch_params[index++] = Common::ParamPackage{"engine:touch,axis_x:0,axis_y:1,button:0"}; | 30 | |
| 31 | touch_params[index++] = Common::ParamPackage{"engine:touch,axis_x:2,axis_y:3,button:1"}; | 31 | touch_params[index++] = |
| 32 | Common::ParamPackage{"engine:touch,axis_x:0,axis_y:1,button:0,touch_id:0"}; | ||
| 33 | touch_params[index++] = | ||
| 34 | Common::ParamPackage{"engine:touch,axis_x:2,axis_y:3,button:1,touch_id:1"}; | ||
| 35 | touch_params[index++] = | ||
| 36 | Common::ParamPackage{"engine:touch,axis_x:4,axis_y:5,button:2,touch_id:2"}; | ||
| 37 | touch_params[index++] = | ||
| 38 | Common::ParamPackage{"engine:touch,axis_x:6,axis_y:7,button:3,touch_id:3"}; | ||
| 32 | touch_params[index++] = | 39 | touch_params[index++] = |
| 33 | Common::ParamPackage{"engine:cemuhookudp,axis_x:17,axis_y:18,button:65536"}; | 40 | Common::ParamPackage{"engine:cemuhookudp,axis_x:17,axis_y:18,button:65536,touch_id:0"}; |
| 34 | touch_params[index++] = | 41 | touch_params[index++] = |
| 35 | Common::ParamPackage{"engine:cemuhookudp,axis_x:19,axis_y:20,button:131072"}; | 42 | Common::ParamPackage{"engine:cemuhookudp,axis_x:19,axis_y:20,button:131072,touch_id:1"}; |
| 36 | 43 | ||
| 37 | const auto button_index = | 44 | const auto button_index = |
| 38 | static_cast<u64>(Settings::values.touch_from_button_map_index.GetValue()); | 45 | static_cast<u64>(Settings::values.touch_from_button_map_index.GetValue()); |
diff --git a/src/core/hid/input_converter.cpp b/src/core/hid/input_converter.cpp index 3c26260f3..18d9f042d 100644 --- a/src/core/hid/input_converter.cpp +++ b/src/core/hid/input_converter.cpp | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include <algorithm> | ||
| 4 | #include <random> | 5 | #include <random> |
| 5 | 6 | ||
| 6 | #include "common/input.h" | 7 | #include "common/input.h" |
| @@ -196,6 +197,9 @@ Common::Input::TouchStatus TransformToTouch(const Common::Input::CallbackStatus& | |||
| 196 | x = std::clamp(x, 0.0f, 1.0f); | 197 | x = std::clamp(x, 0.0f, 1.0f); |
| 197 | y = std::clamp(y, 0.0f, 1.0f); | 198 | y = std::clamp(y, 0.0f, 1.0f); |
| 198 | 199 | ||
| 200 | // Limit id to maximum number of fingers | ||
| 201 | status.id = std::clamp(status.id, 0, 16); | ||
| 202 | |||
| 199 | if (status.pressed.inverted) { | 203 | if (status.pressed.inverted) { |
| 200 | status.pressed.value = !status.pressed.value; | 204 | status.pressed.value = !status.pressed.value; |
| 201 | } | 205 | } |
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; |