Commit 9d67686a5b9ceec998e65f63ab60f29687cbc340

Ryan C. Gordon 2022-11-16T10:08:40

haptic: Deal with deprecated macOS symbol.

diff --git a/src/haptic/darwin/SDL_syshaptic.c b/src/haptic/darwin/SDL_syshaptic.c
index 1141bec..50905e1 100644
--- a/src/haptic/darwin/SDL_syshaptic.c
+++ b/src/haptic/darwin/SDL_syshaptic.c
@@ -167,7 +167,7 @@ SDL_SYS_HapticInit(void)
     }
 
     /* Now search I/O Registry for matching devices. */
-    result = IOServiceGetMatchingServices(kIOMasterPortDefault, match, &iter);
+    result = IOServiceGetMatchingServices(kIOMainPortDefault, match, &iter);
     if (result != kIOReturnSuccess) {
         return SDL_SetError("Haptic: Couldn't create a HID object iterator.");
     }
diff --git a/src/haptic/darwin/SDL_syshaptic_c.h b/src/haptic/darwin/SDL_syshaptic_c.h
index f7f890a..5f68a6d 100644
--- a/src/haptic/darwin/SDL_syshaptic_c.h
+++ b/src/haptic/darwin/SDL_syshaptic_c.h
@@ -19,6 +19,14 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
+/* 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
+#define kIOMainPortDefault kIOMasterPortDefault
+#endif
+#endif
+
 extern int MacHaptic_MaybeAddDevice( io_object_t device );
 extern int MacHaptic_MaybeRemoveDevice( io_object_t device );