mirror of
https://github.com/libretro/RetroArch
synced 2025-02-19 03:40:59 +00:00
iOS/tvOS/macOS: Fix autodetect for mFi controllers: properly call autodetect add on the connect notification, and add call to disconnect on GameController disconnect notification.
This commit is contained in:
parent
78915aedd1
commit
102f27ee80
@ -222,6 +222,11 @@ static void apple_gamecontroller_joypad_register(GCGamepad *gamepad)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void mfi_joypad_autodetect_add(unsigned autoconf_pad)
|
||||||
|
{
|
||||||
|
input_autoconfigure_connect("mFi Controller", NULL, mfi_joypad.ident, autoconf_pad, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
static void apple_gamecontroller_joypad_connect(GCController *controller)
|
static void apple_gamecontroller_joypad_connect(GCController *controller)
|
||||||
{
|
{
|
||||||
signed desired_index = (int32_t)controller.playerIndex;
|
signed desired_index = (int32_t)controller.playerIndex;
|
||||||
@ -279,6 +284,7 @@ static void apple_gamecontroller_joypad_connect(GCController *controller)
|
|||||||
}
|
}
|
||||||
|
|
||||||
apple_gamecontroller_joypad_register(controller.gamepad);
|
apple_gamecontroller_joypad_register(controller.gamepad);
|
||||||
|
mfi_joypad_autodetect_add(controller.playerIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,17 +296,15 @@ static void apple_gamecontroller_joypad_disconnect(GCController* controller)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
mfi_controllers[pad] = 0;
|
mfi_controllers[pad] = 0;
|
||||||
[mfiControllers removeObject:controller];
|
if ( [mfiControllers containsObject:controller] )
|
||||||
}
|
{
|
||||||
|
[mfiControllers removeObject:controller];
|
||||||
static void mfi_joypad_autodetect_add(unsigned autoconf_pad)
|
input_autoconfigure_disconnect(pad, mfi_joypad.ident);
|
||||||
{
|
}
|
||||||
input_autoconfigure_connect("mFi Controller", NULL, mfi_joypad.ident, autoconf_pad, 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool apple_gamecontroller_joypad_init(void *data)
|
bool apple_gamecontroller_joypad_init(void *data)
|
||||||
{
|
{
|
||||||
mfi_joypad_autodetect_add(0);
|
|
||||||
static bool inited = false;
|
static bool inited = false;
|
||||||
if (inited)
|
if (inited)
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user