This commit is contained in:
Kyle Kienapfel 2024-03-03 02:10:53 +13:00 committed by GitHub
commit bf5e540aac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 0 deletions

View File

@ -723,6 +723,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;
}
@ -759,6 +762,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

@ -370,6 +370,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) {
@ -442,6 +443,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));
});
@ -495,6 +510,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);
}
@ -1470,6 +1486,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);