Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/joystick/SDL_gamepad.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ static GamepadMapping_t *SDL_CreateMappingForAndroidGamepad(SDL_GUID guid)
int button_mask;
int axis_mask;
Uint16 vendor, product;

SDL_strlcpy(mapping_string, "none,", sizeof(mapping_string));

SDL_GetJoystickGUIDInfo(guid, &vendor, &product, NULL, NULL);
Expand Down Expand Up @@ -1223,11 +1223,12 @@ static GamepadMapping_t *SDL_CreateMappingForHIDAPIGamepad(SDL_GUID guid)
product == USB_PRODUCT_8BITDO_SN30_PRO_BT ||
product == USB_PRODUCT_8BITDO_PRO_2 ||
product == USB_PRODUCT_8BITDO_PRO_2_BT ||
product == USB_PRODUCT_8BITDO_ULTIMATE2_BT ||
product == USB_PRODUCT_8BITDO_PRO_3)) {
SDL_strlcat(mapping_string, "a:b1,b:b0,back:b4,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,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:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", sizeof(mapping_string));
if (product == USB_PRODUCT_8BITDO_PRO_2 || product == USB_PRODUCT_8BITDO_PRO_2_BT) {
SDL_strlcat(mapping_string, "paddle1:b14,paddle2:b13,", sizeof(mapping_string));
} else if (product == USB_PRODUCT_8BITDO_PRO_3) {
} else if (product == USB_PRODUCT_8BITDO_PRO_3 || product == USB_PRODUCT_8BITDO_ULTIMATE2_BT) {
SDL_strlcat(mapping_string, "paddle1:b12,paddle2:b11,paddle3:b14,paddle4:b13,", sizeof(mapping_string));
}
} else if (vendor == USB_VENDOR_8BITDO &&
Expand Down
5 changes: 4 additions & 1 deletion src/joystick/hidapi/SDL_hidapi_8bitdo.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ static bool HIDAPI_Driver8BitDo_IsSupportedDevice(SDL_HIDAPI_Device *device, con
case USB_PRODUCT_8BITDO_PRO_2:
case USB_PRODUCT_8BITDO_PRO_2_BT:
case USB_PRODUCT_8BITDO_PRO_3:
case USB_PRODUCT_8BITDO_ULTIMATE2_BT:
case USB_PRODUCT_8BITDO_ULTIMATE2_WIRELESS:
return true;
default:
Expand All @@ -163,7 +164,7 @@ static bool HIDAPI_Driver8BitDo_InitDevice(SDL_HIDAPI_Device *device)
}
device->context = ctx;

if (device->product_id == USB_PRODUCT_8BITDO_ULTIMATE2_WIRELESS) {
if (device->product_id == USB_PRODUCT_8BITDO_ULTIMATE2_WIRELESS || device->product_id == USB_PRODUCT_8BITDO_ULTIMATE2_BT) {
// The Ultimate 2 Wireless v1.02 firmware has 12 byte reports, v1.03 firmware has 34 byte reports
const int ULTIMATE2_WIRELESS_V103_REPORT_SIZE = 34;
const int MAX_ATTEMPTS = 3;
Expand Down Expand Up @@ -269,6 +270,7 @@ static Uint64 HIDAPI_Driver8BitDo_GetIMURateForProductID(SDL_HIDAPI_Device *devi
// This firmware appears to update at 100 Hz over USB
return 100;
}
case USB_PRODUCT_8BITDO_ULTIMATE2_BT:
case USB_PRODUCT_8BITDO_ULTIMATE2_WIRELESS:
if (device->is_bluetooth) {
// Note, This is estimated by observation of Bluetooth packets received in the testcontroller tool
Expand Down Expand Up @@ -298,6 +300,7 @@ static bool HIDAPI_Driver8BitDo_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joys
if (device->product_id == USB_PRODUCT_8BITDO_PRO_2 ||
device->product_id == USB_PRODUCT_8BITDO_PRO_2_BT ||
device->product_id == USB_PRODUCT_8BITDO_PRO_3 ||
device->product_id == USB_PRODUCT_8BITDO_ULTIMATE2_BT ||
device->product_id == USB_PRODUCT_8BITDO_ULTIMATE2_WIRELESS) {
// This controller has additional buttons
joystick->nbuttons = SDL_GAMEPAD_NUM_8BITDO_BUTTONS;
Expand Down
1 change: 1 addition & 0 deletions src/joystick/usb_ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
#define USB_PRODUCT_8BITDO_PRO_2 0x6003 // mode switch to D
#define USB_PRODUCT_8BITDO_PRO_2_BT 0x6006 // mode switch to D
#define USB_PRODUCT_8BITDO_PRO_3 0x6009 // mode switch to D
#define USB_PRODUCT_8BITDO_ULTIMATE2_BT 0x6011 // mode switch to D
#define USB_PRODUCT_8BITDO_ULTIMATE2_WIRELESS 0x6012 // mode switch to BT
#define USB_PRODUCT_AMAZON_LUNA_CONTROLLER 0x0419
#define USB_PRODUCT_ASTRO_C40_XBOX360 0x0024
Expand Down
Loading