SDL: mac: Fix handling of deprecated symbol.

From bb0b8adacc7a082d1a530f9ac912771cb1c09a97 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Wed, 16 Nov 2022 22:02:21 -0500
Subject: [PATCH] mac: Fix handling of deprecated symbol.

This needs to check what our deployment target is, not what SDK
is available, since this is a linker symbol and not an enum
value or whatever.

Also removed a copy/paste error that mentioned CoreAudio in
the haptic subsystem.

Fixes #6534.
---
 src/haptic/darwin/SDL_syshaptic_c.h | 4 +---
 src/hidapi/SDL_hidapi.c             | 7 ++++++-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/haptic/darwin/SDL_syshaptic_c.h b/src/haptic/darwin/SDL_syshaptic_c.h
index 5f68a6d63014..8e3a6ca95f02 100644
--- a/src/haptic/darwin/SDL_syshaptic_c.h
+++ b/src/haptic/darwin/SDL_syshaptic_c.h
@@ -20,12 +20,10 @@
 */
 
 /* Things named "Master" were renamed to "Main" in macOS 12.0's SDK. */
-#if MACOSX_COREAUDIO
 #include <AvailabilityMacros.h>
-#ifndef MAC_OS_VERSION_12_0
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 120000
 #define kIOMainPortDefault kIOMasterPortDefault
 #endif
-#endif
 
 extern int MacHaptic_MaybeAddDevice( io_object_t device );
 extern int MacHaptic_MaybeRemoveDevice( io_object_t device );
diff --git a/src/hidapi/SDL_hidapi.c b/src/hidapi/SDL_hidapi.c
index 52ee67027129..47818d4dcbf3 100644
--- a/src/hidapi/SDL_hidapi.c
+++ b/src/hidapi/SDL_hidapi.c
@@ -47,6 +47,11 @@
 #include <IOKit/IOKitLib.h>
 #include <IOKit/hid/IOHIDDevice.h>
 #include <IOKit/usb/USBSpec.h>
+#include <AvailabilityMacros.h>
+/* Things named "Master" were renamed to "Main" in macOS 12.0's SDK. */
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 120000
+#define kIOMainPortDefault kIOMasterPortDefault
+#endif
 #endif
 
 #include "../core/linux/SDL_udev.h"
@@ -250,7 +255,7 @@ HIDAPI_InitializeDiscovery()
 #endif /* defined(__WIN32__) || defined(__WINGDK__) */
 
 #if defined(__MACOSX__)
-    SDL_HIDAPI_discovery.m_notificationPort = IONotificationPortCreate(kIOMasterPortDefault);
+    SDL_HIDAPI_discovery.m_notificationPort = IONotificationPortCreate(kIOMainPortDefault);
     if (SDL_HIDAPI_discovery.m_notificationPort) {
         {
             io_iterator_t portIterator = 0;