From c287087fcce57af086c0a52f74fcdb74e9084c55 Mon Sep 17 00:00:00 2001
From: JibbSmart <[EMAIL REDACTED]>
Date: Tue, 23 Feb 2021 09:26:03 +0800
Subject: [PATCH] Only change joystick->nbuttons for Joy-Cons, since they're
the only ones that have these "paddles"
---
src/joystick/hidapi/SDL_hidapi_switch.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/joystick/hidapi/SDL_hidapi_switch.c b/src/joystick/hidapi/SDL_hidapi_switch.c
index f0eaf2ae8..fe527aa12 100644
--- a/src/joystick/hidapi/SDL_hidapi_switch.c
+++ b/src/joystick/hidapi/SDL_hidapi_switch.c
@@ -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;