mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-20 16:51:43 +00:00
Don't tickle Bluetooth PS4 controllers in simple mode with an effects packet
That will put the PS4 controller into enhanced mode, which breaks DirectInput games
(cherry picked from commit efed24850a
)
This commit is contained in:
@@ -661,6 +661,9 @@ static int HIDAPI_DriverPS4_UpdateEffects(SDL_HIDAPI_Device *device)
|
|||||||
|
|
||||||
static void HIDAPI_DriverPS4_TickleBluetooth(SDL_HIDAPI_Device *device)
|
static void HIDAPI_DriverPS4_TickleBluetooth(SDL_HIDAPI_Device *device)
|
||||||
{
|
{
|
||||||
|
SDL_DriverPS4_Context *ctx = (SDL_DriverPS4_Context *)device->context;
|
||||||
|
|
||||||
|
if (ctx->enhanced_mode) {
|
||||||
/* This is just a dummy packet that should have no effect, since we don't set the CRC */
|
/* This is just a dummy packet that should have no effect, since we don't set the CRC */
|
||||||
Uint8 data[78];
|
Uint8 data[78];
|
||||||
|
|
||||||
@@ -672,6 +675,12 @@ static void HIDAPI_DriverPS4_TickleBluetooth(SDL_HIDAPI_Device *device)
|
|||||||
if (SDL_HIDAPI_LockRumble() == 0) {
|
if (SDL_HIDAPI_LockRumble() == 0) {
|
||||||
SDL_HIDAPI_SendRumbleAndUnlock(device, data, sizeof(data));
|
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]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void HIDAPI_DriverPS4_SetEnhancedMode(SDL_HIDAPI_Device *device, SDL_Joystick *joystick)
|
static void HIDAPI_DriverPS4_SetEnhancedMode(SDL_HIDAPI_Device *device, SDL_Joystick *joystick)
|
||||||
|
Reference in New Issue
Block a user