Skip to content

Commit 880f314

Browse files
committed
switch: 2.28.5 fixups
1 parent 6d28f19 commit 880f314

4 files changed

Lines changed: 14 additions & 9 deletions

File tree

src/joystick/SDL_gamecontrollerdb.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -993,8 +993,7 @@ static const char *s_ControllerMappings[] = {
993993
"000000004e696e74656e646f20334400,Nintendo 3DS,crc:3210,a:b0,b:b1,back:b2,dpdown:b7,dpleft:b5,dpright:b4,dpup:b6,leftshoulder:b9,lefttrigger:b14,leftx:a0,lefty:a1,rightshoulder:b8,righttrigger:b15,rightx:a2,righty:a3,start:b3,x:b10,y:b11,",
994994
#endif
995995
#if defined(SDL_JOYSTICK_SWITCH)
996-
"53776974636820436F6E74726F6C6C65,Switch Controller,a:b0,b:b1,back:b11,dpdown:b15,dpleft:b12,dpright:b14,dpup:b13,leftshoulder:b6,leftstick:b4,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b5,righttrigger:b9,rightx:a2,righty:a3,start:b10,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
997-
"53776974636820436F6E74726F6C6C65,Switch Controller,a:b1,b:b0,back:b11,dpdown:b15,dpleft:b12,dpright:b14,dpup:b13,leftshoulder:b6,leftstick:b4,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b5,righttrigger:b9,rightx:a2,righty:a3,start:b10,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
996+
"53776974636820436F6E74726F6C6C65,Switch Controller,a:b1,b:b0,back:b11,dpdown:b15,dpleft:b12,dpright:b14,dpup:b13,leftshoulder:b6,leftstick:b4,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b5,righttrigger:b9,rightx:a2,righty:a3,start:b10,x:b3,y:b2,",
998997
#endif
999998
"hidapi,*,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
1000999
NULL

src/joystick/SDL_joystick.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,6 @@ static SDL_JoystickDriver *SDL_joystick_drivers[] = {
8484
#ifdef SDL_JOYSTICK_HAIKU
8585
&SDL_HAIKU_JoystickDriver,
8686
#endif
87-
#ifdef SDL_JOYSTICK_SWITCH
88-
&SDL_SWITCH_JoystickDriver,
89-
#endif
9087
#ifdef SDL_JOYSTICK_USBHID /* !!! FIXME: "USBHID" is a generic name, and doubly-confusing with HIDAPI next to it. This is the *BSD interface, rename this. */
9188
&SDL_BSD_JoystickDriver,
9289
#endif
@@ -108,6 +105,9 @@ static SDL_JoystickDriver *SDL_joystick_drivers[] = {
108105
#ifdef SDL_JOYSTICK_N3DS
109106
&SDL_N3DS_JoystickDriver
110107
#endif
108+
#ifdef SDL_JOYSTICK_SWITCH
109+
&SDL_SWITCH_JoystickDriver,
110+
#endif
111111
#if defined(SDL_JOYSTICK_DUMMY) || defined(SDL_JOYSTICK_DISABLED)
112112
&SDL_DUMMY_JoystickDriver
113113
#endif

src/joystick/switch/SDL_sysjoystick.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,8 @@ static int SWITCH_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left, Ui
247247
return SDL_Unsupported();
248248
}
249249

250-
static SDL_bool SWITCH_JoystickHasLED(SDL_Joystick *joystick) {
251-
return SDL_FALSE;
250+
static Uint32 SWITCH_JoystickGetCapabilities(SDL_Joystick *joystick) {
251+
return 0;
252252
}
253253

254254
static int SWITCH_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue) {
@@ -336,6 +336,10 @@ static void SWITCH_JoystickClose(SDL_Joystick *joystick) {
336336
static void SWITCH_JoystickQuit(void) {
337337
}
338338

339+
static SDL_bool SWITCH_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out) {
340+
return SDL_FALSE;
341+
}
342+
339343
SDL_JoystickDriver SDL_SWITCH_JoystickDriver = {
340344
SWITCH_JoystickInit,
341345
SWITCH_JoystickGetCount,
@@ -351,15 +355,17 @@ SDL_JoystickDriver SDL_SWITCH_JoystickDriver = {
351355

352356
SWITCH_JoystickRumble,
353357
SWITCH_JoystickRumbleTriggers,
358+
SWITCH_JoystickGetCapabilities,
354359

355-
SWITCH_JoystickHasLED,
356360
SWITCH_JoystickSetLED,
357361
SWITCH_JoystickSendEffect,
358362
SWITCH_JoystickSetSensorsEnabled,
359363

360364
SWITCH_JoystickUpdate,
361365
SWITCH_JoystickClose,
362366
SWITCH_JoystickQuit,
367+
368+
SWITCH_JoystickGetGamepadMapping,
363369
};
364370

365371
#endif /* SDL_JOYSTICK_SWITCH */

src/video/SDL_video.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ typedef struct
205205

206206
static Uint32 SDL_DefaultGraphicsBackends(SDL_VideoDevice *_this)
207207
{
208-
#if (SDL_VIDEO_OPENGL && __MACOSX__) || (__IPHONEOS__ && !TARGET_OS_MACCATALYST) || __ANDROID__ || __NACL__
208+
#if (SDL_VIDEO_OPENGL && __MACOSX__) || (__IPHONEOS__ && !TARGET_OS_MACCATALYST) || __ANDROID__ || __NACL__ || __SWITCH__
209209
if (_this->GL_CreateContext != NULL) {
210210
return SDL_WINDOW_OPENGL;
211211
}

0 commit comments

Comments
 (0)