diff options
Diffstat (limited to '')
| -rw-r--r-- | src/input_common/sdl/sdl_impl.cpp | 6 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input_player.cpp | 10 |
2 files changed, 13 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 | } |
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp index d5d624b96..0d98e0986 100644 --- a/src/yuzu/configuration/configure_input_player.cpp +++ b/src/yuzu/configuration/configure_input_player.cpp | |||
| @@ -313,6 +313,16 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i | |||
| 313 | buttons_param[button_id].Set("toggle", toggle_value); | 313 | buttons_param[button_id].Set("toggle", toggle_value); |
| 314 | button_map[button_id]->setText(ButtonToText(buttons_param[button_id])); | 314 | button_map[button_id]->setText(ButtonToText(buttons_param[button_id])); |
| 315 | }); | 315 | }); |
| 316 | if (buttons_param[button_id].Has("threshold")) { | ||
| 317 | context_menu.addAction(tr("Set threshold"), [&] { | ||
| 318 | const int button_threshold = static_cast<int>( | ||
| 319 | buttons_param[button_id].Get("threshold", 0.5f) * 100.0f); | ||
| 320 | const int new_threshold = QInputDialog::getInt( | ||
| 321 | this, tr("Set threshold"), tr("Choose a value between 0% and 100%"), | ||
| 322 | button_threshold, 0, 100); | ||
| 323 | buttons_param[button_id].Set("threshold", new_threshold / 100.0f); | ||
| 324 | }); | ||
| 325 | } | ||
| 316 | context_menu.exec(button_map[button_id]->mapToGlobal(menu_location)); | 326 | context_menu.exec(button_map[button_id]->mapToGlobal(menu_location)); |
| 317 | ui->controllerFrame->SetPlayerInput(player_index, buttons_param, analogs_param); | 327 | ui->controllerFrame->SetPlayerInput(player_index, buttons_param, analogs_param); |
| 318 | }); | 328 | }); |