summaryrefslogtreecommitdiffstats
path: root/src/input_common
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-07-22 02:31:33 +0200
committerGitHub <noreply@github.com>2021-07-22 02:31:33 +0200
commitdff438e219311fff8bdd8d9e2b55773c9189323d (patch)
tree311b68e17bd436521789bc16be77859d6fcca209 /src/input_common
parentci: Increase mainline build timeout. (diff)
parentconfigure/ui: Add sliders for trigger buttons (diff)
downloadyuzu-dff438e219311fff8bdd8d9e2b55773c9189323d.tar
yuzu-dff438e219311fff8bdd8d9e2b55773c9189323d.tar.gz
yuzu-dff438e219311fff8bdd8d9e2b55773c9189323d.tar.bz2
yuzu-dff438e219311fff8bdd8d9e2b55773c9189323d.tar.lz
yuzu-dff438e219311fff8bdd8d9e2b55773c9189323d.tar.xz
yuzu-dff438e219311fff8bdd8d9e2b55773c9189323d.tar.zst
yuzu-dff438e219311fff8bdd8d9e2b55773c9189323d.zip
Diffstat (limited to 'src/input_common')
-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:
if (params.Has("axis")) {
const int axis = params.Get("axis", 0);
- const float threshold = params.Get("threshold", 0.5f);
+ // Convert range from (0.0, 1.0) to (-1.0, 1.0)
+ const float threshold = (params.Get("threshold", 0.5f) - 0.5f) * 2.0f;
const std::string direction_name = params.Get("direction", "");
bool trigger_if_greater;
if (direction_name == "+") {
@@ -980,12 +981,11 @@ Common::ParamPackage BuildAnalogParamPackageForButton(int port, std::string guid
params.Set("port", port);
params.Set("guid", std::move(guid));
params.Set("axis", axis);
+ params.Set("threshold", "0.5");
if (value > 0) {
params.Set("direction", "+");
- params.Set("threshold", "0.5");
} else {
params.Set("direction", "-");
- params.Set("threshold", "-0.5");
}
return params;
}