mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-04 08:56:25 +00:00
Added API for sensors on game controllers
Added support for the PS4 controller gyro and accelerometer on iOS and HIDAPI drivers Also fixed an issue with the accelerometer on iOS having inverted axes
This commit is contained in:
@@ -72,8 +72,12 @@ typedef struct
|
||||
Uint8 rgucButtonsAndHat[3]; /* 7 */
|
||||
Uint8 ucZero; /* 10 */
|
||||
Uint8 rgucPacketSequence[4]; /* 11 - 32 bit little endian */
|
||||
Uint8 rgucAccel[6]; /* 15 */
|
||||
Uint8 rgucGyro[6]; /* 21 */
|
||||
Uint8 rgucGyroX[2]; /* 15 */
|
||||
Uint8 rgucGyroY[2]; /* 17 */
|
||||
Uint8 rgucGyroZ[2]; /* 19 */
|
||||
Uint8 rgucAccelX[2]; /* 21 */
|
||||
Uint8 rgucAccelY[2]; /* 23 */
|
||||
Uint8 rgucAccelZ[2]; /* 25 */
|
||||
Uint8 rgucTimer1[4]; /* 27 - 32 bit little endian */
|
||||
Uint8 ucBatteryTemp; /* 31 */
|
||||
Uint8 ucTouchpadCounter1; /* 32 - high bit clear + counter */
|
||||
@@ -351,6 +355,12 @@ HIDAPI_DriverPS5_SetJoystickLED(SDL_HIDAPI_Device *device, SDL_Joystick *joystic
|
||||
return HIDAPI_DriverPS5_UpdateEffects(device);
|
||||
}
|
||||
|
||||
static int
|
||||
HIDAPI_DriverPS5_SetJoystickSensorsEnabled(SDL_HIDAPI_Device *device, SDL_Joystick *joystick, SDL_bool enabled)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
HIDAPI_DriverPS5_HandleSimpleStatePacket(SDL_Joystick *joystick, hid_device *dev, SDL_DriverPS5_Context *ctx, PS5SimpleStatePacket_t *packet)
|
||||
{
|
||||
@@ -649,6 +659,7 @@ SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverPS5 =
|
||||
HIDAPI_DriverPS5_RumbleJoystickTriggers,
|
||||
HIDAPI_DriverPS5_HasJoystickLED,
|
||||
HIDAPI_DriverPS5_SetJoystickLED,
|
||||
HIDAPI_DriverPS5_SetJoystickSensorsEnabled,
|
||||
HIDAPI_DriverPS5_CloseJoystick,
|
||||
HIDAPI_DriverPS5_FreeDevice,
|
||||
NULL
|
||||
|
Reference in New Issue
Block a user