|
@@ -783,6 +783,10 @@ static GamepadMapping_t *SDL_CreateMappingForHIDAPIGamepad(SDL_JoystickGUID guid
|
|
|
} else if (SDL_IsJoystickSteamController(vendor, product)) {
|
|
|
/* Steam controllers have 2 back paddle buttons */
|
|
|
SDL_strlcat(mapping_string, "paddle1:b12,paddle2:b11,", sizeof(mapping_string));
|
|
|
+ } else if (SDL_IsJoystickNintendoSwitchPro(vendor, product) ||
|
|
|
+ SDL_IsJoystickNintendoSwitchProInputOnly(vendor, product)) {
|
|
|
+ /* Nintendo Switch Pro controllers have a screenshot button */
|
|
|
+ SDL_strlcat(mapping_string, "misc1:b11,", sizeof(mapping_string));
|
|
|
} else if (SDL_IsJoystickNintendoSwitchJoyConPair(vendor, product)) {
|
|
|
/* The Nintendo Switch Joy-Con combined controllers has a share button and paddles */
|
|
|
SDL_strlcat(mapping_string, "misc1:b11,paddle1:b12,paddle2:b13,paddle3:b14,paddle4:b15,", sizeof(mapping_string));
|
|
@@ -800,23 +804,27 @@ static GamepadMapping_t *SDL_CreateMappingForHIDAPIGamepad(SDL_JoystickGUID guid
|
|
|
/* The original SHIELD controller has a touchpad and plus/minus buttons as well */
|
|
|
SDL_strlcat(mapping_string, "touchpad:b12,misc2:b13,misc3:b14", sizeof(mapping_string));
|
|
|
}
|
|
|
- } else if (SDL_IsJoystickPS4(vendor, product)) {
|
|
|
- /* PS4 controllers have an additional touchpad button */
|
|
|
- SDL_strlcat(mapping_string, "touchpad:b11,", sizeof(mapping_string));
|
|
|
- } else if (SDL_IsJoystickPS5(vendor, product)) {
|
|
|
- /* PS5 controllers have a microphone button and an additional touchpad button */
|
|
|
- SDL_strlcat(mapping_string, "touchpad:b11,misc1:b12,", sizeof(mapping_string));
|
|
|
- /* DualSense Edge controllers have paddles and a microphone button */
|
|
|
- if (SDL_IsJoystickDualSenseEdge(vendor, product)) {
|
|
|
- SDL_strlcat(mapping_string, "paddle1:b16,paddle2:b15,paddle3:b14,paddle4:b13,", sizeof(mapping_string));
|
|
|
+ } else {
|
|
|
+ switch (SDL_GetGamepadTypeFromGUID(guid, NULL)) {
|
|
|
+ case SDL_GAMEPAD_TYPE_PS4:
|
|
|
+ /* PS4 controllers have an additional touchpad button */
|
|
|
+ SDL_strlcat(mapping_string, "touchpad:b11,", sizeof(mapping_string));
|
|
|
+ break;
|
|
|
+ case SDL_GAMEPAD_TYPE_PS5:
|
|
|
+ /* PS5 controllers have a microphone button and an additional touchpad button */
|
|
|
+ SDL_strlcat(mapping_string, "touchpad:b11,misc1:b12,", sizeof(mapping_string));
|
|
|
+ /* DualSense Edge controllers have paddles */
|
|
|
+ if (SDL_IsJoystickDualSenseEdge(vendor, product)) {
|
|
|
+ SDL_strlcat(mapping_string, "paddle1:b16,paddle2:b15,paddle3:b14,paddle4:b13,", sizeof(mapping_string));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ if (vendor == 0 && product == 0) {
|
|
|
+ /* This is a Bluetooth Nintendo Switch Pro controller */
|
|
|
+ SDL_strlcat(mapping_string, "misc1:b11,", sizeof(mapping_string));
|
|
|
+ }
|
|
|
+ break;
|
|
|
}
|
|
|
- } else if (SDL_IsJoystickNintendoSwitchPro(vendor, product) ||
|
|
|
- SDL_IsJoystickNintendoSwitchProInputOnly(vendor, product)) {
|
|
|
- /* Nintendo Switch Pro controllers have a screenshot button */
|
|
|
- SDL_strlcat(mapping_string, "misc1:b11,", sizeof(mapping_string));
|
|
|
- } else if (vendor == 0 && product == 0) {
|
|
|
- /* This is a Bluetooth Nintendo Switch Pro controller */
|
|
|
- SDL_strlcat(mapping_string, "misc1:b11,", sizeof(mapping_string));
|
|
|
}
|
|
|
}
|
|
|
|