1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-08 12:15:49 +00:00

(Apple) Get rid of HAVE_CORELOCATION/HAVE_AVFOUNDATION - was mostly dormant

code and makes the Apple code needlessly complex right now. We can
always reintroduce this later on when the time is right
This commit is contained in:
twinaphex 2019-02-07 04:03:52 +01:00
parent d1edfabddb
commit f705503531
21 changed files with 1 additions and 1102 deletions

View File

@ -980,11 +980,6 @@ ifeq ($(HAVE_IOHIDMANAGER), 1)
endif
endif
ifeq ($(HAVE_CORELOCATION), 1)
DEFINES += -DHAVE_CORELOCATION
LIBS += -framework CoreLocation
endif
ifeq ($(HAVE_HID), 1)
DEFINES += -DHAVE_HID
OBJ += input/drivers_joypad/hid_joypad.o \
@ -1794,15 +1789,6 @@ ifneq ($(findstring Win32,$(OS)),)
LIBS += -lmsimg32 -lhid -lsetupapi
endif
ifeq ($(HAVE_AVFOUNDATION), 1)
ifeq ($(HAVE_COCOA), 1)
DEFINES += -DHAVE_AVFOUNDATION
LIBS += -framework AVFoundation
LIBS += -framework CoreVideo
LIBS += -framework CoreMedia
endif
endif
# Record
ifeq ($(HAVE_FFMPEG), 1)

View File

@ -37,11 +37,6 @@ static const camera_driver_t *camera_drivers[] = {
#endif
#ifdef ANDROID
&camera_android,
#endif
#if defined(HAVE_AVFOUNDATION)
#if defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH)
&camera_avfoundation,
#endif
#endif
&camera_null,
NULL,

View File

@ -356,12 +356,6 @@ static const bool _coretext_supp = true;
static const bool _coretext_supp = false;
#endif
#ifdef HAVE_AVFOUNDATION
static const bool _avfoundation_supp = true;
#else
static const bool _avfoundation_supp = false;
#endif
#if !defined(_WIN32) && !defined(GLOBAL_CONFIG_DIR)
#if defined(__HAIKU__)
#define GLOBAL_CONFIG_DIR "/system/settings"

View File

@ -547,8 +547,6 @@ static enum camera_driver_enum CAMERA_DEFAULT_DRIVER = CAMERA_V4L2;
static enum camera_driver_enum CAMERA_DEFAULT_DRIVER = CAMERA_RWEBCAM;
#elif defined(ANDROID)
static enum camera_driver_enum CAMERA_DEFAULT_DRIVER = CAMERA_ANDROID;
#elif defined(HAVE_AVFOUNDATION) && (defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH) || defined(HAVE_COCOA_METAL))
static enum camera_driver_enum CAMERA_DEFAULT_DRIVER = CAMERA_AVFOUNDATION;
#else
static enum camera_driver_enum CAMERA_DEFAULT_DRIVER = CAMERA_NULL;
#endif
@ -561,8 +559,6 @@ static enum wifi_driver_enum WIFI_DEFAULT_DRIVER = WIFI_NULL;
#if defined(ANDROID)
static enum location_driver_enum LOCATION_DEFAULT_DRIVER = LOCATION_ANDROID;
#elif defined(HAVE_CORELOCATION) && (defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH) || defined(HAVE_COCOA_METAL))
static enum location_driver_enum LOCATION_DEFAULT_DRIVER = LOCATION_CORELOCATION;
#else
static enum location_driver_enum LOCATION_DEFAULT_DRIVER = LOCATION_NULL;
#endif

View File

@ -30,9 +30,6 @@
#include <AppKit/NSOpenGL.h>
#elif defined(HAVE_COCOATOUCH)
#include <GLKit/GLKit.h>
#ifdef HAVE_AVFOUNDATION
#import <AVFoundation/AVFoundation.h>
#endif
#endif
#include <retro_assert.h>
@ -153,12 +150,6 @@ void *glkitview_init(void)
#if defined(HAVE_COCOATOUCH)
void cocoagl_bind_game_view_fbo(void)
{
#ifdef HAVE_AVFOUNDATION
/* Implicitly initializes your audio session */
AVAudioSession *audio_session = [AVAudioSession sharedInstance];
[audio_session setCategory:AVAudioSessionCategoryAmbient error:nil];
[audio_session setActive:YES error:nil];
#endif
if (g_context)
[g_view bindDrawable];
}

View File

@ -29,9 +29,6 @@
#include <AppKit/NSOpenGL.h>
#elif defined(HAVE_COCOATOUCH)
#include <GLKit/GLKit.h>
#ifdef HAVE_AVFOUNDATION
#import <AVFoundation/AVFoundation.h>
#endif
#endif
#include <retro_assert.h>
@ -151,12 +148,6 @@ void *glkitview_init(void)
#if defined(HAVE_COCOATOUCH)
void cocoagl_bind_game_view_fbo(void)
{
#ifdef HAVE_AVFOUNDATION
/* Implicitly initializes your audio session */
AVAudioSession *audio_session = [AVAudioSession sharedInstance];
[audio_session setCategory:AVAudioSessionCategoryAmbient error:nil];
[audio_session setActive:YES error:nil];
#endif
if (g_context)
[g_view bindDrawable];
}

View File

@ -32,11 +32,6 @@
static const location_driver_t *location_drivers[] = {
#ifdef ANDROID
&location_android,
#endif
#ifdef HAVE_CORELOCATION
#if defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH)
&location_corelocation,
#endif
#endif
&location_null,
NULL,

View File

@ -333,7 +333,6 @@
"-DHAVE_HID",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_RUNAHEAD",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
@ -344,7 +343,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",
@ -377,7 +375,6 @@
"-D_LZMA_UINT32_IS_ULONG",
"-DHAVE_MFI",
"-DHAVE_BTSTACK",
"-DHAVE_AVFOUNDATION",
);
PRODUCT_BUNDLE_IDENTIFIER = com.libretro.RetroArchiOS10;
PRODUCT_NAME = "$(TARGET_NAME)";
@ -422,7 +419,6 @@
"-DHAVE_HID",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_RUNAHEAD",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
@ -433,7 +429,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",
@ -467,7 +462,6 @@
"-D_LZMA_UINT32_IS_ULONG",
"-DHAVE_MFI",
"-DHAVE_BTSTACK",
"-DHAVE_AVFOUNDATION",
);
"OTHER_CFLAGS[arch=*]" = (
"-DNS_BLOCK_ASSERTIONS=1",
@ -478,7 +472,6 @@
"-DHAVE_HID",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_RUNAHEAD",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
@ -489,7 +482,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",
@ -523,7 +515,6 @@
"-D_LZMA_UINT32_IS_ULONG",
"-DHAVE_MFI",
"-DHAVE_BTSTACK",
"-DHAVE_AVFOUNDATION",
);
PRODUCT_BUNDLE_IDENTIFIER = com.libretro.RetroArchiOS10;
PRODUCT_NAME = "$(TARGET_NAME)";
@ -568,7 +559,6 @@
"-DHAVE_HID",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_RUNAHEAD",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
@ -579,7 +569,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",
@ -641,7 +630,6 @@
"-DHAVE_HID",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_RUNAHEAD",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
@ -652,7 +640,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",

