diff options
author | bunnei <bunneidev@gmail.com> | 2022-05-27 21:16:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-27 21:16:03 +0200 |
commit | 439e6216740f0ad01e88978147f02f70d182f498 (patch) | |
tree | 3873d1660b42dcb17fdacd01990500055495d3ae /src/core/hid | |
parent | Merge pull request #8381 from lat9nq/path-util-pointer-bool (diff) | |
parent | input_common: touch: Rewrite touch driver to support multiple touch points (diff) | |
download | yuzu-439e6216740f0ad01e88978147f02f70d182f498.tar yuzu-439e6216740f0ad01e88978147f02f70d182f498.tar.gz yuzu-439e6216740f0ad01e88978147f02f70d182f498.tar.bz2 yuzu-439e6216740f0ad01e88978147f02f70d182f498.tar.lz yuzu-439e6216740f0ad01e88978147f02f70d182f498.tar.xz yuzu-439e6216740f0ad01e88978147f02f70d182f498.tar.zst yuzu-439e6216740f0ad01e88978147f02f70d182f498.zip |
Diffstat (limited to 'src/core/hid')
-rw-r--r-- | src/core/hid/emulated_console.cpp | 15 | ||||
-rw-r--r-- | src/core/hid/input_converter.cpp | 4 |
2 files changed, 15 insertions, 4 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() { // We can't use mouse as touch if native mouse is enabled touch_params[index++] = Common::ParamPackage{"engine:mouse,axis_x:10,axis_y:11,button:0"}; } - touch_params[index++] = Common::ParamPackage{"engine:touch,axis_x:0,axis_y:1,button:0"}; - touch_params[index++] = Common::ParamPackage{"engine:touch,axis_x:2,axis_y:3,button:1"}; + + touch_params[index++] = + Common::ParamPackage{"engine:touch,axis_x:0,axis_y:1,button:0,touch_id:0"}; + touch_params[index++] = + Common::ParamPackage{"engine:touch,axis_x:2,axis_y:3,button:1,touch_id:1"}; + touch_params[index++] = + Common::ParamPackage{"engine:touch,axis_x:4,axis_y:5,button:2,touch_id:2"}; + touch_params[index++] = + Common::ParamPackage{"engine:touch,axis_x:6,axis_y:7,button:3,touch_id:3"}; touch_params[index++] = - Common::ParamPackage{"engine:cemuhookudp,axis_x:17,axis_y:18,button:65536"}; + Common::ParamPackage{"engine:cemuhookudp,axis_x:17,axis_y:18,button:65536,touch_id:0"}; touch_params[index++] = - Common::ParamPackage{"engine:cemuhookudp,axis_x:19,axis_y:20,button:131072"}; + Common::ParamPackage{"engine:cemuhookudp,axis_x:19,axis_y:20,button:131072,touch_id:1"}; const auto button_index = 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 @@ // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include <algorithm> #include <random> #include "common/input.h" @@ -196,6 +197,9 @@ Common::Input::TouchStatus TransformToTouch(const Common::Input::CallbackStatus& x = std::clamp(x, 0.0f, 1.0f); y = std::clamp(y, 0.0f, 1.0f); + // Limit id to maximum number of fingers + status.id = std::clamp(status.id, 0, 16); + if (status.pressed.inverted) { status.pressed.value = !status.pressed.value; } |