Fix configuration of analog shoulder buttons for analog turbo/slow motion when using a PS5 controller

This commit is contained in:
Lior Halphon 2021-06-01 00:46:06 +03:00
parent 1e5e236e84
commit b444ecd1ee
1 changed files with 28 additions and 13 deletions

View File

@ -491,18 +491,33 @@
[GBUnderclock] = JOYButtonUsageR1,
};
// Todo: JoyKit might need an API to match an axis to a button
if (joystick_configuration_state == GBUnderclock) {
for (JOYAxis *axis in controller.axes) {
if (axis.value > 0.5) {
if (axis.value > 0.5 ||
(axis.usage == JOYAxisUsageL1 && button.usage == JOYButtonUsageL1) ||
(axis.usage == JOYAxisUsageL2 && button.usage == JOYButtonUsageL2) ||
(axis.usage == JOYAxisUsageL3 && button.usage == JOYButtonUsageL3) ||
(axis.usage == JOYAxisUsageR1 && button.usage == JOYButtonUsageR1) ||
(axis.usage == JOYAxisUsageR2 && button.usage == JOYButtonUsageR2) ||
(axis.usage == JOYAxisUsageR3 && button.usage == JOYButtonUsageR3)) {
mapping[@"AnalogUnderclock"] = @(axis.uniqueID);
break;
}
}
}
if (joystick_configuration_state == GBTurbo) {
for (JOYAxis *axis in controller.axes) {
if (axis.value > 0.5) {
if (axis.value > 0.5 ||
(axis.usage == JOYAxisUsageL1 && button.usage == JOYButtonUsageL1) ||
(axis.usage == JOYAxisUsageL2 && button.usage == JOYButtonUsageL2) ||
(axis.usage == JOYAxisUsageL3 && button.usage == JOYButtonUsageL3) ||
(axis.usage == JOYAxisUsageR1 && button.usage == JOYButtonUsageR1) ||
(axis.usage == JOYAxisUsageR2 && button.usage == JOYButtonUsageR2) ||
(axis.usage == JOYAxisUsageR3 && button.usage == JOYButtonUsageR3)) {
mapping[@"AnalogTurbo"] = @(axis.uniqueID);
break;
}
}
}