View File

@ -342,7 +342,6 @@
"-DHAVE_HID",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
"-DHAVE_MINIUPNPC",
@ -352,7 +351,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",
@ -384,7 +382,6 @@
"-D_LZMA_UINT32_IS_ULONG",
"-DHAVE_MFI",
"-DHAVE_BTSTACK",
"-DHAVE_AVFOUNDATION",
);
PRODUCT_BUNDLE_IDENTIFIER = com.libretro.RetroArchiOS10S;
PRODUCT_NAME = "$(TARGET_NAME)";
@ -430,7 +427,6 @@
"-DHAVE_HID",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
"-DHAVE_MINIUPNPC",
@ -440,7 +436,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",
@ -473,7 +468,6 @@
"-D_LZMA_UINT32_IS_ULONG",
"-DHAVE_MFI",
"-DHAVE_BTSTACK",
"-DHAVE_AVFOUNDATION",
);
"OTHER_CFLAGS[arch=*]" = (
"-DNS_BLOCK_ASSERTIONS=1",
@ -485,7 +479,6 @@
"-DHAVE_HID",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
"-DHAVE_MINIUPNPC",
@ -495,7 +488,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",
@ -528,7 +520,6 @@
"-D_LZMA_UINT32_IS_ULONG",
"-DHAVE_MFI",
"-DHAVE_BTSTACK",
"-DHAVE_AVFOUNDATION",
);
PRODUCT_BUNDLE_IDENTIFIER = com.libretro.RetroArchiOS10S;
PRODUCT_NAME = "$(TARGET_NAME)";
@ -574,7 +565,6 @@
"-DHAVE_HID",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
"-DHAVE_MINIUPNPC",
@ -584,7 +574,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",
@ -646,7 +635,6 @@
"-DHAVE_HID",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
"-DHAVE_MINIUPNPC",
@ -656,7 +644,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",

View File

@ -588,7 +588,6 @@
"-DHAVE_HID",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_RUNAHEAD",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
@ -599,7 +598,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",
@ -632,7 +630,6 @@
"-D_LZMA_UINT32_IS_ULONG",
"-DHAVE_MFI",
"-DHAVE_BTSTACK",
"-DHAVE_AVFOUNDATION",
"-DHAVE_KEYMAPPER",
);
PRODUCT_BUNDLE_IDENTIFIER = com.libretro.RetroArchiOS11;
@ -678,7 +675,6 @@
"-DHAVE_HID",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_RUNAHEAD",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
@ -689,7 +685,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",
@ -723,7 +718,6 @@
"-D_LZMA_UINT32_IS_ULONG",
"-DHAVE_MFI",
"-DHAVE_BTSTACK",
"-DHAVE_AVFOUNDATION",
"-DHAVE_KEYMAPPER",
);
PRODUCT_BUNDLE_IDENTIFIER = com.libretro.RetroArchiOS11;
@ -998,7 +992,6 @@
"-DHAVE_HID",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_RUNAHEAD",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
@ -1009,7 +1002,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",
@ -1071,7 +1063,6 @@
"-DHAVE_HID",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_RUNAHEAD",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
@ -1082,7 +1073,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",

View File

@ -341,7 +341,6 @@
"-DHAVE_HID",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
"-DHAVE_MINIUPNPC",
@ -351,7 +350,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",
@ -383,7 +381,6 @@
"-D_LZMA_UINT32_IS_ULONG",
"-DHAVE_MFI",
"-DHAVE_BTSTACK",
"-DHAVE_AVFOUNDATION",
);
PRODUCT_BUNDLE_IDENTIFIER = com.libretro.RetroArchiOS11S;
PRODUCT_NAME = "$(TARGET_NAME)";
@ -429,7 +426,6 @@
"-DHAVE_HID",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
"-DHAVE_MINIUPNPC",
@ -439,7 +435,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",
@ -472,7 +467,6 @@
"-D_LZMA_UINT32_IS_ULONG",
"-DHAVE_MFI",
"-DHAVE_BTSTACK",
"-DHAVE_AVFOUNDATION",
);
"OTHER_CFLAGS[arch=*]" = (
"-DNS_BLOCK_ASSERTIONS=1",
@ -484,7 +478,6 @@
"-DHAVE_HID",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
"-DHAVE_MINIUPNPC",
@ -494,7 +487,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",
@ -527,7 +519,6 @@
"-D_LZMA_UINT32_IS_ULONG",
"-DHAVE_MFI",
"-DHAVE_BTSTACK",
"-DHAVE_AVFOUNDATION",
);
PRODUCT_BUNDLE_IDENTIFIER = com.libretro.RetroArchiOS11S;
PRODUCT_NAME = "$(TARGET_NAME)";
@ -573,7 +564,6 @@
"-DHAVE_HID",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
"-DHAVE_MINIUPNPC",
@ -583,7 +573,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",
@ -645,7 +634,6 @@
"-DHAVE_HID",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
"-DHAVE_MINIUPNPC",
@ -655,7 +643,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",

View File

@ -345,7 +345,6 @@
"-DHAVE_HID",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_RUNAHEAD",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
@ -357,7 +356,6 @@
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORETEXT",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",
@ -431,7 +429,6 @@
"-DHAVE_HID",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_RUNAHEAD",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
@ -442,7 +439,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",
@ -483,7 +479,6 @@
"-DHAVE_HID",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_RUNAHEAD",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
@ -494,7 +489,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",
@ -568,7 +562,6 @@
"-DHAVE_HID",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_RUNAHEAD",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
@ -579,7 +572,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",
@ -640,7 +632,6 @@
"-DHAVE_HID",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_RUNAHEAD",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
@ -651,7 +642,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",

View File

@ -347,7 +347,6 @@
"-DHAVE_HID",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_RUNAHEAD",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
@ -358,7 +357,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",
@ -419,7 +417,6 @@
"-DHAVE_HID",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_RUNAHEAD",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
@ -430,7 +427,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",
@ -497,7 +493,6 @@
"-DHAVE_HID",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_RUNAHEAD",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
@ -508,7 +503,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",
@ -541,7 +535,6 @@
"-D_LZMA_UINT32_IS_ULONG",
"-DHAVE_MFI",
"-DHAVE_BTSTACK",
"-DHAVE_AVFOUNDATION",
);
PRODUCT_BUNDLE_IDENTIFIER = com.libretro.RetroArch8;
PRODUCT_NAME = "$(TARGET_NAME)";
@ -586,7 +579,6 @@
"-DHAVE_HID",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_RUNAHEAD",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
@ -597,7 +589,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",
@ -631,7 +622,6 @@
"-D_LZMA_UINT32_IS_ULONG",
"-DHAVE_MFI",
"-DHAVE_BTSTACK",
"-DHAVE_AVFOUNDATION",
);
"OTHER_CFLAGS[arch=*]" = (
"-DNS_BLOCK_ASSERTIONS=1",
@ -641,7 +631,6 @@
"-DHAVE_HID",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_RUNAHEAD",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
@ -652,7 +641,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",
@ -686,7 +674,6 @@
"-D_LZMA_UINT32_IS_ULONG",
"-DHAVE_MFI",
"-DHAVE_BTSTACK",
"-DHAVE_AVFOUNDATION",
);
PRODUCT_BUNDLE_IDENTIFIER = com.libretro.RetroArch8;
PRODUCT_NAME = "$(TARGET_NAME)";

