Draft: trying to tweak ZL/ZR triggering

This is related to Issue 9096
This commit is contained in:
Kyle Kienapfel 2022-10-21 04:11:32 -07:00
parent c75a4bdeaa
commit de406d2728
2 changed files with 21 additions and 0 deletions

View File

@ -579,6 +579,9 @@ Common::ParamPackage SDLDriver::BuildAnalogParamPackageForButton(int port, const
params.Set("guid", guid.RawString());
params.Set("axis", axis);
params.Set("threshold", "0.5");
LOG_INFO(Frontend, "This didn't work");
params.Set("range", "2");
params.Set("offset", "-1.000000");
params.Set("invert", value < 0 ? "-" : "+");
return params;
}
@ -615,6 +618,7 @@ Common::ParamPackage SDLDriver::BuildMotionParam(int port, const Common::UUID& g
Common::ParamPackage SDLDriver::BuildParamPackageForBinding(
int port, const Common::UUID& guid, const SDL_GameControllerButtonBind& binding) const {
LOG_INFO(Frontend, "I thought this would get called when I bind the axis");
switch (binding.bindType) {
case SDL_CONTROLLER_BINDTYPE_NONE:
break;

View File

@ -345,6 +345,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
}
connect(button, &QPushButton::clicked, [=, this] {
LOG_INFO(Frontend, "Wheee");
HandleClick(
button, button_id,
[=, this](const Common::ParamPackage& params) {
@ -405,6 +406,20 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
button_map[button_id]->setText(ButtonToText(param));
emulated_controller->SetButtonParam(button_id, param);
});
context_menu.addAction(tr("Toggle Offset"), [&] {
int offset = param.Get("offset", 0);
if (offset == 0) {
LOG_INFO(Frontend, "Boosting offset/range");
param.Set("offset", -1.0f);
param.Set("range", 2);
} else {
LOG_INFO(Frontend, "Unboosting offset/range");
param.Set("offset", 0);
param.Set("range", 1);
}
button_map[button_id]->setText(ButtonToText(param));
emulated_controller->SetButtonParam(button_id, param);
});
}
context_menu.exec(button_map[button_id]->mapToGlobal(menu_location));
});
@ -455,6 +470,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
emulated_controller->GetButtonParam(Settings::NativeButton::ZL);
if (param.Has("threshold")) {
const auto slider_value = ui->sliderZLThreshold->value();
ui->sliderZLThreshold->setToolTip(QString::number(ui->sliderZLThreshold->value()));
param.Set("threshold", slider_value / 100.0f);
emulated_controller->SetButtonParam(Settings::NativeButton::ZL, param);
}
@ -1412,6 +1428,7 @@ void ConfigureInputPlayer::HandleClick(
QWidget::grabKeyboard();
if (type == InputCommon::Polling::InputType::Button) {
LOG_INFO(Frontend, "Wheee");
ui->controllerFrame->BeginMappingButton(button_id);
} else if (type == InputCommon::Polling::InputType::Stick) {
ui->controllerFrame->BeginMappingAnalog(button_id);