SDL: Fixed the accelerometer sensitivity for the Armor-X Pro controller

From 8029a767eef4147c07cde965bd5a2d2e11e237ee Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 27 Mar 2023 14:27:22 -0700
Subject: [PATCH] Fixed the accelerometer sensitivity for the Armor-X Pro
 controller

---
 src/joystick/hidapi/SDL_hidapi_ps4.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/joystick/hidapi/SDL_hidapi_ps4.c b/src/joystick/hidapi/SDL_hidapi_ps4.c
index 5bd2bdda0710..534f0dd312f4 100644
--- a/src/joystick/hidapi/SDL_hidapi_ps4.c
+++ b/src/joystick/hidapi/SDL_hidapi_ps4.c
@@ -404,6 +404,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_GAMEPAD_TYPE_PS4;
     if (ctx->official_controller) {