2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Merge pull request #2968 from FreddyFunk/fix-zl-zr-analog-triggers

yuzu/configure_input_player: Fix input handling for ZL and ZR from controllers with analog triggers
This commit is contained in:
bunnei 2019-10-14 13:04:49 -04:00 committed by GitHub
commit c274fd588d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -245,9 +245,23 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
button->setContextMenuPolicy(Qt::CustomContextMenu); button->setContextMenuPolicy(Qt::CustomContextMenu);
connect(button, &QPushButton::clicked, [=] { connect(button, &QPushButton::clicked, [=] {
HandleClick( HandleClick(button_map[button_id],
button_map[button_id], [=](Common::ParamPackage params) {
[=](const Common::ParamPackage& params) { buttons_param[button_id] = 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);
},
InputCommon::Polling::DeviceType::Button); InputCommon::Polling::DeviceType::Button);
}); });
connect(button, &QPushButton::customContextMenuRequested, [=](const QPoint& menu_location) { connect(button, &QPushButton::customContextMenuRequested, [=](const QPoint& menu_location) {