Only change joystick->nbuttons for Joy-Cons, since they're the only ones that have these "paddles"

This commit is contained in:
JibbSmart 2021-02-23 09:26:03 +08:00 committed by Sam Lantinga
parent ee52624f95
commit c287087fcc
1 changed files with 6 additions and 1 deletions

View File

@ -908,7 +908,12 @@ HIDAPI_DriverSwitch_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joysti
SDL_GameControllerButtonReportingHintChanged, ctx);
/* Initialize the joystick capabilities */
joystick->nbuttons = 20;
if (ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConLeft ||
ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConRight) {
joystick->nbuttons = 20;
} else {
joystick->nbuttons = 16;
}
joystick->naxes = SDL_CONTROLLER_AXIS_MAX;
joystick->epowerlevel = SDL_JOYSTICK_POWER_WIRED;