From c4baea0acd30805e8502759ff9166ae33106019e Mon Sep 17 00:00:00 2001 From: George Talusan Date: Mon, 6 Jan 2020 11:25:21 -0500 Subject: [PATCH] Mac: fix gamepad control on Catalina --- macosx/mac-joypad.mm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/macosx/mac-joypad.mm b/macosx/mac-joypad.mm index 67b78838..35a0388e 100755 --- a/macosx/mac-joypad.mm +++ b/macosx/mac-joypad.mm @@ -700,14 +700,15 @@ std::unordered_map GetJuypadButtons(uint32 ve void SetUpHID (void) { hidManager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone); - IOHIDManagerRegisterInputValueCallback(hidManager, gamepadAction, NULL); - IOHIDManagerScheduleWithRunLoop(hidManager, CFRunLoopGetMain(), kCFRunLoopDefaultMode); - IOHIDManagerSetDeviceMatching(hidManager, NULL); - - ParseDefaults(); if (hidManager != NULL && IOHIDManagerOpen(hidManager, kIOHIDOptionsTypeNone) == kIOReturnSuccess) { + IOHIDManagerRegisterInputValueCallback(hidManager, gamepadAction, NULL); + IOHIDManagerScheduleWithRunLoop(hidManager, CFRunLoopGetMain(), kCFRunLoopDefaultMode); + IOHIDManagerSetDeviceMatching(hidManager, NULL); + + ParseDefaults(); + NSSet* devices = (NSSet *)CFBridgingRelease(IOHIDManagerCopyDevices(hidManager)); NSMutableArray *orderedDevices = [devices.allObjects mutableCopy]; @@ -763,6 +764,7 @@ void SetUpHID (void) } else { + printf("Unable to open IOHIDManager\n"); hidManager = NULL; } }