Define SDL_PLATFORM_* macros instead of underscored ones (#8875)
This commit is contained in:
committed by
GitHub
parent
ceccf24519
commit
31d133db40
@@ -32,7 +32,7 @@
|
||||
/*#define DEBUG_LUNA_PROTOCOL*/
|
||||
|
||||
/* Sending rumble on macOS blocks for a long time and eventually fails */
|
||||
#ifndef __MACOS__
|
||||
#ifndef SDL_PLATFORM_MACOS
|
||||
#define ENABLE_LUNA_BLUETOOTH_RUMBLE
|
||||
#endif
|
||||
|
||||
|
||||
@@ -69,15 +69,15 @@ static SDL_bool HIDAPI_DriverPS3_IsEnabled(void)
|
||||
{
|
||||
SDL_bool default_value;
|
||||
|
||||
#ifdef __MACOS__
|
||||
#ifdef SDL_PLATFORM_MACOS
|
||||
/* This works well on macOS */
|
||||
default_value = SDL_TRUE;
|
||||
#elif defined(__WINDOWS__)
|
||||
#elif defined(SDL_PLATFORM_WINDOWS)
|
||||
/* You can't initialize the controller with the stock Windows drivers
|
||||
* See https://github.com/ViGEm/DsHidMini as an alternative driver
|
||||
*/
|
||||
default_value = SDL_FALSE;
|
||||
#elif defined(__LINUX__)
|
||||
#elif defined(SDL_PLATFORM_LINUX)
|
||||
/* Linux drivers do a better job of managing the transition between
|
||||
* USB and Bluetooth. There are also some quirks in communicating
|
||||
* with PS3 controllers that have been implemented in SDL's hidapi
|
||||
|
||||
@@ -347,7 +347,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(__MACOS__)
|
||||
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_MACOS)
|
||||
++ucBytesToRead;
|
||||
++ucDataStartOffset;
|
||||
#endif
|
||||
@@ -980,13 +980,13 @@ static SDL_bool HIDAPI_DriverSteam_InitDevice(SDL_HIDAPI_Device *device)
|
||||
}
|
||||
device->context = ctx;
|
||||
|
||||
#ifdef __WIN32__
|
||||
#ifdef SDL_PLATFORM_WIN32
|
||||
if (device->serial) {
|
||||
/* We get a garbage serial number on Windows */
|
||||
SDL_free(device->serial);
|
||||
device->serial = NULL;
|
||||
}
|
||||
#endif /* __WIN32__ */
|
||||
#endif /* SDL_PLATFORM_WIN32 */
|
||||
|
||||
HIDAPI_SetDeviceName(device, "Steam Controller");
|
||||
|
||||
|
||||
@@ -454,7 +454,7 @@ static void CheckMotionPlusConnection(SDL_DriverWii_Context *ctx)
|
||||
|
||||
static void ActivateMotionPlusWithMode(SDL_DriverWii_Context *ctx, Uint8 mode)
|
||||
{
|
||||
#ifdef __LINUX__
|
||||
#ifdef SDL_PLATFORM_LINUX
|
||||
/* Linux drivers maintain a lot of state around the Motion Plus
|
||||
* extension, so don't mess with it here.
|
||||
*/
|
||||
|
||||
@@ -80,7 +80,7 @@ static SDL_bool HIDAPI_DriverXbox360_IsSupportedDevice(SDL_HIDAPI_Device *device
|
||||
/* This is the chatpad or other input interface, not the Xbox 360 interface */
|
||||
return SDL_FALSE;
|
||||
}
|
||||
#ifdef __MACOS__
|
||||
#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 SDL_FALSE;
|
||||
@@ -197,7 +197,7 @@ static SDL_bool HIDAPI_DriverXbox360_OpenJoystick(SDL_HIDAPI_Device *device, SDL
|
||||
|
||||
static int HIDAPI_DriverXbox360_RumbleJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)
|
||||
{
|
||||
#ifdef __MACOS__
|
||||
#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 };
|
||||
|
||||
@@ -267,7 +267,7 @@ static int HIDAPI_DriverXbox360_SetJoystickSensorsEnabled(SDL_HIDAPI_Device *dev
|
||||
static void HIDAPI_DriverXbox360_HandleStatePacket(SDL_Joystick *joystick, SDL_DriverXbox360_Context *ctx, Uint8 *data, int size)
|
||||
{
|
||||
Sint16 axis;
|
||||
#ifdef __MACOS__
|
||||
#ifdef SDL_PLATFORM_MACOS
|
||||
const SDL_bool invert_y_axes = SDL_FALSE;
|
||||
#else
|
||||
const SDL_bool invert_y_axes = SDL_TRUE;
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
/* Define this if you want to log all packets from the controller */
|
||||
/*#define DEBUG_XBOX_PROTOCOL*/
|
||||
|
||||
#if defined(__WIN32__) || defined(__WINGDK__)
|
||||
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
|
||||
#define XBOX_ONE_DRIVER_ACTIVE 1
|
||||
#else
|
||||
#define XBOX_ONE_DRIVER_ACTIVE 0
|
||||
@@ -350,7 +350,7 @@ static SDL_bool HIDAPI_DriverXboxOne_IsEnabled(void)
|
||||
|
||||
static SDL_bool HIDAPI_DriverXboxOne_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GamepadType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
{
|
||||
#ifdef __MACOS__
|
||||
#ifdef SDL_PLATFORM_MACOS
|
||||
/* Wired Xbox One controllers are handled by the 360Controller driver */
|
||||
if (!SDL_IsJoystickBluetoothXboxOne(vendor_id, product_id)) {
|
||||
return SDL_FALSE;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "SDL_hidapi_rumble.h"
|
||||
#include "../../SDL_hints_c.h"
|
||||
|
||||
#if defined(__WIN32__) || defined(__WINGDK__)
|
||||
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
|
||||
#include "../windows/SDL_rawinputjoystick_c.h"
|
||||
#endif
|
||||
|
||||
@@ -451,7 +451,7 @@ static void HIDAPI_SetupDeviceDriver(SDL_HIDAPI_Device *device, SDL_bool *remove
|
||||
/* Wait a little bit for the device to initialize */
|
||||
SDL_Delay(10);
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#ifdef SDL_PLATFORM_ANDROID
|
||||
/* On Android we need to leave joysticks unlocked because it calls
|
||||
* out to the main thread for permissions and the main thread can
|
||||
* be in the process of handling controller input.
|
||||
|
||||
Reference in New Issue
Block a user