Use Apple's nomenclature for macOS and iOS

Fixes https://github.com/libsdl-org/SDL/issues/6621
This commit is contained in:
Sam Lantinga
2022-11-25 16:00:06 -08:00
parent 5fb3eb9475
commit cc1f9eb983
83 changed files with 291 additions and 296 deletions

View File

@@ -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

View File

@@ -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__)

View File

@@ -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

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;