Commit 8bfbda1eabf2a157783ec9c1a9767c5c4f8ae432

Sam Lantinga 2023-03-27T14:27:22

Fixed the accelerometer sensitivity for the Armor-X Pro controller (cherry picked from commit 8029a767eef4147c07cde965bd5a2d2e11e237ee)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/src/joystick/hidapi/SDL_hidapi_ps4.c b/src/joystick/hidapi/SDL_hidapi_ps4.c
index 24452a2..37d7800 100644
--- a/src/joystick/hidapi/SDL_hidapi_ps4.c
+++ b/src/joystick/hidapi/SDL_hidapi_ps4.c
@@ -408,6 +408,12 @@ static SDL_bool HIDAPI_DriverPS4_InitDevice(SDL_HIDAPI_Device *device)
         ctx->effects_supported = SDL_FALSE;
     }
 
+    if (device->vendor_id == USB_VENDOR_SONY &&
+        device->product_id == USB_PRODUCT_SONY_DS4_STRIKEPAD) {
+        /* The Armor-X Pro seems to only deliver half the acceleration it should */
+        ctx->accel_numerator *= 2;
+    }
+
     device->joystick_type = joystick_type;
     device->type = SDL_CONTROLLER_TYPE_PS4;
     if (ctx->official_controller) {