Port yuzu-emu/yuzu#2968: configure_input: Fix input handling for ZL and ZR from controllers with analog triggers (#4984)
Co-authored-by: Frederic L. <freddyfunk@users.noreply.github.com>
This commit is contained in:
parent
ccb50e7f2c
commit
ae3d50f71f
|
@ -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();
|
||||
|
|
Reference in New Issue