Don't tickle Bluetooth PS5 controllers in simple mode with an effects packet That will put the PS5 controller into enhanced mode, which breaks DirectInput games (cherry picked from commit 2fef0be2f646ae048e239aa6694e632081c85238) (cherry picked from commit 910dad505af1684d1a6ebce3a8a371830fd3e50b)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
diff --git a/src/joystick/hidapi/SDL_hidapi_ps5.c b/src/joystick/hidapi/SDL_hidapi_ps5.c
index 8a3608b..db47e32 100644
--- a/src/joystick/hidapi/SDL_hidapi_ps5.c
+++ b/src/joystick/hidapi/SDL_hidapi_ps5.c
@@ -745,16 +745,25 @@ static void HIDAPI_DriverPS5_CheckPendingLEDReset(SDL_HIDAPI_Device *device)
static void HIDAPI_DriverPS5_TickleBluetooth(SDL_HIDAPI_Device *device)
{
- /* This is just a dummy packet that should have no effect, since we don't set the CRC */
- Uint8 data[78];
+ SDL_DriverPS5_Context *ctx = (SDL_DriverPS5_Context *)device->context;
- SDL_zeroa(data);
+ if (ctx->enhanced_mode) {
+ /* This is just a dummy packet that should have no effect, since we don't set the CRC */
+ Uint8 data[78];
+
+ SDL_zeroa(data);
- data[0] = k_EPS5ReportIdBluetoothEffects;
- data[1] = 0x02; /* Magic value */
+ data[0] = k_EPS5ReportIdBluetoothEffects;
+ data[1] = 0x02; /* Magic value */
- if (SDL_HIDAPI_LockRumble() == 0) {
- SDL_HIDAPI_SendRumbleAndUnlock(device, data, sizeof(data));
+ if (SDL_HIDAPI_LockRumble() == 0) {
+ SDL_HIDAPI_SendRumbleAndUnlock(device, data, sizeof(data));
+ }
+ } else {
+ /* We can't even send an invalid effects packet, or it will put the controller in enhanced mode */
+ if (device->num_joysticks > 0) {
+ HIDAPI_JoystickDisconnected(device, device->joysticks[0]);
+ }
}
}