summaryrefslogtreecommitdiffstats
path: root/src/input_common
diff options
context:
space:
mode:
authorgerman77 <juangerman-13@hotmail.com>2021-07-16 06:43:51 +0200
committergerman77 <juangerman-13@hotmail.com>2021-07-16 06:56:57 +0200
commit240019fecae5224d0532d0057650f27de017ebad (patch)
tree4aa109425266a762f812ab22bf762287de35c2b9 /src/input_common
parentMerge pull request #6579 from ameerj/float-settings (diff)
downloadyuzu-240019fecae5224d0532d0057650f27de017ebad.tar
yuzu-240019fecae5224d0532d0057650f27de017ebad.tar.gz
yuzu-240019fecae5224d0532d0057650f27de017ebad.tar.bz2
yuzu-240019fecae5224d0532d0057650f27de017ebad.tar.lz
yuzu-240019fecae5224d0532d0057650f27de017ebad.tar.xz
yuzu-240019fecae5224d0532d0057650f27de017ebad.tar.zst
yuzu-240019fecae5224d0532d0057650f27de017ebad.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 68672a92b..2f7ccdd37 100644
--- a/src/input_common/sdl/sdl_impl.cpp
+++ b/src/input_common/sdl/sdl_impl.cpp
@@ -660,7 +660,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 == "+") {
@@ -933,12 +934,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;
}