mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-08-29 18:11:38 +00:00
Use Apple's nomenclature for macOS and iOS
Fixes https://github.com/libsdl-org/SDL/issues/6621
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
/*#define DEBUG_LUNA_PROTOCOL*/
|
||||
|
||||
/* Sending rumble on macOS blocks for a long time and eventually fails */
|
||||
#if !defined(__MACOSX__)
|
||||
#if !defined(__MACOS__)
|
||||
#define ENABLE_LUNA_BLUETOOTH_RUMBLE
|
||||
#endif
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ HIDAPI_DriverPS3_IsEnabled(void)
|
||||
{
|
||||
SDL_bool default_value;
|
||||
|
||||
#if defined(__MACOSX__)
|
||||
#if defined(__MACOS__)
|
||||
/* This works well on macOS */
|
||||
default_value = SDL_TRUE;
|
||||
#elif defined(__WINDOWS__)
|
||||
|
||||
@@ -366,7 +366,7 @@ static int GetFeatureReport( SDL_hid_device *dev, unsigned char uBuffer[65] )
|
||||
// On Windows and macOS, BLE devices get 2 copies of the feature report ID, one that is removed by ReadFeatureReport,
|
||||
// and one that's included in the buffer we receive. We pad the bytes to read and skip over the report ID
|
||||
// if necessary.
|
||||
#if defined(__WIN32__) || defined(__MACOSX__)
|
||||
#if defined(__WIN32__) || defined(__MACOS__)
|
||||
++ucBytesToRead;
|
||||
++ucDataStartOffset;
|
||||
#endif
|
||||
|
||||
@@ -87,13 +87,13 @@ HIDAPI_DriverXbox360_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *na
|
||||
/* This is the chatpad or other input interface, not the Xbox 360 interface */
|
||||
return SDL_FALSE;
|
||||
}
|
||||
#if defined(__MACOSX__) || defined(__WIN32__)
|
||||
#if defined(__MACOS__) || defined(__WIN32__)
|
||||
if (vendor_id == USB_VENDOR_MICROSOFT && product_id == 0x028e && version == 1) {
|
||||
/* This is the Steam Virtual Gamepad, which isn't supported by this driver */
|
||||
return SDL_FALSE;
|
||||
}
|
||||
#endif
|
||||
#if defined(__MACOSX__)
|
||||
#if defined(__MACOS__)
|
||||
/* Wired Xbox One controllers are handled by this driver, interfacing with
|
||||
the 360Controller driver available from:
|
||||
https://github.com/360Controller/360Controller/releases
|
||||
@@ -209,7 +209,7 @@ HIDAPI_DriverXbox360_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joyst
|
||||
static int
|
||||
HIDAPI_DriverXbox360_RumbleJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)
|
||||
{
|
||||
#ifdef __MACOSX__
|
||||
#ifdef __MACOS__
|
||||
if (SDL_IsJoystickBluetoothXboxOne(device->vendor_id, device->product_id)) {
|
||||
Uint8 rumble_packet[] = { 0x03, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00 };
|
||||
|
||||
@@ -220,7 +220,7 @@ HIDAPI_DriverXbox360_RumbleJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joy
|
||||
return SDL_SetError("Couldn't send rumble packet");
|
||||
}
|
||||
} else {
|
||||
/* On Mac OS X the 360Controller driver uses this short report,
|
||||
/* 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 };
|
||||
@@ -280,7 +280,7 @@ static void
|
||||
HIDAPI_DriverXbox360_HandleStatePacket(SDL_Joystick *joystick, SDL_DriverXbox360_Context *ctx, Uint8 *data, int size)
|
||||
{
|
||||
Sint16 axis;
|
||||
#ifdef __MACOSX__
|
||||
#ifdef __MACOS__
|
||||
const SDL_bool invert_y_axes = SDL_FALSE;
|
||||
#else
|
||||
const SDL_bool invert_y_axes = SDL_TRUE;
|
||||
|
||||
@@ -365,7 +365,7 @@ HIDAPI_DriverXboxOne_IsEnabled(void)
|
||||
static SDL_bool
|
||||
HIDAPI_DriverXboxOne_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
{
|
||||
#ifdef __MACOSX__
|
||||
#ifdef __MACOS__
|
||||
/* Wired Xbox One controllers are handled by the 360Controller driver */
|
||||
if (!SDL_IsJoystickBluetoothXboxOne(vendor_id, product_id)) {
|
||||
return SDL_FALSE;
|
||||
|
||||
@@ -67,8 +67,8 @@ typedef struct _SDL_HIDAPI_Device
|
||||
int interface_class;
|
||||
int interface_subclass;
|
||||
int interface_protocol;
|
||||
Uint16 usage_page; /* Available on Windows and Mac OS X */
|
||||
Uint16 usage; /* Available on Windows and Mac OS X */
|
||||
Uint16 usage_page; /* Available on Windows and macOS */
|
||||
Uint16 usage; /* Available on Windows and macOS */
|
||||
SDL_bool is_bluetooth;
|
||||
SDL_JoystickType joystick_type;
|
||||
SDL_GameControllerType type;
|
||||
|
||||
Reference in New Issue
Block a user