View File

@ -362,7 +362,6 @@
"-DHAVE_CORETEXT",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_RUNAHEAD",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
@ -373,7 +372,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",
@ -406,7 +404,6 @@
"-D_LZMA_UINT32_IS_ULONG",
"-DHAVE_MFI",
"-DHAVE_BTSTACK",
"-DHAVE_AVFOUNDATION",
);
PRODUCT_BUNDLE_IDENTIFIER = com.libretro.RetroArch9;
PRODUCT_NAME = RetroArch;
@ -449,7 +446,6 @@
"-DHAVE_CORETEXT",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_RUNAHEAD",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
@ -460,7 +456,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",
@ -494,7 +489,6 @@
"-D_LZMA_UINT32_IS_ULONG",
"-DHAVE_MFI",
"-DHAVE_BTSTACK",
"-DHAVE_AVFOUNDATION",
);
"OTHER_CFLAGS[arch=*]" = (
"-DNS_BLOCK_ASSERTIONS=1",
@ -503,7 +497,6 @@
"-DHAVE_CORETEXT",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_RUNAHEAD",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
@ -514,7 +507,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",
@ -548,7 +540,6 @@
"-D_LZMA_UINT32_IS_ULONG",
"-DHAVE_MFI",
"-DHAVE_BTSTACK",
"-DHAVE_AVFOUNDATION",
);
PRODUCT_BUNDLE_IDENTIFIER = com.libretro.RetroArch9;
PRODUCT_NAME = RetroArch;
@ -592,7 +583,6 @@
"-DHAVE_HID",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_RUNAHEAD",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
@ -603,7 +593,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",
@ -664,7 +653,6 @@
"-DHAVE_HID",
"-DHAVE_NETWORKING",
"-DHAVE_NETPLAYDISCOVERY",
"-DHAVE_AVFOUNDATION",
"-DHAVE_RUNAHEAD",
"-DHAVE_GRIFFIN",
"-DHAVE_STB_VORBIS",
@ -675,7 +663,6 @@
"-DHAVE_CHEEVOS",
"-DRC_DISABLE_LUA",
"-DHAVE_IMAGEVIEWER",
"-DHAVE_CORELOCATION",
"-DHAVE_RGUI",
"-DHAVE_MENU",
"-DHAVE_LIBRETRODB",

View File

@ -17,8 +17,7 @@ ${APPLICATION_NAME}_FILES = $(SRC_DIR)/griffin/griffin.c \
$(SRC_DIR)/audio/drivers_resampler/sinc_neon.S \
$(SRC_DIR)/audio/drivers_resampler/cc_resampler_neon.S
COMMON_FLAGS := -DIOS -DHAVE_GRIFFIN -DHAVE_CORELOCATION -DHAVE_NETWORKING -DHAVE_RGUI -DHAVE_MENU -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DHAVE_GLSL -DINLINE=inline -DHAVE_THREADS -D__LIBRETRO__ -DRARCH_MOBILE -std=gnu99 -DHAVE_COREAUDIO -DHAVE_OVERLAY -DHAVE_ZLIB -DWANT_ZLIB -DRARCH_INTERNAL -DHAVE_FILTERS_BUILTIN -DHAVE_XMB -D_LZMA_UINT32_IS_ULONG -DHAVE_STRL
COMMON_FLAGS += -DHAVE_AVFOUNDATION
COMMON_FLAGS := -DIOS -DHAVE_GRIFFIN -DHAVE_NETWORKING -DHAVE_RGUI -DHAVE_MENU -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DHAVE_GLSL -DINLINE=inline -DHAVE_THREADS -D__LIBRETRO__ -DRARCH_MOBILE -std=gnu99 -DHAVE_COREAUDIO -DHAVE_OVERLAY -DHAVE_ZLIB -DWANT_ZLIB -DRARCH_INTERNAL -DHAVE_FILTERS_BUILTIN -DHAVE_XMB -D_LZMA_UINT32_IS_ULONG -DHAVE_STRL
COMMON_IOS_FLAGS := -Wno-deprecated-declarations -Wno-error
COMMON_IOS_OBJCFLAGS := -fobjc-arc
INCFLAGS := -I$(SRC_DIR) -I$(SRC_DIR)/libretro-common/include

View File

@ -24,10 +24,6 @@
#include "../../menu/menu_driver.h"
#endif
#ifdef HAVE_CORELOCATION
#include <CoreLocation/CoreLocation.h>
#endif
#if defined(HAVE_COCOATOUCH)
#include <UIKit/UIKit.h>
@ -35,10 +31,6 @@
#import <GameController/GameController.h>
#endif
#ifdef HAVE_AVFOUNDATION
#import <AVFoundation/AVCaptureOutput.h>
#endif
/*********************************************/
/* RAMenuBase */
/* A menu class that displays RAMenuItemBase */
@ -97,9 +89,6 @@ void get_ios_version(int *major, int *minor);
#include <AppKit/AppKit.h>
@interface CocoaView : NSView
#ifdef HAVE_CORELOCATION
<CLLocationManagerDelegate>
#endif
+ (CocoaView*)get;
#if !defined(HAVE_COCOA)

View File

