mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
(iOS) Some backwards compatibility fixes
This commit is contained in:
parent
91fe5c52b4
commit
6545aa8706
@ -17,9 +17,15 @@
|
||||
#include "RetroArch_Apple.h"
|
||||
#ifdef __IPHONE_7_0
|
||||
#import <GameController/GameController.h>
|
||||
#endif
|
||||
#include "apple_gamecontroller.h"
|
||||
#include "../../input/drivers/apple_input.h"
|
||||
|
||||
enum
|
||||
{
|
||||
GCCONTROLLER_PLAYER_INDEX_UNSET = -1,
|
||||
};
|
||||
|
||||
static BOOL apple_gamecontroller_available(void)
|
||||
{
|
||||
if (get_ios_version_major() <= 6)
|
||||
@ -119,7 +125,7 @@ static void apple_gamecontroller_connect(GCController *controller)
|
||||
{
|
||||
int32_t slot = apple_joypad_connect_gcapi(slots);
|
||||
|
||||
controller.playerIndex = (slot >= 0 && slot < MAX_USERS) ? slot : GCControllerPlayerIndexUnset;
|
||||
controller.playerIndex = (slot >= 0 && slot < MAX_USERS) ? slot : GCCONTROLLER_PLAYER_INDEX_UNSET;
|
||||
|
||||
if (controller.playerIndex == GCControllerPlayerIndexUnset)
|
||||
return;
|
||||
@ -130,19 +136,17 @@ static void apple_gamecontroller_connect(GCController *controller)
|
||||
static void apple_gamecontroller_disconnect(GCController* controller)
|
||||
{
|
||||
unsigned pad = (uint32_t)controller.playerIndex;
|
||||
if (pad == GCControllerPlayerIndexUnset)
|
||||
if (pad == GCCONTROLLER_PLAYER_INDEX_UNSET)
|
||||
return;
|
||||
|
||||
pad_connection_pad_deinit(&slots[pad], pad);
|
||||
}
|
||||
#endif
|
||||
|
||||
void apple_gamecontroller_init(void)
|
||||
{
|
||||
if (!apple_gamecontroller_available())
|
||||
return;
|
||||
#ifdef __IPHONE_7_0
|
||||
if (!apple_gamecontroller_available())
|
||||
return;
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:GCControllerDidConnectNotification
|
||||
object:nil
|
||||
queue:[NSOperationQueue mainQueue]
|
||||
|
Loading…
x
Reference in New Issue
Block a user