mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 06:44:27 +00:00
(apple_hid.c) Cleanup
This commit is contained in:
parent
6c4e92f0ca
commit
e1d67f23b1
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
typedef struct apple_hid
|
typedef struct apple_hid
|
||||||
{
|
{
|
||||||
IOHIDManagerRef hid_ptr;
|
IOHIDManagerRef ptr;
|
||||||
joypad_connection_t *slots;
|
joypad_connection_t *slots;
|
||||||
} apple_hid_t;
|
} apple_hid_t;
|
||||||
|
|
||||||
@ -372,15 +372,15 @@ static int apple_hid_manager_init(apple_hid_t *hid)
|
|||||||
{
|
{
|
||||||
if (!hid)
|
if (!hid)
|
||||||
return -1;
|
return -1;
|
||||||
if (hid->hid_ptr) /* already initialized. */
|
if (hid->ptr) /* already initialized. */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
hid->hid_ptr = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone);
|
hid->ptr = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone);
|
||||||
|
|
||||||
if (hid->hid_ptr)
|
if (hid->ptr)
|
||||||
{
|
{
|
||||||
IOHIDManagerSetDeviceMatching(hid->hid_ptr, NULL);
|
IOHIDManagerSetDeviceMatching(hid->ptr, NULL);
|
||||||
IOHIDManagerScheduleWithRunLoop(hid->hid_ptr, CFRunLoopGetCurrent(),
|
IOHIDManagerScheduleWithRunLoop(hid->ptr, CFRunLoopGetCurrent(),
|
||||||
kCFRunLoopDefaultMode);
|
kCFRunLoopDefaultMode);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -391,14 +391,14 @@ static int apple_hid_manager_init(apple_hid_t *hid)
|
|||||||
|
|
||||||
static int apple_hid_manager_free(apple_hid_t *hid)
|
static int apple_hid_manager_free(apple_hid_t *hid)
|
||||||
{
|
{
|
||||||
if (!hid || !hid->hid_ptr)
|
if (!hid || !hid->ptr)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
IOHIDManagerUnscheduleFromRunLoop(hid->hid_ptr,
|
IOHIDManagerUnscheduleFromRunLoop(hid->ptr,
|
||||||
CFRunLoopGetCurrent(), kCFRunLoopCommonModes);
|
CFRunLoopGetCurrent(), kCFRunLoopCommonModes);
|
||||||
IOHIDManagerClose(hid->hid_ptr, kIOHIDOptionsTypeNone);
|
IOHIDManagerClose(hid->ptr, kIOHIDOptionsTypeNone);
|
||||||
CFRelease(hid->hid_ptr);
|
CFRelease(hid->ptr);
|
||||||
hid->hid_ptr = NULL;
|
hid->ptr = NULL;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -416,8 +416,8 @@ static int apple_hid_manager_set_device_matching(apple_hid_t *hid)
|
|||||||
apple_hid_append_matching_dictionary(matcher, kHIDPage_GenericDesktop,
|
apple_hid_append_matching_dictionary(matcher, kHIDPage_GenericDesktop,
|
||||||
kHIDUsage_GD_GamePad);
|
kHIDUsage_GD_GamePad);
|
||||||
|
|
||||||
IOHIDManagerSetDeviceMatchingMultiple(hid->hid_ptr, matcher);
|
IOHIDManagerSetDeviceMatchingMultiple(hid->ptr, matcher);
|
||||||
IOHIDManagerRegisterDeviceMatchingCallback(hid->hid_ptr,
|
IOHIDManagerRegisterDeviceMatchingCallback(hid->ptr,
|
||||||
apple_hid_device_add, 0);
|
apple_hid_device_add, 0);
|
||||||
|
|
||||||
CFRelease(matcher);
|
CFRelease(matcher);
|
||||||
@ -450,7 +450,7 @@ static void apple_hid_free(void *data)
|
|||||||
{
|
{
|
||||||
apple_hid_t *hid_apple = (apple_hid_t*)data;
|
apple_hid_t *hid_apple = (apple_hid_t*)data;
|
||||||
|
|
||||||
if (!hid_apple || !hid_apple->hid_ptr)
|
if (!hid_apple || !hid_apple->ptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pad_connection_destroy(hid_apple->slots);
|
pad_connection_destroy(hid_apple->slots);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user