@ -27,19 +27,6 @@
/* Define compatibility symbols and categories. */
#ifdef HAVE_AVFOUNDATION
#include <AVFoundation/AVCaptureSession.h>
#include <AVFoundation/AVCaptureDevice.h>
#include <AVFoundation/AVCaptureOutput.h>
#include <AVFoundation/AVCaptureInput.h>
#include <AVFoundation/AVMediaFormat.h>
#ifdef HAVE_OPENGLES
#include <CoreVideo/CVOpenGLESTextureCache.h>
#else
#include <CoreVideo/CVOpenGLTexture.h>
#endif
#endif
#include "../../../location/location_driver.h"
#include "../../../camera/camera_driver.h"
@ -329,410 +316,4 @@ void *glkitview_init(void);
}
#endif // end HAVE_COCOATOUCH
#ifdef HAVE_AVFOUNDATION
#include "../../gfx/common/gl_common.h"
#ifndef GL_BGRA
#define GL_BGRA 0x80E1
#endif
#ifdef HAVE_OPENGLES
#define RCVOpenGLTextureCacheCreateTextureFromImage CVOpenGLESTextureCacheCreateTextureFromImage
#define RCVOpenGLTextureGetName CVOpenGLESTextureGetName
#define RCVOpenGLTextureCacheFlush CVOpenGLESTextureCacheFlush
#define RCVOpenGLTextureCacheCreate CVOpenGLESTextureCacheCreate
#define RCVOpenGLTextureRef CVOpenGLESTextureRef
#define RCVOpenGLTextureCacheRef CVOpenGLESTextureCacheRef
#if COREVIDEO_USE_EAGLCONTEXT_CLASS_IN_API
#define RCVOpenGLGetCurrentContext() (CVEAGLContext)(g_context)
#else
#define RCVOpenGLGetCurrentContext() (__bridge void *)(g_context)
#endif
#else
#define RCVOpenGLTextureCacheCreateTextureFromImage CVOpenGLTextureCacheCreateTextureFromImage
#define RCVOpenGLTextureGetName CVOpenGLTextureGetName
#define RCVOpenGLTextureCacheFlush CVOpenGLTextureCacheFlush
#define RCVOpenGLTextureCacheCreate CVOpenGLTextureCacheCreate
#define RCVOpenGLTextureRef CVOpenGLTextureRef
#define RCVOpenGLTextureCacheRef CVOpenGLTextureCacheRef
#define RCVOpenGLGetCurrentContext() CGLGetCurrentContext(), CGLGetPixelFormat(CGLGetCurrentContext())
#endif
static AVCaptureSession *_session;
static NSString *_sessionPreset;
RCVOpenGLTextureCacheRef textureCache;
GLuint outputTexture;
static bool newFrame = false;
static void event_process_camera_frame(void *pbuf_ptr)
{
CVReturn ret;
RCVOpenGLTextureRef renderTexture;
CVPixelBufferRef pixelBuffer = (CVPixelBufferRef)pbuf_ptr;
size_t width = CVPixelBufferGetWidth(pixelBuffer);
size_t height = CVPixelBufferGetHeight(pixelBuffer);
CVPixelBufferLockBaseAddress(pixelBuffer, 0);
(void)width;
(void)height;
/*TODO - rewrite all this.
*
* create a texture from our render target.
* textureCache will be what you previously
* made with RCVOpenGLTextureCacheCreate.
*/
#ifdef HAVE_OPENGLES
ret = RCVOpenGLTextureCacheCreateTextureFromImage(kCFAllocatorDefault,
textureCache, pixelBuffer, NULL, GL_TEXTURE_2D,
GL_RGBA, (GLsizei)width, (GLsizei)height,
GL_BGRA, GL_UNSIGNED_BYTE, 0, &renderTexture);
#else
ret = RCVOpenGLTextureCacheCreateTextureFromImage(kCFAllocatorDefault,
textureCache, pixelBuffer, 0, &renderTexture);
#endif
if (!renderTexture || ret)
{
RARCH_ERR("[apple_camera]: RCVOpenGLTextureCacheCreateTextureFromImage failed.\n");
return;
}
outputTexture = RCVOpenGLTextureGetName(renderTexture);
gl_bind_texture(outputTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, GL_LINEAR);
CVPixelBufferUnlockBaseAddress(pixelBuffer, 0);
[[NSNotificationCenter defaultCenter] postNotificationName:@"NewCameraTextureReady" object:nil];
newFrame = true;
glBindTexture(GL_TEXTURE_2D, 0);
RCVOpenGLTextureCacheFlush(textureCache, 0);
CFRelease(renderTexture);
CFRelease(pixelBuffer);
pixelBuffer = 0;
}
- (void)captureOutput:(AVCaptureOutput *)captureOutput
didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
fromConnection:(AVCaptureConnection *)connection
{
/* TODO: Don't post if event queue is full */
CVPixelBufferRef pixelBuffer = (CVPixelBufferRef)CVPixelBufferRetain(CMSampleBufferGetImageBuffer(sampleBuffer));
event_process_camera_frame(pixelBuffer);
}
/* TODO - add void param to onCameraInit so we can pass g_context. */
- (void) onCameraInit
{
NSError *error;
AVCaptureVideoDataOutput * dataOutput;
AVCaptureDeviceInput *input;
AVCaptureDevice *videoDevice;
CVReturn ret = RCVOpenGLTextureCacheCreate(kCFAllocatorDefault, NULL,
RCVOpenGLGetCurrentContext(), NULL, &textureCache);
(void)ret;
/* Setup Capture Session. */
_session = [[AVCaptureSession alloc] init];
[_session beginConfiguration];
/* TODO: dehardcode this based on device capabilities */
_sessionPreset = AVCaptureSessionPreset640x480;
/* Set preset session size. */
[_session setSessionPreset:_sessionPreset];
/* Creata a video device and input from that Device. Add the input to the capture session. */
videoDevice = (AVCaptureDevice*)[AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
if (videoDevice == nil)
retro_assert(0);
/* Add the device to the session. */
input = (AVCaptureDeviceInput*)[AVCaptureDeviceInput deviceInputWithDevice:videoDevice error:&error];
if (error)
{
RARCH_ERR("video device input %s\n", error.localizedDescription.UTF8String);
retro_assert(0);
}
[_session addInput:input];
/* Create the output for the capture session. */
dataOutput = (AVCaptureVideoDataOutput*)[[AVCaptureVideoDataOutput alloc] init];
[dataOutput setAlwaysDiscardsLateVideoFrames:NO]; /* Probably want to set this to NO when recording. */
[dataOutput setVideoSettings:[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:kCVPixelFormatType_32BGRA] forKey:(id)kCVPixelBufferPixelFormatTypeKey]];
/* Set dispatch to be on the main thread so OpenGL can do things with the data. */
[dataOutput setSampleBufferDelegate:self queue:dispatch_get_main_queue()];
[_session addOutput:dataOutput];
[_session commitConfiguration];
}
- (void) onCameraStart
{
[_session startRunning];
}
- (void) onCameraStop
{
[_session stopRunning];
}
- (void) onCameraFree
{
RCVOpenGLTextureCacheFlush(textureCache, 0);
CFRelease(textureCache);
}
#endif
#ifdef HAVE_CORELOCATION
#include <CoreLocation/CoreLocation.h>
static CLLocationManager *locationManager;
static bool locationChanged;
static CLLocationDegrees currentLatitude;
static CLLocationDegrees currentLongitude;
static CLLocationAccuracy currentHorizontalAccuracy;
static CLLocationAccuracy currentVerticalAccuracy;
- (bool)onLocationHasChanged
{
bool hasChanged = locationChanged;
if (hasChanged)
locationChanged = false;
return hasChanged;
}
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
locationChanged = true;
currentLatitude = newLocation.coordinate.latitude;
currentLongitude = newLocation.coordinate.longitude;
currentHorizontalAccuracy = newLocation.horizontalAccuracy;
currentVerticalAccuracy = newLocation.verticalAccuracy;
RARCH_LOG("didUpdateToLocation - latitude %f, longitude %f\n", (float)currentLatitude, (float)currentLongitude);
}
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
CLLocation *location = (CLLocation*)[locations objectAtIndex:([locations count] - 1)];
locationChanged = true;
currentLatitude = [location coordinate].latitude;
currentLongitude = [location coordinate].longitude;
currentHorizontalAccuracy = location.horizontalAccuracy;
currentVerticalAccuracy = location.verticalAccuracy;
RARCH_LOG("didUpdateLocations - latitude %f, longitude %f\n", (float)currentLatitude, (float)currentLongitude);
}
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{
RARCH_LOG("didFailWithError - %s\n", [[error localizedDescription] UTF8String]);
}
- (void)locationManagerDidPauseLocationUpdates:(CLLocationManager *)manager
{
RARCH_LOG("didPauseLocationUpdates\n");
}
- (void)locationManagerDidResumeLocationUpdates:(CLLocationManager *)manager
{
RARCH_LOG("didResumeLocationUpdates\n");
}
- (void)onLocationInit
{
/* Create the location manager
* if this object does not already have one.
*/
if (locationManager == nil)
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
locationManager.distanceFilter = kCLDistanceFilterNone;
[locationManager startUpdatingLocation];
}
#endif
@end
#ifdef HAVE_AVFOUNDATION
typedef struct apple_camera
{
void *empty;
} applecamera_t;
static void *apple_camera_init(const char *device, uint64_t caps, unsigned width, unsigned height)
{
applecamera_t *applecamera;
if ((caps & (UINT64_C(1) << RETRO_CAMERA_BUFFER_OPENGL_TEXTURE)) == 0)
{
RARCH_ERR("applecamera returns OpenGL texture.\n");
return NULL;
}
applecamera = (applecamera_t*)calloc(1, sizeof(applecamera_t));
if (!applecamera)
return NULL;
[[CocoaView get] onCameraInit];
return applecamera;
}
static void apple_camera_free(void *data)
{
applecamera_t *applecamera = (applecamera_t*)data;
[[CocoaView get] onCameraFree];
if (applecamera)
free(applecamera);
applecamera = NULL;
}
static bool apple_camera_start(void *data)
{
(void)data;
[[CocoaView get] onCameraStart];
return true;
}
static void apple_camera_stop(void *data)
{
[[CocoaView get] onCameraStop];
}
static bool apple_camera_poll(void *data, retro_camera_frame_raw_framebuffer_t frame_raw_cb,
retro_camera_frame_opengl_texture_t frame_gl_cb)
{
(void)data;
(void)frame_raw_cb;
if (frame_gl_cb && newFrame)
{
/* FIXME: Identity for now.
* Use proper texture matrix as returned by iOS Camera (if at all?). */
static const float affine[] = {
1.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 1.0f
};
frame_gl_cb(outputTexture, GL_TEXTURE_2D, affine);
newFrame = false;
}
return true;
}
camera_driver_t camera_avfoundation = {
apple_camera_init,
apple_camera_free,
apple_camera_start,
apple_camera_stop,
apple_camera_poll,
"avfoundation",
};
#endif
#ifdef HAVE_CORELOCATION
typedef struct apple_location
{
void *empty;
} applelocation_t;
static void *apple_location_init(void)
{
applelocation_t *applelocation = (applelocation_t*)calloc(1, sizeof(applelocation_t));
if (!applelocation)
return NULL;
[[CocoaView get] onLocationInit];
return applelocation;
}
static void apple_location_set_interval(void *data, unsigned interval_update_ms, unsigned interval_distance)
{
(void)data;
locationManager.distanceFilter = interval_distance ? interval_distance : kCLDistanceFilterNone;
}
static void apple_location_free(void *data)
{
applelocation_t *applelocation = (applelocation_t*)data;
/* TODO - free location manager? */
if (applelocation)
free(applelocation);
applelocation = NULL;
}
static bool apple_location_start(void *data)
{
(void)data;
[locationManager startUpdatingLocation];
return true;
}
static void apple_location_stop(void *data)
{
(void)data;
[locationManager stopUpdatingLocation];
}
static bool apple_location_get_position(void *data, double *lat, double *lon, double *horiz_accuracy,
double *vert_accuracy)
{
(void)data;
bool ret = [[CocoaView get] onLocationHasChanged];
if (!ret)
goto fail;
*lat = currentLatitude;
*lon = currentLongitude;
*horiz_accuracy = currentHorizontalAccuracy;
*vert_accuracy = currentVerticalAccuracy;
return true;
fail:
*lat = 0.0;
*lon = 0.0;
*horiz_accuracy = 0.0;
*vert_accuracy = 0.0;
return false;
}
location_driver_t location_corelocation = {
apple_location_init,
apple_location_free,
apple_location_start,
apple_location_stop,
apple_location_get_position,
apple_location_set_interval,
"corelocation",
};
#endif

