Add preprocessor checks and warnings for building on older Xcode SDKs

This commit is contained in:
Snowdream 2022-07-20 12:08:13 -04:00
parent 88c5cfbbae
commit f81dda36fd

View file

@ -13,6 +13,7 @@
// Yes, it is still a mess, but it is working.
#import <GameController/GameController.h>
#include <Availability.h>
#import <SDL_scancode.h>
#import <SDL_keyboard.h>
@ -194,17 +195,29 @@ s.d.ca.dir = (axis.value >= 0) ? AxisDir::Positive : AxisDir::Negative;
checkButtonElement(dpad, dpad.right, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, 12)
checkButtonAlt(leftShoulder, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, 12)
checkButtonAlt(rightShoulder, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, 12)
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_14_1
// Requires macOS 10.14.1+
checkButtonAlt(leftThumbstickButton, SDL_CONTROLLER_BUTTON_LEFTSTICK, 14)
checkButtonAlt(rightThumbstickButton, SDL_CONTROLLER_BUTTON_RIGHTSTICK, 14)
#else
#warning "This SDK doesn't support the detection of thumbstick buttons. You will not be able to rebind them from the menu on 10.14.1 or higher."
#endif
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_15
// Requires macOS 10.15+
checkButton(Menu, SDL_CONTROLLER_BUTTON_START, 15)
checkButton(Options, SDL_CONTROLLER_BUTTON_BACK, 15)
#else
#warning "This SDK doesn't support the detection of Start and Back buttons. You will not be able to rebind them from the menu on 10.15 or higher."
#endif
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_11_0
// Requires macOS 11.0+
checkButton(Home, SDL_CONTROLLER_BUTTON_GUIDE, 16)
#else
#warning "This SDK doesn't support the detection of the Guide button. You will not be able to rebind it from the menu on 11.0 or higher."
#endif
checkAxis(leftThumbstick, xAxis, SDL_CONTROLLER_AXIS_LEFTX)
checkAxis(leftThumbstick, yAxis, SDL_CONTROLLER_AXIS_LEFTY)