Merge pull request #619 from gtalusan/master

Mac: fix gamepad control on Catalina
This commit is contained in:
Michael Buckley 2020-01-06 20:40:48 -08:00 committed by GitHub
commit 04692e1ee4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -700,14 +700,15 @@ std::unordered_map<struct JoypadInput, S9xButtonCode> 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;
}
}