Added SDL_GameControllerSendEffect() and SDL_JoystickSendEffect() to allow applications to send custom effects to the PS4 and PS5 controllers

See testgamecontroller.c for an example of a custom PS5 trigger effect
This commit is contained in:
Sam Lantinga
2021-07-08 13:22:41 -07:00
parent 073cbc40cb
commit d135c0762f
36 changed files with 533 additions and 186 deletions

View File

@@ -784,7 +784,7 @@ DARWIN_JoystickGetDeviceInstanceID(int device_index)
}
static int
DARWIN_JoystickOpen(SDL_Joystick * joystick, int device_index)
DARWIN_JoystickOpen(SDL_Joystick *joystick, int device_index)
{
recDevice *device = GetDeviceForIndex(device_index);
@@ -894,7 +894,7 @@ DARWIN_JoystickInitRumble(recDevice *device, Sint16 magnitude)
}
static int
DARWIN_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)
DARWIN_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)
{
HRESULT result;
recDevice *device = joystick->hwdata;
@@ -934,19 +934,25 @@ DARWIN_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint
}
static int
DARWIN_JoystickRumbleTriggers(SDL_Joystick * joystick, Uint16 left_rumble, Uint16 right_rumble)
DARWIN_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble)
{
return SDL_Unsupported();
}
static SDL_bool
DARWIN_JoystickHasLED(SDL_Joystick * joystick)
DARWIN_JoystickHasLED(SDL_Joystick *joystick)
{
return SDL_FALSE;
}
static int
DARWIN_JoystickSetLED(SDL_Joystick * joystick, Uint8 red, Uint8 green, Uint8 blue)
DARWIN_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue)
{
return SDL_Unsupported();
}
static int
DARWIN_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size)
{
return SDL_Unsupported();
}
@@ -958,7 +964,7 @@ DARWIN_JoystickSetSensorsEnabled(SDL_Joystick *joystick, SDL_bool enabled)
}
static void
DARWIN_JoystickUpdate(SDL_Joystick * joystick)
DARWIN_JoystickUpdate(SDL_Joystick *joystick)
{
recDevice *device = joystick->hwdata;
recElement *element;
@@ -1063,7 +1069,7 @@ DARWIN_JoystickUpdate(SDL_Joystick * joystick)
}
static void
DARWIN_JoystickClose(SDL_Joystick * joystick)
DARWIN_JoystickClose(SDL_Joystick *joystick)
{
recDevice *device = joystick->hwdata;
if (device) {
@@ -1107,6 +1113,7 @@ SDL_JoystickDriver SDL_DARWIN_JoystickDriver =
DARWIN_JoystickRumbleTriggers,
DARWIN_JoystickHasLED,
DARWIN_JoystickSetLED,
DARWIN_JoystickSendEffect,
DARWIN_JoystickSetSensorsEnabled,
DARWIN_JoystickUpdate,
DARWIN_JoystickClose,