Refactor apple_joypad_hid.c somewhat
This commit is contained in:
parent
cf4b43f3fa
commit
86236a9007
|
@ -225,7 +225,7 @@ static void append_matching_dictionary(CFMutableArrayRef array,
|
|||
CFRelease(matcher);
|
||||
}
|
||||
|
||||
static bool apple_joypad_init(void)
|
||||
static bool apple_hid_init(void)
|
||||
{
|
||||
CFMutableArrayRef matcher;
|
||||
|
||||
|
@ -251,17 +251,10 @@ static bool apple_joypad_init(void)
|
|||
|
||||
IOHIDManagerOpen(g_hid_manager, kIOHIDOptionsTypeNone);
|
||||
|
||||
slots = (joypad_connection_t*)pad_connection_init(MAX_USERS);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool apple_joypad_query_pad(unsigned pad)
|
||||
{
|
||||
return pad < MAX_USERS;
|
||||
}
|
||||
|
||||
static void apple_joypad_hid_destroy(void)
|
||||
static void apple_hid_free(void)
|
||||
{
|
||||
if (!g_hid_manager)
|
||||
return;
|
||||
|
@ -275,10 +268,25 @@ static void apple_joypad_hid_destroy(void)
|
|||
g_hid_manager = NULL;
|
||||
}
|
||||
|
||||
static bool apple_joypad_init(void)
|
||||
{
|
||||
if (!apple_hid_init())
|
||||
return false;
|
||||
|
||||
slots = (joypad_connection_t*)pad_connection_init(MAX_USERS);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool apple_joypad_query_pad(unsigned pad)
|
||||
{
|
||||
return pad < MAX_USERS;
|
||||
}
|
||||
|
||||
static void apple_joypad_destroy(void)
|
||||
{
|
||||
pad_connection_destroy(slots);
|
||||
apple_joypad_hid_destroy();
|
||||
apple_hid_free();
|
||||
}
|
||||
|
||||
static bool apple_joypad_button(unsigned port, uint16_t joykey)
|
||||
|
|
Loading…
Reference in New Issue