diff options
Diffstat (limited to '')
| -rw-r--r-- | src/common/input.h | 2 | ||||
| -rw-r--r-- | src/core/hid/input_converter.cpp | 1 | ||||
| -rw-r--r-- | src/input_common/input_poller.cpp | 1 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input_player.cpp | 10 |
4 files changed, 12 insertions, 2 deletions
diff --git a/src/common/input.h b/src/common/input.h index 51b277c1f..66fb15f0a 100644 --- a/src/common/input.h +++ b/src/common/input.h | |||
| @@ -111,6 +111,8 @@ struct AnalogProperties { | |||
| 111 | float offset{}; | 111 | float offset{}; |
| 112 | // Invert direction of the sensor data | 112 | // Invert direction of the sensor data |
| 113 | bool inverted{}; | 113 | bool inverted{}; |
| 114 | // Invert the state if it's converted to a button | ||
| 115 | bool inverted_button{}; | ||
| 114 | // Press once to activate, press again to release | 116 | // Press once to activate, press again to release |
| 115 | bool toggle{}; | 117 | bool toggle{}; |
| 116 | }; | 118 | }; |
diff --git a/src/core/hid/input_converter.cpp b/src/core/hid/input_converter.cpp index 7cee39a53..a38e3bb3f 100644 --- a/src/core/hid/input_converter.cpp +++ b/src/core/hid/input_converter.cpp | |||
| @@ -54,6 +54,7 @@ Common::Input::ButtonStatus TransformToButton(const Common::Input::CallbackStatu | |||
| 54 | case Common::Input::InputType::Analog: | 54 | case Common::Input::InputType::Analog: |
| 55 | status.value = TransformToTrigger(callback).pressed.value; | 55 | status.value = TransformToTrigger(callback).pressed.value; |
| 56 | status.toggle = callback.analog_status.properties.toggle; | 56 | status.toggle = callback.analog_status.properties.toggle; |
| 57 | status.inverted = callback.analog_status.properties.inverted_button; | ||
| 57 | break; | 58 | break; |
| 58 | case Common::Input::InputType::Trigger: | 59 | case Common::Input::InputType::Trigger: |
| 59 | status.value = TransformToTrigger(callback).pressed.value; | 60 | status.value = TransformToTrigger(callback).pressed.value; |
diff --git a/src/input_common/input_poller.cpp b/src/input_common/input_poller.cpp index 8c6a6521a..5c2c4a463 100644 --- a/src/input_common/input_poller.cpp +++ b/src/input_common/input_poller.cpp | |||
| @@ -939,6 +939,7 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateAnalogDevice( | |||
| 939 | .threshold = std::clamp(params.Get("threshold", 0.5f), 0.0f, 1.0f), | 939 | .threshold = std::clamp(params.Get("threshold", 0.5f), 0.0f, 1.0f), |
| 940 | .offset = std::clamp(params.Get("offset", 0.0f), -1.0f, 1.0f), | 940 | .offset = std::clamp(params.Get("offset", 0.0f), -1.0f, 1.0f), |
| 941 | .inverted = params.Get("invert", "+") == "-", | 941 | .inverted = params.Get("invert", "+") == "-", |
| 942 | .inverted_button = params.Get("inverted", false) != 0, | ||
| 942 | .toggle = params.Get("toggle", false) != 0, | 943 | .toggle = params.Get("toggle", false) != 0, |
| 943 | }; | 944 | }; |
| 944 | input_engine->PreSetController(identifier); | 945 | input_engine->PreSetController(identifier); |
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp index 50b62293e..54f42e0c9 100644 --- a/src/yuzu/configuration/configure_input_player.cpp +++ b/src/yuzu/configuration/configure_input_player.cpp | |||
| @@ -206,7 +206,7 @@ QString ConfigureInputPlayer::ButtonToText(const Common::ParamPackage& param) { | |||
| 206 | } | 206 | } |
| 207 | if (param.Has("axis")) { | 207 | if (param.Has("axis")) { |
| 208 | const QString axis = QString::fromStdString(param.Get("axis", "")); | 208 | const QString axis = QString::fromStdString(param.Get("axis", "")); |
| 209 | return QObject::tr("%1%2Axis %3").arg(toggle, invert, axis); | 209 | return QObject::tr("%1%2%3Axis %4").arg(toggle, inverted, invert, axis); |
| 210 | } | 210 | } |
| 211 | if (param.Has("axis_x") && param.Has("axis_y") && param.Has("axis_z")) { | 211 | if (param.Has("axis_x") && param.Has("axis_y") && param.Has("axis_z")) { |
| 212 | const QString axis_x = QString::fromStdString(param.Get("axis_x", "")); | 212 | const QString axis_x = QString::fromStdString(param.Get("axis_x", "")); |
| @@ -229,7 +229,7 @@ QString ConfigureInputPlayer::ButtonToText(const Common::ParamPackage& param) { | |||
| 229 | return QObject::tr("%1%2%3Hat %4").arg(turbo, toggle, inverted, button_name); | 229 | return QObject::tr("%1%2%3Hat %4").arg(turbo, toggle, inverted, button_name); |
| 230 | } | 230 | } |
| 231 | if (param.Has("axis")) { | 231 | if (param.Has("axis")) { |
| 232 | return QObject::tr("%1%2Axis %3").arg(toggle, inverted, button_name); | 232 | return QObject::tr("%1%2%3Axis %4").arg(toggle, inverted, invert, button_name); |
| 233 | } | 233 | } |
| 234 | if (param.Has("motion")) { | 234 | if (param.Has("motion")) { |
| 235 | return QObject::tr("%1%2Axis %3").arg(toggle, inverted, button_name); | 235 | return QObject::tr("%1%2Axis %3").arg(toggle, inverted, button_name); |
| @@ -410,6 +410,12 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i | |||
| 410 | button_map[button_id]->setText(ButtonToText(param)); | 410 | button_map[button_id]->setText(ButtonToText(param)); |
| 411 | emulated_controller->SetButtonParam(button_id, param); | 411 | emulated_controller->SetButtonParam(button_id, param); |
| 412 | }); | 412 | }); |
| 413 | context_menu.addAction(tr("Invert button"), [&] { | ||
| 414 | const bool invert_value = !param.Get("inverted", false); | ||
| 415 | param.Set("inverted", invert_value); | ||
| 416 | button_map[button_id]->setText(ButtonToText(param)); | ||
| 417 | emulated_controller->SetButtonParam(button_id, param); | ||
| 418 | }); | ||
| 413 | context_menu.addAction(tr("Set threshold"), [&] { | 419 | context_menu.addAction(tr("Set threshold"), [&] { |
| 414 | const int button_threshold = | 420 | const int button_threshold = |
| 415 | static_cast<int>(param.Get("threshold", 0.5f) * 100.0f); | 421 | static_cast<int>(param.Get("threshold", 0.5f) * 100.0f); |