소스 검색

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

JibbSmart 4 년 전
부모
커밋
c287087fcc
1개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      src/joystick/hidapi/SDL_hidapi_switch.c

+ 6 - 1
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;