Replaced SDL_GetJoystickCaps() with joystick properties

Fixes https://github.com/libsdl-org/SDL/issues/8927
This commit is contained in:
Sam Lantinga
2024-01-27 14:37:30 -08:00
parent 019dc53764
commit f66fe7e221
37 changed files with 176 additions and 341 deletions

View File

@@ -749,6 +749,11 @@ static int WGI_JoystickOpen(SDL_Joystick *joystick, int device_index)
__x_ABI_CWindows_CGaming_CInput_CIRawGameController_get_AxisCount(hwdata->controller, &joystick->naxes);
__x_ABI_CWindows_CGaming_CInput_CIRawGameController_get_SwitchCount(hwdata->controller, &joystick->nhats);
if (hwdata->gamepad) {
/* FIXME: Can WGI even tell us if trigger rumble is supported? */
SDL_SetBooleanProperty(SDL_GetJoystickProperties(joystick), SDL_PROP_JOYSTICK_CAP_RUMBLE_BOOLEAN, SDL_TRUE);
SDL_SetBooleanProperty(SDL_GetJoystickProperties(joystick), SDL_PROP_JOYSTICK_CAP_TRIGGER_RUMBLE_BOOLEAN, SDL_TRUE);
}
return 0;
}
@@ -794,18 +799,6 @@ static int WGI_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble
}
}
static Uint32 WGI_JoystickGetCapabilities(SDL_Joystick *joystick)
{
struct joystick_hwdata *hwdata = joystick->hwdata;
if (hwdata->gamepad) {
/* FIXME: Can WGI even tell us if trigger rumble is supported? */
return (SDL_JOYSTICK_CAP_RUMBLE | SDL_JOYSTICK_CAP_TRIGGER_RUMBLE);
} else {
return 0;
}
}
static int WGI_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue)
{
return SDL_Unsupported();
@@ -1026,7 +1019,6 @@ SDL_JoystickDriver SDL_WGI_JoystickDriver = {
WGI_JoystickOpen,
WGI_JoystickRumble,
WGI_JoystickRumbleTriggers,
WGI_JoystickGetCapabilities,
WGI_JoystickSetLED,
WGI_JoystickSendEffect,
WGI_JoystickSetSensorsEnabled,