forked from suyu/suyu
yuzu: Config allow to delete single axis directions when buttons are mapped to a stick
This commit is contained in:
parent
d2388a2ca8
commit
17ce54d7f2
2 changed files with 24 additions and 3 deletions
|
@ -327,7 +327,7 @@ void SanitizeStick(Common::Input::AnalogStatus& analog_x, Common::Input::AnalogS
|
||||||
raw_y += properties_y.offset;
|
raw_y += properties_y.offset;
|
||||||
|
|
||||||
// Apply X scale correction from offset
|
// Apply X scale correction from offset
|
||||||
if (std::abs(properties_x.offset) < 0.5f) {
|
if (std::abs(properties_x.offset) < 0.75f) {
|
||||||
if (raw_x > 0) {
|
if (raw_x > 0) {
|
||||||
raw_x /= 1 + properties_x.offset;
|
raw_x /= 1 + properties_x.offset;
|
||||||
} else {
|
} else {
|
||||||
|
@ -336,7 +336,7 @@ void SanitizeStick(Common::Input::AnalogStatus& analog_x, Common::Input::AnalogS
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply Y scale correction from offset
|
// Apply Y scale correction from offset
|
||||||
if (std::abs(properties_y.offset) < 0.5f) {
|
if (std::abs(properties_y.offset) < 0.75f) {
|
||||||
if (raw_y > 0) {
|
if (raw_y > 0) {
|
||||||
raw_y /= 1 + properties_y.offset;
|
raw_y /= 1 + properties_y.offset;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -520,7 +520,28 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
|
||||||
QMenu context_menu;
|
QMenu context_menu;
|
||||||
Common::ParamPackage param = emulated_controller->GetStickParam(analog_id);
|
Common::ParamPackage param = emulated_controller->GetStickParam(analog_id);
|
||||||
context_menu.addAction(tr("Clear"), [&] {
|
context_menu.addAction(tr("Clear"), [&] {
|
||||||
emulated_controller->SetStickParam(analog_id, {});
|
if (param.Get("engine", "") != "analog_from_button") {
|
||||||
|
emulated_controller->SetStickParam(analog_id, {});
|
||||||
|
for (auto button : analog_map_buttons[analog_id]) {
|
||||||
|
button->setText(tr("[not set]"));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (sub_button_id) {
|
||||||
|
case 0:
|
||||||
|
param.Erase("up");
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
param.Erase("down");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
param.Erase("left");
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
param.Erase("right");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
emulated_controller->SetStickParam(analog_id, param);
|
||||||
analog_map_buttons[analog_id][sub_button_id]->setText(tr("[not set]"));
|
analog_map_buttons[analog_id][sub_button_id]->setText(tr("[not set]"));
|
||||||
});
|
});
|
||||||
context_menu.addAction(tr("Center axis"), [&] {
|
context_menu.addAction(tr("Center axis"), [&] {
|
||||||
|
|
Loading…
Reference in a new issue