diff options
| author | 2021-07-15 23:43:51 -0500 | |
|---|---|---|
| committer | 2021-07-15 23:56:57 -0500 | |
| commit | 240019fecae5224d0532d0057650f27de017ebad (patch) | |
| tree | 4aa109425266a762f812ab22bf762287de35c2b9 /src/input_common/sdl/sdl_impl.cpp | |
| parent | Merge pull request #6579 from ameerj/float-settings (diff) | |
| download | yuzu-240019fecae5224d0532d0057650f27de017ebad.tar.gz yuzu-240019fecae5224d0532d0057650f27de017ebad.tar.xz yuzu-240019fecae5224d0532d0057650f27de017ebad.zip | |
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.cpp | 6 |
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: | |||
| 660 | 660 | ||
| 661 | if (params.Has("axis")) { | 661 | if (params.Has("axis")) { |
| 662 | const int axis = params.Get("axis", 0); | 662 | const int axis = params.Get("axis", 0); |
| 663 | const float threshold = params.Get("threshold", 0.5f); | 663 | // Convert range from (0.0, 1.0) to (-1.0, 1.0) |
| 664 | const float threshold = (params.Get("threshold", 0.5f) - 0.5f) * 2.0f; | ||
| 664 | const std::string direction_name = params.Get("direction", ""); | 665 | const std::string direction_name = params.Get("direction", ""); |
| 665 | bool trigger_if_greater; | 666 | bool trigger_if_greater; |
| 666 | if (direction_name == "+") { | 667 | if (direction_name == "+") { |
| @@ -933,12 +934,11 @@ Common::ParamPackage BuildAnalogParamPackageForButton(int port, std::string guid | |||
| 933 | params.Set("port", port); | 934 | params.Set("port", port); |
| 934 | params.Set("guid", std::move(guid)); | 935 | params.Set("guid", std::move(guid)); |
| 935 | params.Set("axis", axis); | 936 | params.Set("axis", axis); |
| 937 | params.Set("threshold", "0.5"); | ||
| 936 | if (value > 0) { | 938 | if (value > 0) { |
| 937 | params.Set("direction", "+"); | 939 | params.Set("direction", "+"); |
| 938 | params.Set("threshold", "0.5"); | ||
| 939 | } else { | 940 | } else { |
| 940 | params.Set("direction", "-"); | 941 | params.Set("direction", "-"); |
| 941 | params.Set("threshold", "-0.5"); | ||
| 942 | } | 942 | } |
| 943 | return params; | 943 | return params; |
| 944 | } | 944 | } |