mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-22 19:45:40 +00:00
Fixed trying to use @available() on older SDK
This commit is contained in:
parent
b4338dda47
commit
a5cde4cb0c
|
@ -2823,7 +2823,7 @@ AS_HELP_STRING([--enable-joystick-mfi], [include macOS MFI joystick support [[de
|
|||
AC_MSG_RESULT($enable_joystick_mfi)
|
||||
if test x$enable_joystick_mfi = xyes; then
|
||||
AC_DEFINE(SDL_JOYSTICK_MFI, 1, [ ])
|
||||
EXTRA_CFLAGS="$EXTRA_CFLAGS -fobjc-weak"
|
||||
EXTRA_CFLAGS="$EXTRA_CFLAGS -fobjc-weak -Wno-unused-command-line-argument"
|
||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-weak_framework,CoreHaptics -Wl,-weak_framework,GameController"
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -39,10 +39,12 @@
|
|||
#if TARGET_OS_IOS
|
||||
#define SDL_JOYSTICK_iOS_ACCELEROMETER
|
||||
#import <CoreMotion/CoreMotion.h>
|
||||
#endif
|
||||
|
||||
#if TARGET_OS_OSX
|
||||
#else /* TARGET_OS_OSX */
|
||||
#include <IOKit/hid/IOHIDManager.h>
|
||||
#include <AppKit/NSApplication.h>
|
||||
#ifndef NSAppKitVersionNumber10_15
|
||||
#define NSAppKitVersionNumber10_15 1894
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef SDL_JOYSTICK_MFI
|
||||
|
@ -464,10 +466,22 @@ SDL_AppleTVRemoteRotationHintChanged(void *udata, const char *name, const char *
|
|||
}
|
||||
#endif /* TARGET_OS_TV */
|
||||
|
||||
#if TARGET_OS_IOS
|
||||
static inline int is_macos11 (void)
|
||||
{
|
||||
return (@available(macos 11.0, *));
|
||||
}
|
||||
#else /* TARGET_OS_OSX */
|
||||
static inline int is_macos11 (void)
|
||||
{
|
||||
return (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_15);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
IOS_JoystickInit(void)
|
||||
{
|
||||
if (@available(macos 11.0, *)) @autoreleasepool {
|
||||
if (is_macos11()) @autoreleasepool {
|
||||
#ifdef SDL_JOYSTICK_iOS_ACCELEROMETER
|
||||
if (SDL_GetHintBoolean(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, SDL_TRUE)) {
|
||||
/* Default behavior, accelerometer as joystick */
|
||||
|
@ -1368,7 +1382,7 @@ IOS_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out)
|
|||
SDL_bool IOS_SupportedHIDDevice(IOHIDDeviceRef device)
|
||||
{
|
||||
#ifdef SDL_JOYSTICK_MFI
|
||||
if (@available(macOS 11.0, *)) {
|
||||
if (is_macos11()) {
|
||||
return [GCController supportsHIDDevice:device] ? SDL_TRUE : SDL_FALSE;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue