Jelajahi Sumber

Fixed PS3 accelerometer values on little endian systems

Sam Lantinga 3 tahun lalu
induk
melakukan
babaa7d2bd
1 mengubah file dengan 2 tambahan dan 0 penghapusan
  1. 2 0
      src/joystick/hidapi/SDL_hidapi_ps3.c

+ 2 - 0
src/joystick/hidapi/SDL_hidapi_ps3.c

@@ -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;
 }
 }