diff options
| author | 2022-05-03 14:36:39 -0700 | |
|---|---|---|
| committer | 2022-05-03 14:36:39 -0700 | |
| commit | b06f9f2606b7e2965d17e9df4b9a738b425b3cd8 (patch) | |
| tree | 6d4565f25984a5325cc2c13c69600daf44452b31 | |
| parent | Merge pull request #8296 from Morph1984/result-range (diff) | |
| parent | yuzu: Config allow to delete single axis directions when buttons are mapped t... (diff) | |
| download | yuzu-b06f9f2606b7e2965d17e9df4b9a738b425b3cd8.tar.gz yuzu-b06f9f2606b7e2965d17e9df4b9a738b425b3cd8.tar.xz yuzu-b06f9f2606b7e2965d17e9df4b9a738b425b3cd8.zip | |
Merge pull request #8272 from german77/stick_range
yuzu: config: Improve analog stick mapping
Diffstat (limited to '')
| -rw-r--r-- | src/core/hid/input_converter.cpp | 4 | ||||
| -rw-r--r-- | src/input_common/input_poller.cpp | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input_player.cpp | 25 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input_player.ui | 8 |
4 files changed, 30 insertions, 9 deletions
diff --git a/src/core/hid/input_converter.cpp b/src/core/hid/input_converter.cpp index ee228e39b..3c26260f3 100644 --- a/src/core/hid/input_converter.cpp +++ b/src/core/hid/input_converter.cpp | |||
| @@ -327,7 +327,7 @@ void SanitizeStick(Common::Input::AnalogStatus& analog_x, Common::Input::AnalogS | |||
| 327 | raw_y += properties_y.offset; | 327 | raw_y += properties_y.offset; |
| 328 | 328 | ||
| 329 | // Apply X scale correction from offset | 329 | // Apply X scale correction from offset |
| 330 | if (std::abs(properties_x.offset) < 0.5f) { | 330 | if (std::abs(properties_x.offset) < 0.75f) { |
| 331 | if (raw_x > 0) { | 331 | if (raw_x > 0) { |
| 332 | raw_x /= 1 + properties_x.offset; | 332 | raw_x /= 1 + properties_x.offset; |
| 333 | } else { | 333 | } else { |
| @@ -336,7 +336,7 @@ void SanitizeStick(Common::Input::AnalogStatus& analog_x, Common::Input::AnalogS | |||
| 336 | } | 336 | } |
| 337 | 337 | ||
| 338 | // Apply Y scale correction from offset | 338 | // Apply Y scale correction from offset |
| 339 | if (std::abs(properties_y.offset) < 0.5f) { | 339 | if (std::abs(properties_y.offset) < 0.75f) { |
| 340 | if (raw_y > 0) { | 340 | if (raw_y > 0) { |
| 341 | raw_y /= 1 + properties_y.offset; | 341 | raw_y /= 1 + properties_y.offset; |
| 342 | } else { | 342 | } else { |
diff --git a/src/input_common/input_poller.cpp b/src/input_common/input_poller.cpp index 99d6c3cd6..49ccb4422 100644 --- a/src/input_common/input_poller.cpp +++ b/src/input_common/input_poller.cpp | |||
| @@ -732,7 +732,7 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateHatButtonDevice( | |||
| 732 | std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateStickDevice( | 732 | std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateStickDevice( |
| 733 | const Common::ParamPackage& params) { | 733 | const Common::ParamPackage& params) { |
| 734 | const auto deadzone = std::clamp(params.Get("deadzone", 0.15f), 0.0f, 1.0f); | 734 | const auto deadzone = std::clamp(params.Get("deadzone", 0.15f), 0.0f, 1.0f); |
| 735 | const auto range = std::clamp(params.Get("range", 1.0f), 0.25f, 1.50f); | 735 | const auto range = std::clamp(params.Get("range", 0.95f), 0.25f, 1.50f); |
| 736 | const auto threshold = std::clamp(params.Get("threshold", 0.5f), 0.0f, 1.0f); | 736 | const auto threshold = std::clamp(params.Get("threshold", 0.5f), 0.0f, 1.0f); |
| 737 | const PadIdentifier identifier = { | 737 | const PadIdentifier identifier = { |
| 738 | .guid = Common::UUID{params.Get("guid", "")}, | 738 | .guid = Common::UUID{params.Get("guid", "")}, |
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp index b4f5d172a..1c05dd0f3 100644 --- a/src/yuzu/configuration/configure_input_player.cpp +++ b/src/yuzu/configuration/configure_input_player.cpp | |||
| @@ -520,7 +520,28 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i | |||
| 520 | QMenu context_menu; | 520 | QMenu context_menu; |
| 521 | Common::ParamPackage param = emulated_controller->GetStickParam(analog_id); | 521 | Common::ParamPackage param = emulated_controller->GetStickParam(analog_id); |
| 522 | context_menu.addAction(tr("Clear"), [&] { | 522 | context_menu.addAction(tr("Clear"), [&] { |
| 523 | emulated_controller->SetStickParam(analog_id, {}); | 523 | if (param.Get("engine", "") != "analog_from_button") { |
| 524 | emulated_controller->SetStickParam(analog_id, {}); | ||
| 525 | for (auto button : analog_map_buttons[analog_id]) { | ||
| 526 | button->setText(tr("[not set]")); | ||
| 527 | } | ||
| 528 | return; | ||
| 529 | } | ||
| 530 | switch (sub_button_id) { | ||
| 531 | case 0: | ||
| 532 | param.Erase("up"); | ||
| 533 | break; | ||
| 534 | case 1: | ||
| 535 | param.Erase("down"); | ||
| 536 | break; | ||
| 537 | case 2: | ||
| 538 | param.Erase("left"); | ||
| 539 | break; | ||
| 540 | case 3: | ||
| 541 | param.Erase("right"); | ||
| 542 | break; | ||
| 543 | } | ||
| 544 | emulated_controller->SetStickParam(analog_id, param); | ||
| 524 | analog_map_buttons[analog_id][sub_button_id]->setText(tr("[not set]")); | 545 | analog_map_buttons[analog_id][sub_button_id]->setText(tr("[not set]")); |
| 525 | }); | 546 | }); |
| 526 | context_menu.addAction(tr("Center axis"), [&] { | 547 | context_menu.addAction(tr("Center axis"), [&] { |
| @@ -988,7 +1009,7 @@ void ConfigureInputPlayer::UpdateUI() { | |||
| 988 | slider_value = static_cast<int>(param.Get("deadzone", 0.15f) * 100); | 1009 | slider_value = static_cast<int>(param.Get("deadzone", 0.15f) * 100); |
| 989 | deadzone_label->setText(tr("Deadzone: %1%").arg(slider_value)); | 1010 | deadzone_label->setText(tr("Deadzone: %1%").arg(slider_value)); |
| 990 | deadzone_slider->setValue(slider_value); | 1011 | deadzone_slider->setValue(slider_value); |
| 991 | range_spinbox->setValue(static_cast<int>(param.Get("range", 1.0f) * 100)); | 1012 | range_spinbox->setValue(static_cast<int>(param.Get("range", 0.95f) * 100)); |
| 992 | } else { | 1013 | } else { |
| 993 | slider_value = static_cast<int>(param.Get("modifier_scale", 0.5f) * 100); | 1014 | slider_value = static_cast<int>(param.Get("modifier_scale", 0.5f) * 100); |
| 994 | modifier_label->setText(tr("Modifier Range: %1%").arg(slider_value)); | 1015 | modifier_label->setText(tr("Modifier Range: %1%").arg(slider_value)); |
diff --git a/src/yuzu/configuration/configure_input_player.ui b/src/yuzu/configuration/configure_input_player.ui index 756a414b5..a62b57501 100644 --- a/src/yuzu/configuration/configure_input_player.ui +++ b/src/yuzu/configuration/configure_input_player.ui | |||
| @@ -754,13 +754,13 @@ | |||
| 754 | <string>%</string> | 754 | <string>%</string> |
| 755 | </property> | 755 | </property> |
| 756 | <property name="minimum"> | 756 | <property name="minimum"> |
| 757 | <number>50</number> | 757 | <number>25</number> |
| 758 | </property> | 758 | </property> |
| 759 | <property name="maximum"> | 759 | <property name="maximum"> |
| 760 | <number>150</number> | 760 | <number>150</number> |
| 761 | </property> | 761 | </property> |
| 762 | <property name="value"> | 762 | <property name="value"> |
| 763 | <number>100</number> | 763 | <number>95</number> |
| 764 | </property> | 764 | </property> |
| 765 | </widget> | 765 | </widget> |
| 766 | </item> | 766 | </item> |
| @@ -2985,13 +2985,13 @@ | |||
| 2985 | <string>%</string> | 2985 | <string>%</string> |
| 2986 | </property> | 2986 | </property> |
| 2987 | <property name="minimum"> | 2987 | <property name="minimum"> |
| 2988 | <number>50</number> | 2988 | <number>25</number> |
| 2989 | </property> | 2989 | </property> |
| 2990 | <property name="maximum"> | 2990 | <property name="maximum"> |
| 2991 | <number>150</number> | 2991 | <number>150</number> |
| 2992 | </property> | 2992 | </property> |
| 2993 | <property name="value"> | 2993 | <property name="value"> |
| 2994 | <number>100</number> | 2994 | <number>95</number> |
| 2995 | </property> | 2995 | </property> |
| 2996 | </widget> | 2996 | </widget> |
| 2997 | </item> | 2997 | </item> |