Fix configuration of analog shoulder buttons for analog turbo/slow motion when using a PS5 controller
[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;
}
}
}
