diff --git a/src/citra_qt/configuration/configure_input.cpp b/src/citra_qt/configuration/configure_input.cpp index be89eee76..6c40b9ebf 100644 --- a/src/citra_qt/configuration/configure_input.cpp +++ b/src/citra_qt/configuration/configure_input.cpp @@ -195,8 +195,21 @@ ConfigureInput::ConfigureInput(QWidget* parent) connect(button_map[button_id], &QPushButton::clicked, [this, button_id]() { HandleClick( button_map[button_id], - [this, button_id](const Common::ParamPackage& params) { - buttons_param[button_id] = params; + [this, button_id](Common::ParamPackage params) { + // Workaround for ZL & ZR for analog triggers like on XBOX controllors. + // Analog triggers (from controllers like the XBOX controller) would not + // work due to a different range of their signals (from 0 to 255 on + // analog triggers instead of -32768 to 32768 on analog joysticks). The + // SDL driver misinterprets analog triggers as analog joysticks. + // TODO: reinterpret the signal range for analog triggers to map the + // values correctly. This is required for the correct emulation of the + // analog triggers of the GameCube controller. + if (button_id == Settings::NativeButton::ZL || + button_id == Settings::NativeButton::ZR) { + params.Set("direction", "+"); + params.Set("threshold", "0.5"); + } + buttons_param[button_id] = std::move(params); // If the user closes the dialog, the changes are reverted in // `GMainWindow::OnConfigure()` ApplyConfiguration();