View File

@ -24,10 +24,6 @@
#include "../../menu/menu_driver.h"
#endif
#ifdef HAVE_CORELOCATION
#include <CoreLocation/CoreLocation.h>
#endif
typedef enum apple_view_type {
APPLE_VIEW_TYPE_NONE,
APPLE_VIEW_TYPE_OPENGL_ES,
@ -71,10 +67,6 @@ extern id<ApplePlatform> apple_platform;
#if defined(HAVE_COCOATOUCH)
#include <UIKit/UIKit.h>
#ifdef HAVE_AVFOUNDATION
#import <AVFoundation/AVCaptureOutput.h>
#endif
/*********************************************/
/* RAMenuBase */
/* A menu class that displays RAMenuItemBase */
@ -129,9 +121,6 @@ void get_ios_version(int *major, int *minor);
#include <AppKit/AppKit.h>
@interface CocoaView : NSView
#ifdef HAVE_CORELOCATION
<CLLocationManagerDelegate>
#endif
+ (CocoaView*)get;
#if !defined(HAVE_COCOA_METAL)

View File

@ -25,21 +25,6 @@
#include "../../../verbosity.h"
/* Define compatibility symbols and categories. */
#ifdef HAVE_AVFOUNDATION
#include <AVFoundation/AVCaptureSession.h>
#include <AVFoundation/AVCaptureDevice.h>
#include <AVFoundation/AVCaptureOutput.h>
#include <AVFoundation/AVCaptureInput.h>
#include <AVFoundation/AVMediaFormat.h>
#ifdef HAVE_OPENGLES
#include <CoreVideo/CVOpenGLESTextureCache.h>
#else
#include <CoreVideo/CVOpenGLTexture.h>
#endif
#endif
#include "../../../location/location_driver.h"
#include "../../../camera/camera_driver.h"
@ -294,410 +279,4 @@ void *glkitview_init(void);
}
#endif
#ifdef HAVE_AVFOUNDATION
#include "../../gfx/common/gl_common.h"
#ifndef GL_BGRA
#define GL_BGRA 0x80E1
#endif
#ifdef HAVE_OPENGLES
#define RCVOpenGLTextureCacheCreateTextureFromImage CVOpenGLESTextureCacheCreateTextureFromImage
#define RCVOpenGLTextureGetName CVOpenGLESTextureGetName
#define RCVOpenGLTextureCacheFlush CVOpenGLESTextureCacheFlush
#define RCVOpenGLTextureCacheCreate CVOpenGLESTextureCacheCreate
#define RCVOpenGLTextureRef CVOpenGLESTextureRef
#define RCVOpenGLTextureCacheRef CVOpenGLESTextureCacheRef
#if COREVIDEO_USE_EAGLCONTEXT_CLASS_IN_API
#define RCVOpenGLGetCurrentContext() (CVEAGLContext)(g_context)
#else
#define RCVOpenGLGetCurrentContext() (__bridge void *)(g_context)
#endif
#else
#define RCVOpenGLTextureCacheCreateTextureFromImage CVOpenGLTextureCacheCreateTextureFromImage
#define RCVOpenGLTextureGetName CVOpenGLTextureGetName
#define RCVOpenGLTextureCacheFlush CVOpenGLTextureCacheFlush
#define RCVOpenGLTextureCacheCreate CVOpenGLTextureCacheCreate
#define RCVOpenGLTextureRef CVOpenGLTextureRef
#define RCVOpenGLTextureCacheRef CVOpenGLTextureCacheRef
#define RCVOpenGLGetCurrentContext() CGLGetCurrentContext(), CGLGetPixelFormat(CGLGetCurrentContext())
#endif
static AVCaptureSession *_session;
static NSString *_sessionPreset;
RCVOpenGLTextureCacheRef textureCache;
GLuint outputTexture;
static bool newFrame = false;
static void event_process_camera_frame(void *pbuf_ptr)
{
CVReturn ret;
RCVOpenGLTextureRef renderTexture;
CVPixelBufferRef pixelBuffer = (CVPixelBufferRef)pbuf_ptr;
size_t width = CVPixelBufferGetWidth(pixelBuffer);
size_t height = CVPixelBufferGetHeight(pixelBuffer);
CVPixelBufferLockBaseAddress(pixelBuffer, 0);
(void)width;
(void)height;
/*TODO - rewrite all this.
*
* create a texture from our render target.
* textureCache will be what you previously
* made with RCVOpenGLTextureCacheCreate.
*/
#ifdef HAVE_OPENGLES
ret = RCVOpenGLTextureCacheCreateTextureFromImage(kCFAllocatorDefault,
textureCache, pixelBuffer, NULL, GL_TEXTURE_2D,
GL_RGBA, (GLsizei)width, (GLsizei)height,
GL_BGRA, GL_UNSIGNED_BYTE, 0, &renderTexture);
#else
ret = RCVOpenGLTextureCacheCreateTextureFromImage(kCFAllocatorDefault,
textureCache, pixelBuffer, 0, &renderTexture);
#endif
if (!renderTexture || ret)
{
RARCH_ERR("[apple_camera]: RCVOpenGLTextureCacheCreateTextureFromImage failed.\n");
return;
}
outputTexture = RCVOpenGLTextureGetName(renderTexture);
gl_bind_texture(outputTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, GL_LINEAR);
CVPixelBufferUnlockBaseAddress(pixelBuffer, 0);
[[NSNotificationCenter defaultCenter] postNotificationName:@"NewCameraTextureReady" object:nil];
newFrame = true;
glBindTexture(GL_TEXTURE_2D, 0);
RCVOpenGLTextureCacheFlush(textureCache, 0);
CFRelease(renderTexture);
CFRelease(pixelBuffer);
pixelBuffer = 0;
}
- (void)captureOutput:(AVCaptureOutput *)captureOutput
didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
fromConnection:(AVCaptureConnection *)connection
{
/* TODO: Don't post if event queue is full */
CVPixelBufferRef pixelBuffer = (CVPixelBufferRef)CVPixelBufferRetain(CMSampleBufferGetImageBuffer(sampleBuffer));
event_process_camera_frame(pixelBuffer);
}
/* TODO - add void param to onCameraInit so we can pass g_context. */
- (void) onCameraInit
{
NSError *error;
AVCaptureVideoDataOutput * dataOutput;
AVCaptureDeviceInput *input;
AVCaptureDevice *videoDevice;
CVReturn ret = RCVOpenGLTextureCacheCreate(kCFAllocatorDefault, NULL,
RCVOpenGLGetCurrentContext(), NULL, &textureCache);
(void)ret;
/* Setup Capture Session. */
_session = [[AVCaptureSession alloc] init];
[_session beginConfiguration];
/* TODO: dehardcode this based on device capabilities */
_sessionPreset = AVCaptureSessionPreset640x480;
/* Set preset session size. */
[_session setSessionPreset:_sessionPreset];
/* Creata a video device and input from that Device. Add the input to the capture session. */
videoDevice = (AVCaptureDevice*)[AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
if (videoDevice == nil)
retro_assert(0);
/* Add the device to the session. */
input = (AVCaptureDeviceInput*)[AVCaptureDeviceInput deviceInputWithDevice:videoDevice error:&error];
if (error)
{
RARCH_ERR("video device input %s\n", error.localizedDescription.UTF8String);
retro_assert(0);
}
[_session addInput:input];
/* Create the output for the capture session. */
dataOutput = (AVCaptureVideoDataOutput*)[[AVCaptureVideoDataOutput alloc] init];
[dataOutput setAlwaysDiscardsLateVideoFrames:NO]; /* Probably want to set this to NO when recording. */
[dataOutput setVideoSettings:[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:kCVPixelFormatType_32BGRA] forKey:(id)kCVPixelBufferPixelFormatTypeKey]];
/* Set dispatch to be on the main thread so OpenGL can do things with the data. */
[dataOutput setSampleBufferDelegate:self queue:dispatch_get_main_queue()];
[_session addOutput:dataOutput];
[_session commitConfiguration];
}
- (void) onCameraStart
{
[_session startRunning];
}
- (void) onCameraStop
{
[_session stopRunning];
}
- (void) onCameraFree
{
RCVOpenGLTextureCacheFlush(textureCache, 0);
CFRelease(textureCache);
}
#endif
#ifdef HAVE_CORELOCATION
#include <CoreLocation/CoreLocation.h>
static CLLocationManager *locationManager;
static bool locationChanged;
static CLLocationDegrees currentLatitude;
static CLLocationDegrees currentLongitude;
static CLLocationAccuracy currentHorizontalAccuracy;
static CLLocationAccuracy currentVerticalAccuracy;
- (bool)onLocationHasChanged
{
bool hasChanged = locationChanged;
if (hasChanged)
locationChanged = false;
return hasChanged;
}
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
locationChanged = true;
currentLatitude = newLocation.coordinate.latitude;
currentLongitude = newLocation.coordinate.longitude;
currentHorizontalAccuracy = newLocation.horizontalAccuracy;
currentVerticalAccuracy = newLocation.verticalAccuracy;
RARCH_LOG("didUpdateToLocation - latitude %f, longitude %f\n", (float)currentLatitude, (float)currentLongitude);
}
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
CLLocation *location = (CLLocation*)[locations objectAtIndex:([locations count] - 1)];
locationChanged = true;
currentLatitude = [location coordinate].latitude;
currentLongitude = [location coordinate].longitude;
currentHorizontalAccuracy = location.horizontalAccuracy;
currentVerticalAccuracy = location.verticalAccuracy;
RARCH_LOG("didUpdateLocations - latitude %f, longitude %f\n", (float)currentLatitude, (float)currentLongitude);
}
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{
RARCH_LOG("didFailWithError - %s\n", [[error localizedDescription] UTF8String]);
}
- (void)locationManagerDidPauseLocationUpdates:(CLLocationManager *)manager
{
RARCH_LOG("didPauseLocationUpdates\n");
}
- (void)locationManagerDidResumeLocationUpdates:(CLLocationManager *)manager
{
RARCH_LOG("didResumeLocationUpdates\n");
}
- (void)onLocationInit
{
/* Create the location manager
* if this object does not already have one.
*/
if (locationManager == nil)
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
locationManager.distanceFilter = kCLDistanceFilterNone;
[locationManager startUpdatingLocation];
}
#endif
@end
#ifdef HAVE_AVFOUNDATION
typedef struct apple_camera
{
void *empty;
} applecamera_t;
static void *apple_camera_init(const char *device, uint64_t caps, unsigned width, unsigned height)
{
applecamera_t *applecamera;
if ((caps & (UINT64_C(1) << RETRO_CAMERA_BUFFER_OPENGL_TEXTURE)) == 0)
{
RARCH_ERR("applecamera returns OpenGL texture.\n");
return NULL;
}
applecamera = (applecamera_t*)calloc(1, sizeof(applecamera_t));
if (!applecamera)
return NULL;
[[CocoaView get] onCameraInit];
return applecamera;
}
static void apple_camera_free(void *data)
{
applecamera_t *applecamera = (applecamera_t*)data;
[[CocoaView get] onCameraFree];
if (applecamera)
free(applecamera);
applecamera = NULL;
}
static bool apple_camera_start(void *data)
{
(void)data;
[[CocoaView get] onCameraStart];
return true;
}
static void apple_camera_stop(void *data)
{
[[CocoaView get] onCameraStop];
}
static bool apple_camera_poll(void *data, retro_camera_frame_raw_framebuffer_t frame_raw_cb,
retro_camera_frame_opengl_texture_t frame_gl_cb)
{
(void)data;
(void)frame_raw_cb;
if (frame_gl_cb && newFrame)
{
/* FIXME: Identity for now.
* Use proper texture matrix as returned by iOS Camera (if at all?). */
static const float affine[] = {
1.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 1.0f
};
frame_gl_cb(outputTexture, GL_TEXTURE_2D, affine);
newFrame = false;
}
return true;
}
camera_driver_t camera_avfoundation = {
apple_camera_init,
apple_camera_free,
apple_camera_start,
apple_camera_stop,
apple_camera_poll,
"avfoundation",
};
#endif
#ifdef HAVE_CORELOCATION
typedef struct apple_location
{
void *empty;
} applelocation_t;
static void *apple_location_init(void)
{
applelocation_t *applelocation = (applelocation_t*)calloc(1, sizeof(applelocation_t));
if (!applelocation)
return NULL;
[[CocoaView get] onLocationInit];
return applelocation;
}
static void apple_location_set_interval(void *data, unsigned interval_update_ms, unsigned interval_distance)
{
(void)data;
locationManager.distanceFilter = interval_distance ? interval_distance : kCLDistanceFilterNone;
}
static void apple_location_free(void *data)
{
applelocation_t *applelocation = (applelocation_t*)data;
/* TODO - free location manager? */
if (applelocation)
free(applelocation);
applelocation = NULL;
}
static bool apple_location_start(void *data)
{
(void)data;
[locationManager startUpdatingLocation];
return true;
}
static void apple_location_stop(void *data)
{
(void)data;
[locationManager stopUpdatingLocation];
}
static bool apple_location_get_position(void *data, double *lat, double *lon, double *horiz_accuracy,
double *vert_accuracy)
{
(void)data;
bool ret = [[CocoaView get] onLocationHasChanged];
if (!ret)
goto fail;
*lat = currentLatitude;
*lon = currentLongitude;
*horiz_accuracy = currentHorizontalAccuracy;
*vert_accuracy = currentVerticalAccuracy;
return true;
fail:
*lat = 0.0;
*lon = 0.0;
*horiz_accuracy = 0.0;
*vert_accuracy = 0.0;
return false;
}
location_driver_t location_corelocation = {
apple_location_init,
apple_location_free,
apple_location_start,
apple_location_stop,
apple_location_get_position,
apple_location_set_interval,
"corelocation",
};
#endif

