|
@@ -80,21 +80,10 @@ static bool HIDAPI_DriverXbox360_IsSupportedDevice(SDL_HIDAPI_Device *device, co
|
|
|
// This is the chatpad or other input interface, not the Xbox 360 interface
|
|
|
return false;
|
|
|
}
|
|
|
-#ifdef SDL_PLATFORM_MACOS
|
|
|
- if (vendor_id == USB_VENDOR_MICROSOFT && product_id == USB_PRODUCT_XBOX360_WIRED_CONTROLLER && version == 0) {
|
|
|
- // This is the Steam Virtual Gamepad, which isn't supported by this driver
|
|
|
- return false;
|
|
|
- }
|
|
|
- /* Wired Xbox One controllers are handled by this driver, interfacing with
|
|
|
- the 360Controller driver available from:
|
|
|
- https://github.com/360Controller/360Controller/releases
|
|
|
-
|
|
|
- Bluetooth Xbox One controllers are handled by the SDL Xbox One driver
|
|
|
- */
|
|
|
- if (SDL_IsJoystickBluetoothXboxOne(vendor_id, product_id)) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- return (type == SDL_GAMEPAD_TYPE_XBOX360 || type == SDL_GAMEPAD_TYPE_XBOXONE);
|
|
|
+#if defined(SDL_PLATFORM_MACOS) && defined(SDL_JOYSTICK_MFI)
|
|
|
+ // On macOS you can't write output reports to wired XBox controllers,
|
|
|
+ // so we'll just use the GCController support instead.
|
|
|
+ return false;
|
|
|
#else
|
|
|
return (type == SDL_GAMEPAD_TYPE_XBOX360);
|
|
|
#endif
|
|
@@ -197,30 +186,6 @@ static bool HIDAPI_DriverXbox360_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joy
|
|
|
|
|
|
static bool HIDAPI_DriverXbox360_RumbleJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)
|
|
|
{
|
|
|
-#ifdef SDL_PLATFORM_MACOS
|
|
|
- if (SDL_IsJoystickBluetoothXboxOne(device->vendor_id, device->product_id)) {
|
|
|
- Uint8 rumble_packet[] = { 0x03, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00 };
|
|
|
-
|
|
|
- rumble_packet[4] = (low_frequency_rumble >> 8);
|
|
|
- rumble_packet[5] = (high_frequency_rumble >> 8);
|
|
|
-
|
|
|
- if (SDL_HIDAPI_SendRumble(device, rumble_packet, sizeof(rumble_packet)) != sizeof(rumble_packet)) {
|
|
|
- return SDL_SetError("Couldn't send rumble packet");
|
|
|
- }
|
|
|
- } else {
|
|
|
- /* On macOS the 360Controller driver uses this short report,
|
|
|
- and we need to prefix it with a magic token so hidapi passes it through untouched
|
|
|
- */
|
|
|
- Uint8 rumble_packet[] = { 'M', 'A', 'G', 'I', 'C', '0', 0x00, 0x04, 0x00, 0x00 };
|
|
|
-
|
|
|
- rumble_packet[6 + 2] = (low_frequency_rumble >> 8);
|
|
|
- rumble_packet[6 + 3] = (high_frequency_rumble >> 8);
|
|
|
-
|
|
|
- if (SDL_HIDAPI_SendRumble(device, rumble_packet, sizeof(rumble_packet)) != sizeof(rumble_packet)) {
|
|
|
- return SDL_SetError("Couldn't send rumble packet");
|
|
|
- }
|
|
|
- }
|
|
|
-#else
|
|
|
Uint8 rumble_packet[] = { 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
|
|
|
|
|
rumble_packet[3] = (low_frequency_rumble >> 8);
|
|
@@ -229,7 +194,6 @@ static bool HIDAPI_DriverXbox360_RumbleJoystick(SDL_HIDAPI_Device *device, SDL_J
|
|
|
if (SDL_HIDAPI_SendRumble(device, rumble_packet, sizeof(rumble_packet)) != sizeof(rumble_packet)) {
|
|
|
return SDL_SetError("Couldn't send rumble packet");
|
|
|
}
|
|
|
-#endif
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -267,11 +231,7 @@ static bool HIDAPI_DriverXbox360_SetJoystickSensorsEnabled(SDL_HIDAPI_Device *de
|
|
|
static void HIDAPI_DriverXbox360_HandleStatePacket(SDL_Joystick *joystick, SDL_DriverXbox360_Context *ctx, Uint8 *data, int size)
|
|
|
{
|
|
|
Sint16 axis;
|
|
|
-#ifdef SDL_PLATFORM_MACOS
|
|
|
- const bool invert_y_axes = false;
|
|
|
-#else
|
|
|
const bool invert_y_axes = true;
|
|
|
-#endif
|
|
|
Uint64 timestamp = SDL_GetTicksNS();
|
|
|
|
|
|
if (ctx->last_state[2] != data[2]) {
|