summaryrefslogtreecommitdiff
path: root/src/input_common/sdl/sdl_impl.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2021-07-21 20:31:33 -0400
committerGravatar GitHub2021-07-21 20:31:33 -0400
commitdff438e219311fff8bdd8d9e2b55773c9189323d (patch)
tree311b68e17bd436521789bc16be77859d6fcca209 /src/input_common/sdl/sdl_impl.cpp
parentci: Increase mainline build timeout. (diff)
parentconfigure/ui: Add sliders for trigger buttons (diff)
downloadyuzu-dff438e219311fff8bdd8d9e2b55773c9189323d.tar.gz
yuzu-dff438e219311fff8bdd8d9e2b55773c9189323d.tar.xz
yuzu-dff438e219311fff8bdd8d9e2b55773c9189323d.zip
Merge pull request #6654 from german77/custom_threshold
input_common: Make button threshold customizable
Diffstat (limited to 'src/input_common/sdl/sdl_impl.cpp')
-rw-r--r--src/input_common/sdl/sdl_impl.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/input_common/sdl/sdl_impl.cpp b/src/input_common/sdl/sdl_impl.cpp
index 7778b3562..70a0ba09c 100644
--- a/src/input_common/sdl/sdl_impl.cpp
+++ b/src/input_common/sdl/sdl_impl.cpp
@@ -707,7 +707,8 @@ public:
707 707
708 if (params.Has("axis")) { 708 if (params.Has("axis")) {
709 const int axis = params.Get("axis", 0); 709 const int axis = params.Get("axis", 0);
710 const float threshold = params.Get("threshold", 0.5f); 710 // Convert range from (0.0, 1.0) to (-1.0, 1.0)
711 const float threshold = (params.Get("threshold", 0.5f) - 0.5f) * 2.0f;
711 const std::string direction_name = params.Get("direction", ""); 712 const std::string direction_name = params.Get("direction", "");
712 bool trigger_if_greater; 713 bool trigger_if_greater;
713 if (direction_name == "+") { 714 if (direction_name == "+") {
@@ -980,12 +981,11 @@ Common::ParamPackage BuildAnalogParamPackageForButton(int port, std::string guid
980 params.Set("port", port); 981 params.Set("port", port);
981 params.Set("guid", std::move(guid)); 982 params.Set("guid", std::move(guid));
982 params.Set("axis", axis); 983 params.Set("axis", axis);
984 params.Set("threshold", "0.5");
983 if (value > 0) { 985 if (value > 0) {
984 params.Set("direction", "+"); 986 params.Set("direction", "+");
985 params.Set("threshold", "0.5");
986 } else { 987 } else {
987 params.Set("direction", "-"); 988 params.Set("direction", "-");
988 params.Set("threshold", "-0.5");
989 } 989 }
990 return params; 990 return params;
991} 991}