View File

@ -32,9 +32,6 @@
#include "../../input/drivers/cocoa_input.h"
#include "../../input/drivers_keyboard/keyboard_event_apple.h"
#include "../../retroarch.h"
#ifdef HAVE_AVFOUNDATION
#import <AVFoundation/AVFoundation.h>
#endif
#ifdef HAVE_MENU
#include "../../menu/menu_setting.h"
@ -50,9 +47,6 @@ static void apple_rarch_exited(void);
static void rarch_enable_ui(void)
{
bool boolean = true;
#ifdef HAVE_AVFOUNDATION
[[RetroArch_iOS get] supportOtherAudioSessions];
#endif
ui_companion_set_foreground(true);
@ -70,9 +64,6 @@ static void rarch_disable_ui(void)
rarch_ctl(RARCH_CTL_SET_PAUSED, &boolean);
rarch_ctl(RARCH_CTL_SET_IDLE, &boolean);
rarch_menu_running_finished();
#ifdef HAVE_AVFOUNDATION
[[RetroArch_iOS get] supportOtherAudioSessions];
#endif
}
static void ui_companion_cocoatouch_event_command(
@ -329,10 +320,6 @@ enum
+ (RetroArch_iOS*)get
{
#ifdef HAVE_AVFOUNDATION
/* Implicitly initializes your audio session. */
[(RetroArch_iOS*)[[UIApplication sharedApplication] delegate] supportOtherAudioSessions];
#endif
return (RetroArch_iOS*)[[UIApplication sharedApplication] delegate];
}
@ -358,11 +345,6 @@ enum
[self setDelegate:self];
#ifdef HAVE_AVFOUNDATION
/* Other background audio check */
[self supportOtherAudioSessions];
#endif
/* Setup window */
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[self.window makeKeyAndVisible];
@ -376,10 +358,6 @@ enum
[self refreshSystemConfig];
[self showGameView];
#ifdef HAVE_AVFOUNDATION
[self supportOtherAudioSessions];
#endif
if (rarch_main(argc, argv, NULL))
apple_rarch_exited();
@ -396,9 +374,6 @@ enum
- (void)applicationDidEnterBackground:(UIApplication *)application
{
#ifdef HAVE_AVFOUNDATION
[self supportOtherAudioSessions];
#endif
}
- (void)applicationWillTerminate:(UIApplication *)application
@ -412,9 +387,6 @@ enum
{
settings_t *settings = config_get_ptr();
#ifdef HAVE_AVFOUNDATION
[self supportOtherAudioSessions];
#endif
if (settings->bools.ui_companion_start_on_boot)
return;
@ -423,9 +395,6 @@ enum
- (void)applicationWillResignActive:(UIApplication *)application
{
#ifdef HAVE_AVFOUNDATION
[self supportOtherAudioSessions];
#endif
dispatch_async(dispatch_get_main_queue(),
^{
ui_companion_cocoatouch_event_command(NULL, CMD_EVENT_MENU_SAVE_CURRENT_CONFIG);
@ -456,11 +425,6 @@ enum
- (void)showGameView
{
#ifdef HAVE_AVFOUNDATION
/* implicitly initializes your audio session */
[self supportOtherAudioSessions];
#endif
[self popToRootViewControllerAnimated:NO];
#if TARGET_OS_IOS
@ -477,9 +441,6 @@ enum
- (IBAction)showPauseMenu:(id)sender
{
#ifndef HAVE_AVFOUNDATION
ui_companion_cocoatouch_event_command(NULL, CMD_EVENT_AUDIO_STOP);
#endif
rarch_enable_ui();
#if TARGET_OS_IOS
@ -500,9 +461,6 @@ enum
{
[self showPauseMenu:self];
}
#ifdef HAVE_AVFOUNDATION
[self supportOtherAudioSessions];
#endif
}
- (void)refreshSystemConfig
@ -554,12 +512,6 @@ enum
- (void)supportOtherAudioSessions
{
#ifdef HAVE_AVFOUNDATION
/* implicitly initializes your audio session */
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
[audioSession setCategory: AVAudioSessionCategoryAmbient error: nil];
[audioSession setActive:YES error:nil];
#endif
}
- (void)mainMenuRenderMessageBox:(NSString *)msg
@ -596,9 +548,6 @@ static void apple_rarch_exited(void)
if (!ap)
return;
#ifdef HAVE_AVFOUNDATION
[ap supportOtherAudioSessions];
#endif
[ap showPauseMenu:ap];
}

View File

@ -32,9 +32,6 @@
#include "../../input/drivers/cocoa_input.h"
#include "../../input/drivers_keyboard/keyboard_event_apple.h"
#include "../../retroarch.h"
#ifdef HAVE_AVFOUNDATION
#import <AVFoundation/AVFoundation.h>
#endif
#ifdef HAVE_MENU
#include "../../menu/menu_setting.h"
@ -50,9 +47,6 @@ static void apple_rarch_exited(void);
static void rarch_enable_ui(void)
{
bool boolean = true;
#ifdef HAVE_AVFOUNDATION
[[RetroArch_iOS get] supportOtherAudioSessions];
#endif
ui_companion_set_foreground(true);
@ -70,9 +64,6 @@ static void rarch_disable_ui(void)
rarch_ctl(RARCH_CTL_SET_PAUSED, &boolean);
rarch_ctl(RARCH_CTL_SET_IDLE, &boolean);
rarch_menu_running_finished();
#ifdef HAVE_AVFOUNDATION
[[RetroArch_iOS get] supportOtherAudioSessions];
#endif
}
static void ui_companion_cocoatouch_event_command(
@ -329,10 +320,6 @@ enum
+ (RetroArch_iOS*)get
{
#ifdef HAVE_AVFOUNDATION
/* Implicitly initializes your audio session. */
[(RetroArch_iOS*)[[UIApplication sharedApplication] delegate] supportOtherAudioSessions];
#endif
return (RetroArch_iOS*)[[UIApplication sharedApplication] delegate];
}
@ -353,11 +340,6 @@ enum
[self setDelegate:self];
#ifdef HAVE_AVFOUNDATION
/* Other background audio check */
[self supportOtherAudioSessions];
#endif
/* Setup window */
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[self.window makeKeyAndVisible];
@ -369,10 +351,6 @@ enum
[self refreshSystemConfig];
[self showGameView];
#ifdef HAVE_AVFOUNDATION
[self supportOtherAudioSessions];
#endif
if (rarch_main(argc, argv, NULL))
apple_rarch_exited();
@ -389,9 +367,6 @@ enum
- (void)applicationDidEnterBackground:(UIApplication *)application
{
#ifdef HAVE_AVFOUNDATION
[self supportOtherAudioSessions];
#endif
}
- (void)applicationWillTerminate:(UIApplication *)application
@ -405,9 +380,6 @@ enum
{
settings_t *settings = config_get_ptr();
#ifdef HAVE_AVFOUNDATION
[self supportOtherAudioSessions];
#endif
if (settings->bools.ui_companion_start_on_boot)
return;
@ -416,9 +388,6 @@ enum
- (void)applicationWillResignActive:(UIApplication *)application
{
#ifdef HAVE_AVFOUNDATION
[self supportOtherAudioSessions];
#endif
dispatch_async(dispatch_get_main_queue(),
^{
ui_companion_cocoatouch_event_command(NULL, CMD_EVENT_MENU_SAVE_CURRENT_CONFIG);
@ -447,10 +416,6 @@ enum
- (void)showGameView
{
#ifdef HAVE_AVFOUNDATION
/* implicitly initializes your audio session */
[self supportOtherAudioSessions];
#endif
[self popToRootViewControllerAnimated:NO];
[self setToolbarHidden:true animated:NO];
[[UIApplication sharedApplication] setStatusBarHidden:true withAnimation:UIStatusBarAnimationNone];
@ -463,9 +428,6 @@ enum
- (IBAction)showPauseMenu:(id)sender
{
#ifndef HAVE_AVFOUNDATION
ui_companion_cocoatouch_event_command(NULL, CMD_EVENT_AUDIO_STOP);
#endif
rarch_enable_ui();
[[UIApplication sharedApplication] setStatusBarHidden:false withAnimation:UIStatusBarAnimationNone];
@ -483,9 +445,6 @@ enum
{
[self showPauseMenu:self];
}
#ifdef HAVE_AVFOUNDATION
[self supportOtherAudioSessions];
#endif
}
- (void)refreshSystemConfig
@ -531,12 +490,6 @@ enum
- (void)supportOtherAudioSessions
{
#ifdef HAVE_AVFOUNDATION
/* implicitly initializes your audio session */
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
[audioSession setCategory: AVAudioSessionCategoryAmbient error: nil];
[audioSession setActive:YES error:nil];
#endif
}
- (void)mainMenuRenderMessageBox:(NSString *)msg
@ -571,9 +524,6 @@ static void apple_rarch_exited(void)
if (!ap)
return;
#ifdef HAVE_AVFOUNDATION
[ap supportOtherAudioSessions];
#endif
[ap showPauseMenu:ap];
}