mirror of
https://github.com/Ryujinx/SDL.git
synced 2025-02-02 08:41:00 +00:00
Added support for the STRIKEPAD PS4 Grip Add-on to the HIDAPI driver
(cherry picked from commit 618340bf990512247ed29a1beb38606e371d60e8)
This commit is contained in:
parent
e580e087ff
commit
802b5ef7dc
|
@ -273,6 +273,10 @@ static SDL_bool HIDAPI_DriverPS4_InitDevice(SDL_HIDAPI_Device *device)
|
||||||
}
|
}
|
||||||
device->is_bluetooth = SDL_FALSE;
|
device->is_bluetooth = SDL_FALSE;
|
||||||
ctx->enhanced_mode = SDL_TRUE;
|
ctx->enhanced_mode = SDL_TRUE;
|
||||||
|
} else if (device->vendor_id == USB_VENDOR_SONY && device->product_id == USB_PRODUCT_SONY_DS4_STRIKEPAD) {
|
||||||
|
device->is_bluetooth = SDL_FALSE;
|
||||||
|
ctx->enhanced_mode = SDL_TRUE;
|
||||||
|
|
||||||
} else if (device->vendor_id == USB_VENDOR_SONY) {
|
} else if (device->vendor_id == USB_VENDOR_SONY) {
|
||||||
/* This will fail if we're on Bluetooth */
|
/* This will fail if we're on Bluetooth */
|
||||||
size = ReadFeatureReport(device->dev, k_ePS4FeatureReportIdSerialNumber, data, sizeof(data));
|
size = ReadFeatureReport(device->dev, k_ePS4FeatureReportIdSerialNumber, data, sizeof(data));
|
||||||
|
@ -310,13 +314,7 @@ static SDL_bool HIDAPI_DriverPS4_InitDevice(SDL_HIDAPI_Device *device)
|
||||||
|
|
||||||
size = ReadFeatureReport(device->dev, k_ePS4FeatureReportIdCapabilities, data, sizeof data);
|
size = ReadFeatureReport(device->dev, k_ePS4FeatureReportIdCapabilities, data, sizeof data);
|
||||||
/* Get the device capabilities */
|
/* Get the device capabilities */
|
||||||
if (device->vendor_id == USB_VENDOR_SONY) {
|
if (size == 48 && data[2] == 0x27) {
|
||||||
ctx->official_controller = SDL_TRUE;
|
|
||||||
ctx->sensors_supported = SDL_TRUE;
|
|
||||||
ctx->lightbar_supported = SDL_TRUE;
|
|
||||||
ctx->vibration_supported = SDL_TRUE;
|
|
||||||
ctx->touchpad_supported = SDL_TRUE;
|
|
||||||
} else if (size == 48 && data[2] == 0x27) {
|
|
||||||
Uint8 capabilities = data[4];
|
Uint8 capabilities = data[4];
|
||||||
Uint8 device_type = data[5];
|
Uint8 device_type = data[5];
|
||||||
|
|
||||||
|
@ -362,6 +360,12 @@ static SDL_bool HIDAPI_DriverPS4_InitDevice(SDL_HIDAPI_Device *device)
|
||||||
joystick_type = SDL_JOYSTICK_TYPE_UNKNOWN;
|
joystick_type = SDL_JOYSTICK_TYPE_UNKNOWN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
} else if (device->vendor_id == USB_VENDOR_SONY) {
|
||||||
|
ctx->official_controller = SDL_TRUE;
|
||||||
|
ctx->sensors_supported = SDL_TRUE;
|
||||||
|
ctx->lightbar_supported = SDL_TRUE;
|
||||||
|
ctx->vibration_supported = SDL_TRUE;
|
||||||
|
ctx->touchpad_supported = SDL_TRUE;
|
||||||
} else if (device->vendor_id == USB_VENDOR_RAZER) {
|
} else if (device->vendor_id == USB_VENDOR_RAZER) {
|
||||||
/* The Razer Raiju doesn't respond to the detection protocol, but has a touchpad and vibration */
|
/* The Razer Raiju doesn't respond to the detection protocol, but has a touchpad and vibration */
|
||||||
ctx->vibration_supported = SDL_TRUE;
|
ctx->vibration_supported = SDL_TRUE;
|
||||||
|
@ -385,7 +389,7 @@ static SDL_bool HIDAPI_DriverPS4_InitDevice(SDL_HIDAPI_Device *device)
|
||||||
|
|
||||||
device->joystick_type = joystick_type;
|
device->joystick_type = joystick_type;
|
||||||
device->type = SDL_CONTROLLER_TYPE_PS4;
|
device->type = SDL_CONTROLLER_TYPE_PS4;
|
||||||
if (device->vendor_id == USB_VENDOR_SONY) {
|
if (ctx->official_controller) {
|
||||||
HIDAPI_SetDeviceName(device, "PS4 Controller");
|
HIDAPI_SetDeviceName(device, "PS4 Controller");
|
||||||
}
|
}
|
||||||
HIDAPI_SetDeviceSerial(device, serial);
|
HIDAPI_SetDeviceSerial(device, serial);
|
||||||
|
|
|
@ -100,6 +100,7 @@
|
||||||
#define USB_PRODUCT_SONY_DS4 0x05c4
|
#define USB_PRODUCT_SONY_DS4 0x05c4
|
||||||
#define USB_PRODUCT_SONY_DS4_DONGLE 0x0ba0
|
#define USB_PRODUCT_SONY_DS4_DONGLE 0x0ba0
|
||||||
#define USB_PRODUCT_SONY_DS4_SLIM 0x09cc
|
#define USB_PRODUCT_SONY_DS4_SLIM 0x09cc
|
||||||
|
#define USB_PRODUCT_SONY_DS4_STRIKEPAD 0x05c5
|
||||||
#define USB_PRODUCT_SONY_DS5 0x0ce6
|
#define USB_PRODUCT_SONY_DS5 0x0ce6
|
||||||
#define USB_PRODUCT_SONY_DS5_EDGE 0x0df2
|
#define USB_PRODUCT_SONY_DS5_EDGE 0x0df2
|
||||||
#define USB_PRODUCT_VICTRIX_FS_PRO_V2 0x0207
|
#define USB_PRODUCT_VICTRIX_FS_PRO_V2 0x0207
|
||||||
|
|
Loading…
Reference in a new issue