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