mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-02-28 22:28:19 +00:00
Fixed rumble strength on DualSense Edge and Bluetooth connected controllers
Fixes https://github.com/libsdl-org/SDL/issues/13771
(cherry picked from commit 25d9096d41)
This commit is contained in:
@@ -251,6 +251,7 @@ typedef struct
|
||||
Uint64 last_packet;
|
||||
int player_index;
|
||||
bool player_lights;
|
||||
bool enhanced_rumble;
|
||||
Uint8 rumble_left;
|
||||
Uint8 rumble_right;
|
||||
bool color_set;
|
||||
@@ -432,6 +433,14 @@ static bool HIDAPI_DriverPS5_InitDevice(SDL_HIDAPI_Device *device)
|
||||
}
|
||||
}
|
||||
|
||||
if (device->vendor_id == USB_VENDOR_SONY) {
|
||||
if (device->product_id == USB_PRODUCT_SONY_DS5_EDGE ||
|
||||
ctx->firmware_version == 0 || // Assume that it's updated firmware over Bluetooth
|
||||
ctx->firmware_version >= 0x0224) {
|
||||
ctx->enhanced_rumble = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the device capabilities
|
||||
if (device->vendor_id == USB_VENDOR_SONY) {
|
||||
ctx->sensors_supported = true;
|
||||
@@ -684,17 +693,17 @@ static bool HIDAPI_DriverPS5_UpdateEffects(SDL_DriverPS5_Context *ctx, int effec
|
||||
|
||||
if (ctx->vibration_supported) {
|
||||
if (ctx->rumble_left || ctx->rumble_right) {
|
||||
if (ctx->firmware_version < 0x0224) {
|
||||
if (ctx->enhanced_rumble) {
|
||||
effects.ucEnableBits3 |= 0x04; // Enable improved rumble emulation on 2.24 firmware and newer
|
||||
|
||||
effects.ucRumbleLeft = ctx->rumble_left;
|
||||
effects.ucRumbleRight = ctx->rumble_right;
|
||||
} else {
|
||||
effects.ucEnableBits1 |= 0x01; // Enable rumble emulation
|
||||
|
||||
// Shift to reduce effective rumble strength to match Xbox controllers
|
||||
effects.ucRumbleLeft = ctx->rumble_left >> 1;
|
||||
effects.ucRumbleRight = ctx->rumble_right >> 1;
|
||||
} else {
|
||||
effects.ucEnableBits3 |= 0x04; // Enable improved rumble emulation on 2.24 firmware and newer
|
||||
|
||||
effects.ucRumbleLeft = ctx->rumble_left;
|
||||
effects.ucRumbleRight = ctx->rumble_right;
|
||||
}
|
||||
effects.ucEnableBits1 |= 0x02; // Disable audio haptics
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user