|
|
@@ -230,7 +230,7 @@ typedef struct
|
|
|
{
|
|
|
SDL_HIDAPI_Device *device;
|
|
|
SDL_Joystick *joystick;
|
|
|
- bool is_nacon_dongle;
|
|
|
+ bool is_dongle;
|
|
|
bool use_alternate_report;
|
|
|
bool sensors_supported;
|
|
|
bool lightbar_supported;
|
|
|
@@ -516,7 +516,8 @@ static bool HIDAPI_DriverPS5_InitDevice(SDL_HIDAPI_Device *device)
|
|
|
ctx->use_alternate_report = true;
|
|
|
} else if (device->vendor_id == USB_VENDOR_RAZER &&
|
|
|
(device->product_id == USB_PRODUCT_RAZER_KITSUNE ||
|
|
|
- device->product_id == USB_PRODUCT_RAZER_RAIJU_V3_PRO)) {
|
|
|
+ device->product_id == USB_PRODUCT_RAZER_RAIJU_V3_PRO_PS5_WIRED ||
|
|
|
+ device->product_id == USB_PRODUCT_RAZER_RAIJU_V3_PRO_PS5_WIRELESS)) {
|
|
|
// The Razer Kitsune and Raiju don't respond to the detection protocol, but have a touchpad
|
|
|
joystick_type = SDL_JOYSTICK_TYPE_ARCADE_STICK;
|
|
|
ctx->touchpad_supported = true;
|
|
|
@@ -525,9 +526,13 @@ static bool HIDAPI_DriverPS5_InitDevice(SDL_HIDAPI_Device *device)
|
|
|
}
|
|
|
ctx->effects_supported = (ctx->lightbar_supported || ctx->vibration_supported || ctx->playerled_supported);
|
|
|
|
|
|
- if (device->vendor_id == USB_VENDOR_NACON_ALT &&
|
|
|
- device->product_id == USB_PRODUCT_NACON_REVOLUTION_5_PRO_PS5_WIRELESS) {
|
|
|
- ctx->is_nacon_dongle = true;
|
|
|
+ if ((device->vendor_id == USB_VENDOR_NACON_ALT &&
|
|
|
+ device->product_id == USB_PRODUCT_NACON_REVOLUTION_5_PRO_PS5_WIRELESS) ||
|
|
|
+ (device->vendor_id == USB_VENDOR_RAZER &&
|
|
|
+ (device->product_id == USB_PRODUCT_NACON_REVOLUTION_5_PRO_PS5_WIRELESS ||
|
|
|
+ device->product_id == USB_PRODUCT_RAZER_WOLVERINE_V2_PRO_PS5_WIRELESS ||
|
|
|
+ device->product_id == USB_PRODUCT_RAZER_RAIJU_V3_PRO_PS5_WIRELESS))) {
|
|
|
+ ctx->is_dongle = true;
|
|
|
}
|
|
|
|
|
|
device->joystick_type = joystick_type;
|
|
|
@@ -541,7 +546,7 @@ static bool HIDAPI_DriverPS5_InitDevice(SDL_HIDAPI_Device *device)
|
|
|
}
|
|
|
HIDAPI_SetDeviceSerial(device, serial);
|
|
|
|
|
|
- if (ctx->is_nacon_dongle) {
|
|
|
+ if (ctx->is_dongle) {
|
|
|
// We don't know if this is connected yet, wait for reports
|
|
|
return true;
|
|
|
}
|
|
|
@@ -965,6 +970,10 @@ static bool HIDAPI_DriverPS5_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joystic
|
|
|
joystick->nhats = 1;
|
|
|
joystick->firmware_version = ctx->firmware_version;
|
|
|
|
|
|
+ if (ctx->is_dongle) {
|
|
|
+ joystick->connection_state = SDL_JOYSTICK_CONNECTION_WIRELESS;
|
|
|
+ }
|
|
|
+
|
|
|
SDL_AddHintCallback(SDL_HINT_JOYSTICK_ENHANCED_REPORTS,
|
|
|
SDL_PS5EnhancedReportsChanged, ctx);
|
|
|
SDL_AddHintCallback(SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED,
|
|
|
@@ -1465,15 +1474,16 @@ static bool HIDAPI_DriverPS5_IsPacketValid(SDL_DriverPS5_Context *ctx, Uint8 *da
|
|
|
{
|
|
|
switch (data[0]) {
|
|
|
case k_EPS5ReportIdState:
|
|
|
- if (ctx->is_nacon_dongle && size >= (1 + sizeof(PS5StatePacketAlt_t))) {
|
|
|
+ if (ctx->is_dongle && size >= (1 + sizeof(PS5StatePacketAlt_t))) {
|
|
|
// The report timestamp doesn't change when the controller isn't connected
|
|
|
PS5StatePacketAlt_t *packet = (PS5StatePacketAlt_t *)&data[1];
|
|
|
if (SDL_memcmp(packet->rgucPacketSequence, ctx->last_state.state.rgucPacketSequence, sizeof(packet->rgucPacketSequence)) == 0) {
|
|
|
return false;
|
|
|
}
|
|
|
- if (ctx->last_state.alt_state.rgucAccelX[0] == 0 && ctx->last_state.alt_state.rgucAccelX[1] == 0 &&
|
|
|
- ctx->last_state.alt_state.rgucAccelY[0] == 0 && ctx->last_state.alt_state.rgucAccelY[1] == 0 &&
|
|
|
- ctx->last_state.alt_state.rgucAccelZ[0] == 0 && ctx->last_state.alt_state.rgucAccelZ[1] == 0) {
|
|
|
+ if (ctx->last_state.state.rgucPacketSequence[0] == 0 &&
|
|
|
+ ctx->last_state.state.rgucPacketSequence[1] == 0 &&
|
|
|
+ ctx->last_state.state.rgucPacketSequence[2] == 0 &&
|
|
|
+ ctx->last_state.state.rgucPacketSequence[3] == 0) {
|
|
|
// We don't have any state to compare yet, go ahead and copy it
|
|
|
SDL_memcpy(&ctx->last_state, &data[1], sizeof(PS5StatePacketAlt_t));
|
|
|
return false;
|
|
|
@@ -1572,7 +1582,7 @@ static bool HIDAPI_DriverPS5_UpdateDevice(SDL_HIDAPI_Device *device)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (ctx->is_nacon_dongle) {
|
|
|
+ if (ctx->is_dongle) {
|
|
|
if (packet_count == 0) {
|
|
|
if (device->num_joysticks > 0) {
|
|
|
// Check to see if it looks like the device disconnected
|