From babaa7d2bdc2b7a8a915ce3a58b022b8fe7c2614 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 24 Aug 2022 16:10:47 -0700 Subject: [PATCH] Fixed PS3 accelerometer values on little endian systems --- src/joystick/hidapi/SDL_hidapi_ps3.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/joystick/hidapi/SDL_hidapi_ps3.c b/src/joystick/hidapi/SDL_hidapi_ps3.c index c178a9f5a..c52a87bb4 100644 --- a/src/joystick/hidapi/SDL_hidapi_ps3.c +++ b/src/joystick/hidapi/SDL_hidapi_ps3.c @@ -318,6 +318,8 @@ HIDAPI_DriverPS3_SetJoystickSensorsEnabled(SDL_HIDAPI_Device *device, SDL_Joysti static float HIDAPI_DriverPS3_ScaleAccel(Sint16 value) { + /* Accelerometer values are in big endian order */ + value = SDL_SwapBE16(value); return (float)(value - 511) / 113.0f; }