Created
December 24, 2011 15:17
-
-
Save mantognini/1517542 to your computer and use it in GitHub Desktop.
SFML2 joysticks patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/src/SFML/Window/OSX/HIDJoystickManager.cpp b/src/SFML/Window/OSX/HIDJoystickManager.cpp | |
| index fcb9730..0b6bb68 100644 | |
| --- a/src/SFML/Window/OSX/HIDJoystickManager.cpp | |
| +++ b/src/SFML/Window/OSX/HIDJoystickManager.cpp | |
| @@ -75,10 +75,23 @@ HIDJoystickManager::HIDJoystickManager() | |
| { | |
| myHIDManager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone); | |
| - CFDictionaryRef mask = HIDInputManager::CopyDevicesMask(kHIDPage_GenericDesktop, | |
| - kHIDUsage_GD_Joystick); | |
| - IOHIDManagerSetDeviceMatching(myHIDManager, mask); | |
| + CFDictionaryRef mask0 = HIDInputManager::CopyDevicesMask(kHIDPage_GenericDesktop, | |
| + kHIDUsage_GD_Joystick); | |
| + | |
| + CFDictionaryRef mask1 = HIDInputManager::CopyDevicesMask(kHIDPage_GenericDesktop, | |
| + kHIDUsage_GD_GamePad); | |
| + | |
| + CFDictionaryRef maskArray[2]; | |
| + maskArray[0] = mask0; | |
| + maskArray[1] = mask1; | |
| + | |
| + CFArrayRef mask = CFArrayCreate(NULL, (const void**)maskArray, 2, NULL); | |
| + | |
| + IOHIDManagerSetDeviceMatchingMultiple(myHIDManager, mask); | |
| CFRelease(mask); | |
| + CFRelease(mask1); | |
| + CFRelease(mask0); | |
| + | |
| IOHIDManagerRegisterDeviceMatchingCallback(myHIDManager, pluggedIn, this); | |
| IOHIDManagerRegisterDeviceRemovalCallback(myHIDManager, pluggedOut, this); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment