|
@@ -1278,9 +1278,17 @@ Platform::Platform(Game* game)
|
|
|
IOHIDManagerRegisterDeviceMatchingCallback(__hidManagerRef, hidDeviceDiscoveredCallback, NULL);
|
|
IOHIDManagerRegisterDeviceMatchingCallback(__hidManagerRef, hidDeviceDiscoveredCallback, NULL);
|
|
|
IOHIDManagerRegisterDeviceRemovalCallback(__hidManagerRef, hidDeviceRemovalCallback, NULL);
|
|
IOHIDManagerRegisterDeviceRemovalCallback(__hidManagerRef, hidDeviceRemovalCallback, NULL);
|
|
|
|
|
|
|
|
- CFDictionaryRef matchingCFDictRef = IOHIDCreateDeviceMatchingDictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick);
|
|
|
|
|
- if (matchingCFDictRef) IOHIDManagerSetDeviceMatching(__hidManagerRef, matchingCFDictRef);
|
|
|
|
|
- CFRelease(matchingCFDictRef);
|
|
|
|
|
|
|
+ CFDictionaryRef matchingJoystickCFDictRef = IOHIDCreateDeviceMatchingDictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick);
|
|
|
|
|
+ CFDictionaryRef matchingGamepadCFDictRef = IOHIDCreateDeviceMatchingDictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad);
|
|
|
|
|
+ CFMutableArrayRef matchingDicts = CFArrayCreateMutable(kCFAllocatorDefault, 2, NULL);
|
|
|
|
|
+ CFArrayAppendValue(matchingDicts, matchingJoystickCFDictRef);
|
|
|
|
|
+ CFArrayAppendValue(matchingDicts, matchingGamepadCFDictRef);
|
|
|
|
|
+
|
|
|
|
|
+ if (matchingDicts) IOHIDManagerSetDeviceMatchingMultiple(__hidManagerRef, matchingDicts);
|
|
|
|
|
+
|
|
|
|
|
+ CFRelease(matchingJoystickCFDictRef);
|
|
|
|
|
+ CFRelease(matchingGamepadCFDictRef);
|
|
|
|
|
+ CFRelease(matchingDicts);
|
|
|
|
|
|
|
|
IOHIDManagerScheduleWithRunLoop(__hidManagerRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
|
|
IOHIDManagerScheduleWithRunLoop(__hidManagerRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
|
|
|
IOReturn kr = IOHIDManagerOpen(__hidManagerRef, kIOHIDOptionsTypeNone);
|
|
IOReturn kr = IOHIDManagerOpen(__hidManagerRef, kIOHIDOptionsTypeNone);
|