Added paddle mapping for combined Joy-Cons

This commit is contained in:
Sam Lantinga 2022-10-02 09:50:27 -07:00
parent 37dfa2629b
commit f58a6506a1
1 changed files with 4 additions and 4 deletions

View File

@ -609,9 +609,9 @@ static ControllerMapping_t *SDL_CreateMappingForHIDAPIController(SDL_JoystickGUI
if (SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS, SDL_FALSE)) { if (SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS, SDL_FALSE)) {
/* Vertical mode */ /* Vertical mode */
if (guid.data[15] == k_eSwitchDeviceInfoControllerType_JoyConLeft) { if (guid.data[15] == k_eSwitchDeviceInfoControllerType_JoyConLeft) {
SDL_strlcat(mapping_string, "back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,misc1:b15,", sizeof(mapping_string)); SDL_strlcat(mapping_string, "back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,misc1:b15,paddle2:b17,paddle4:b19,", sizeof(mapping_string));
} else { } else {
SDL_strlcat(mapping_string, "a:b0,b:b1,guide:b5,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", sizeof(mapping_string)); SDL_strlcat(mapping_string, "a:b0,b:b1,guide:b5,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,paddle1:b16,paddle3:b18,", sizeof(mapping_string));
} }
} else { } else {
/* Mini gamepad mode */ /* Mini gamepad mode */
@ -633,8 +633,8 @@ static ControllerMapping_t *SDL_CreateMappingForHIDAPIController(SDL_JoystickGUI
/* Steam controllers have 2 back paddle buttons */ /* Steam controllers have 2 back paddle buttons */
SDL_strlcat(mapping_string, "paddle1:b16,paddle2:b15,", sizeof(mapping_string)); SDL_strlcat(mapping_string, "paddle1:b16,paddle2:b15,", sizeof(mapping_string));
} else if (SDL_IsJoystickNintendoSwitchJoyConPair(vendor, product)) { } else if (SDL_IsJoystickNintendoSwitchJoyConPair(vendor, product)) {
/* The Nintendo Switch Joy-Con combined controller has a share button */ /* The Nintendo Switch Joy-Con combined controller has a share button and paddles */
SDL_strlcat(mapping_string, "misc1:b15,", sizeof(mapping_string)); SDL_strlcat(mapping_string, "misc1:b15,paddle1:b16,paddle2:b17,paddle3:b18,paddle4:b19,", sizeof(mapping_string));
} else { } else {
switch (SDL_GetJoystickGameControllerTypeFromGUID(guid, NULL)) { switch (SDL_GetJoystickGameControllerTypeFromGUID(guid, NULL)) {
case SDL_CONTROLLER_TYPE_PS4: case SDL_CONTROLLER_TYPE_PS4: