input_common: Map sticks correctly when mapped sideways

This commit is contained in:
Narr the Reg
2022-03-04 11:47:13 -06:00
parent 82ac66f8a4
commit ee532e5c01
10 changed files with 127 additions and 0 deletions

View File

@ -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);