Fixed PS3 accelerometer values on little endian systems

This commit is contained in:
Sam Lantinga 2022-08-24 16:10:47 -07:00
parent d1e9015639
commit babaa7d2bd
1 changed files with 2 additions and 0 deletions

View File

@ -318,6 +318,8 @@ HIDAPI_DriverPS3_SetJoystickSensorsEnabled(SDL_HIDAPI_Device *device, SDL_Joysti
static float static float
HIDAPI_DriverPS3_ScaleAccel(Sint16 value) HIDAPI_DriverPS3_ScaleAccel(Sint16 value)
{ {
/* Accelerometer values are in big endian order */
value = SDL_SwapBE16(value);
return (float)(value - 511) / 113.0f; return (float)(value - 511) / 113.0f;
} }