diff options
author | Narr the Reg <juangerman-13@hotmail.com> | 2022-03-04 11:47:13 -0600 |
---|---|---|
committer | Narr the Reg <juangerman-13@hotmail.com> | 2022-03-21 19:39:33 -0600 |
commit | ee532e5c01f97f30078202ae87a5b2a71e9ce1e4 (patch) | |
tree | 55e544838b029e4a78a61e38cb085f5668400837 /src/yuzu/configuration/configure_input_player.cpp | |
parent | 82ac66f8a47f32ac530bcacbe375a52ccdc455c7 (diff) |
input_common: Map sticks correctly when mapped sideways
Diffstat (limited to 'src/yuzu/configuration/configure_input_player.cpp')
-rw-r--r-- | src/yuzu/configuration/configure_input_player.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp index 8ef3596dd6..ac0a9d7de5 100644 --- a/src/yuzu/configuration/configure_input_player.cpp +++ b/src/yuzu/configuration/configure_input_player.cpp @@ -471,6 +471,25 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i [=, this](const Common::ParamPackage& params) { Common::ParamPackage param = emulated_controller->GetStickParam(analog_id); SetAnalogParam(params, param, analog_sub_buttons[sub_button_id]); + // Correct axis direction for inverted sticks + if (input_subsystem->IsStickInverted(param)) { + switch (analog_id) { + case Settings::NativeAnalog::LStick: { + const bool invert_value = param.Get("invert_x", "+") == "-"; + const std::string invert_str = invert_value ? "+" : "-"; + param.Set("invert_x", invert_str); + break; + } + case Settings::NativeAnalog::RStick: { + const bool invert_value = param.Get("invert_y", "+") == "-"; + const std::string invert_str = invert_value ? "+" : "-"; + param.Set("invert_y", invert_str); + break; + } + default: + break; + } + } emulated_controller->SetStickParam(analog_id, param); }, InputCommon::Polling::InputType::Stick); |