summaryrefslogtreecommitdiffstats
path: root/src/core/hid/input_converter.cpp
diff options
context:
space:
mode:
authorgerman77 <juangerman-13@hotmail.com>2022-05-23 03:34:32 +0200
committerNarr the Reg <juangerman-13@hotmail.com>2022-05-23 18:01:14 +0200
commitc82806f9cb88f390ae3fb048ba7ff2bb138fa3ec (patch)
tree60f52dfd3e59f1424d03ab71a8cb28b9b845d486 /src/core/hid/input_converter.cpp
parentMerge pull request #8342 from lat9nq/clang-latest-stdc++ (diff)
downloadyuzu-c82806f9cb88f390ae3fb048ba7ff2bb138fa3ec.tar
yuzu-c82806f9cb88f390ae3fb048ba7ff2bb138fa3ec.tar.gz
yuzu-c82806f9cb88f390ae3fb048ba7ff2bb138fa3ec.tar.bz2
yuzu-c82806f9cb88f390ae3fb048ba7ff2bb138fa3ec.tar.lz
yuzu-c82806f9cb88f390ae3fb048ba7ff2bb138fa3ec.tar.xz
yuzu-c82806f9cb88f390ae3fb048ba7ff2bb138fa3ec.tar.zst
yuzu-c82806f9cb88f390ae3fb048ba7ff2bb138fa3ec.zip
Diffstat (limited to 'src/core/hid/input_converter.cpp')
-rw-r--r--src/core/hid/input_converter.cpp4
1 files changed, 4 insertions, 0 deletions
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;
}