mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-05 01:16:26 +00:00
Added SDL_GetJoystickCaps() and SDL_GetGamepadCaps() to get the capabilities of controllers
Also added SDL_GAMEPAD_CAP_PLAYER_LED to let the application know if the controller has a visible player LED
This commit is contained in:
@@ -1577,12 +1577,16 @@ static Uint32 HIDAPI_DriverSwitch_GetJoystickCapabilities(SDL_HIDAPI_Device *dev
|
||||
SDL_DriverSwitch_Context *ctx = (SDL_DriverSwitch_Context *)device->context;
|
||||
Uint32 result = 0;
|
||||
|
||||
if (ctx->m_bPlayerLights && !ctx->m_bInputOnly) {
|
||||
result |= SDL_JOYSTICK_CAP_PLAYER_LED;
|
||||
}
|
||||
|
||||
if (ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_ProController && !ctx->m_bInputOnly) {
|
||||
/* Doesn't have an RGB LED, so don't return SDL_JOYCAP_LED here */
|
||||
result |= SDL_JOYCAP_RUMBLE;
|
||||
/* Doesn't have an RGB LED, so don't return SDL_JOYSTICK_CAP_RGB_LED here */
|
||||
result |= SDL_JOYSTICK_CAP_RUMBLE;
|
||||
} else if (ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConLeft ||
|
||||
ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConRight) {
|
||||
result |= SDL_JOYCAP_RUMBLE;
|
||||
result |= SDL_JOYSTICK_CAP_RUMBLE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user