mirror of
https://github.com/libretro/RetroArch
synced 2025-04-17 11:43:00 +00:00
(iOS) Implement UI companion driver for iOS CocoaTouch
This commit is contained in:
parent
bf084eb14a
commit
3e35593f59
@ -28,8 +28,6 @@
|
||||
#import "views.h"
|
||||
#include "../../input/drivers_hid/btstack_hid.h"
|
||||
|
||||
#include "../../menu/drivers/ios.h"
|
||||
|
||||
id<RetroArch_Platform> apple_platform;
|
||||
static CFRunLoopObserverRef iterate_observer;
|
||||
|
||||
@ -261,31 +259,8 @@ enum
|
||||
return (RetroArch_iOS*)[[UIApplication sharedApplication] delegate];
|
||||
}
|
||||
|
||||
void switch_to_ios(void)
|
||||
{
|
||||
RetroArch_iOS *ap;
|
||||
runloop_t *runloop = rarch_main_get_ptr();
|
||||
|
||||
if (!apple_platform)
|
||||
return;
|
||||
|
||||
ap = (RetroArch_iOS *)apple_platform;
|
||||
runloop->is_idle = true;
|
||||
[ap showPauseMenu:ap];
|
||||
}
|
||||
|
||||
void notify_content_loaded(void)
|
||||
{
|
||||
if (!apple_platform)
|
||||
return;
|
||||
|
||||
RetroArch_iOS *ap = (RetroArch_iOS *)apple_platform;
|
||||
[ap showGameView];
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(UIApplication *)application
|
||||
{
|
||||
driver_t *driver = NULL;
|
||||
apple_platform = self;
|
||||
|
||||
[self setDelegate:self];
|
||||
@ -304,15 +279,6 @@ void notify_content_loaded(void)
|
||||
if (rarch_main(0, NULL))
|
||||
apple_rarch_exited();
|
||||
|
||||
driver = driver_get_ptr();
|
||||
|
||||
if ( driver->menu_ctx && driver->menu_ctx == &menu_ctx_ios && driver->menu && driver->menu->userdata )
|
||||
{
|
||||
ios_handle_t *ih = (ios_handle_t*)driver->menu->userdata;
|
||||
ih->switch_to_ios = switch_to_ios;
|
||||
ih->notify_content_loaded = notify_content_loaded;
|
||||
}
|
||||
|
||||
#ifdef HAVE_MFI
|
||||
apple_gamecontroller_init();
|
||||
#endif
|
||||
|
@ -126,7 +126,6 @@ enum
|
||||
MENU_RMENU_XUI,
|
||||
MENU_GLUI,
|
||||
MENU_XMB,
|
||||
MENU_IOS,
|
||||
};
|
||||
|
||||
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) || defined(__CELLOS_LV2__)
|
||||
@ -305,9 +304,7 @@ enum
|
||||
#define OSK_DEFAULT_DRIVER OSK_NULL
|
||||
#endif
|
||||
|
||||
#if defined(IOS)
|
||||
#define MENU_DEFAULT_DRIVER MENU_IOS
|
||||
#elif defined(HAVE_RMENU)
|
||||
#if defined(HAVE_RMENU)
|
||||
#define MENU_DEFAULT_DRIVER MENU_RMENU
|
||||
#elif defined(HAVE_RMENU_XUI)
|
||||
#define MENU_DEFAULT_DRIVER MENU_RMENU_XUI
|
||||
|
@ -319,8 +319,6 @@ const char *config_get_default_menu(void)
|
||||
return "rmenu_xui";
|
||||
case MENU_GLUI:
|
||||
return "glui";
|
||||
case MENU_IOS:
|
||||
return "ios";
|
||||
case MENU_XMB:
|
||||
return "xmb";
|
||||
default:
|
||||
|
@ -18,9 +18,7 @@
|
||||
#include "../../apple/common/CFExtensions.h"
|
||||
|
||||
#include "../frontend_driver.h"
|
||||
#ifdef IOS
|
||||
#include "../../menu/drivers/ios.h"
|
||||
#endif
|
||||
#include "../ui/ui_companion_driver.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <boolean.h>
|
||||
@ -205,22 +203,11 @@ extern void apple_rarch_exited(void);
|
||||
|
||||
static void frontend_apple_load_content(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver->menu_ctx)
|
||||
return;
|
||||
if (!driver->menu)
|
||||
return;
|
||||
if (!driver->menu->userdata)
|
||||
return;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const ui_companion_driver_t *ui = ui_companion_get_ptr();
|
||||
|
||||
#ifdef IOS
|
||||
if (driver->menu_ctx == &menu_ctx_ios)
|
||||
{
|
||||
ios_handle_t *ih = (ios_handle_t*)driver->menu->userdata;
|
||||
if (ih)
|
||||
ih->notify_content_loaded();
|
||||
}
|
||||
#endif
|
||||
if (ui)
|
||||
ui->notify_content_loaded(driver->ui_companion_data);
|
||||
}
|
||||
|
||||
static void frontend_apple_shutdown(bool unused)
|
||||
|
@ -751,10 +751,6 @@ MENU
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef IOS
|
||||
#include "../menu/drivers/ios.c"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_COMMAND
|
||||
#include "../command.c"
|
||||
#endif
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "../apple/iOS/platform.m"
|
||||
#include "../apple/iOS/menu.m"
|
||||
#include "../apple/iOS/browser.m"
|
||||
//#include "../ui/drivers/ui_cocoatouch.m"
|
||||
#include "../ui/drivers/ui_cocoatouch.m"
|
||||
#else
|
||||
#include "../apple/OSX/platform.m"
|
||||
#include "../apple/OSX/settings.m"
|
||||
|
@ -1,101 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2014-2015 - Jay McCarthy
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "../menu_driver.h"
|
||||
#include "../menu.h"
|
||||
#include "../../general.h"
|
||||
#include "ios.h"
|
||||
#include "../menu_input.h"
|
||||
|
||||
static int ios_entry_iterate(unsigned action)
|
||||
{
|
||||
ios_handle_t *ios = NULL;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
|
||||
if (!menu)
|
||||
return -1;
|
||||
|
||||
ios = (ios_handle_t*)menu->userdata;
|
||||
|
||||
if (ios && ios->switch_to_ios)
|
||||
ios->switch_to_ios();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void *ios_init(void)
|
||||
{
|
||||
menu_handle_t *menu = (menu_handle_t*)calloc(1, sizeof(*menu));
|
||||
if (!menu)
|
||||
goto error;
|
||||
|
||||
menu->userdata = (ios_handle_t*)calloc(1, sizeof(ios_handle_t));
|
||||
if (!menu->userdata)
|
||||
goto error;
|
||||
|
||||
return menu;
|
||||
error:
|
||||
if (menu->userdata)
|
||||
free(menu->userdata);
|
||||
if (menu)
|
||||
free(menu);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void ios_free(void *data)
|
||||
{
|
||||
menu_handle_t *menu = (menu_handle_t*)data;
|
||||
if (!menu)
|
||||
return;
|
||||
|
||||
if (menu->userdata)
|
||||
free(menu->userdata);
|
||||
|
||||
free(menu);
|
||||
}
|
||||
|
||||
menu_ctx_driver_t menu_ctx_ios = {
|
||||
NULL, // set_texture
|
||||
NULL, // render_messagebox
|
||||
NULL, // render
|
||||
NULL, // frame
|
||||
ios_init, // init
|
||||
ios_free, // free
|
||||
NULL, // context_reset
|
||||
NULL, // context_destroy
|
||||
NULL, // populate_entries
|
||||
NULL, // toggle
|
||||
NULL, // navigation_clear
|
||||
NULL, // navigation_decrement
|
||||
NULL, // navigation_increment
|
||||
NULL, // navigation_set
|
||||
NULL, // navigation_set_last
|
||||
NULL, // navigation_descend_alphabet
|
||||
NULL, // navigation_ascend_alphabet
|
||||
NULL, // list_insert
|
||||
NULL, // list_delete
|
||||
NULL, // list_clear
|
||||
NULL, // list_cache
|
||||
NULL, // list_set_selection
|
||||
ios_entry_iterate,
|
||||
NULL,
|
||||
"ios",
|
||||
};
|
@ -1,25 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2014-2015 - Jay McCarthy
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _MENU_DISP_IOS_H
|
||||
#define _MENU_DISP_IOS_H
|
||||
|
||||
typedef struct ios_handle
|
||||
{
|
||||
void (*switch_to_ios)(void);
|
||||
void (*notify_content_loaded)(void);
|
||||
} ios_handle_t;
|
||||
|
||||
#endif
|
@ -23,9 +23,6 @@
|
||||
#include "../general.h"
|
||||
|
||||
static const menu_ctx_driver_t *menu_ctx_drivers[] = {
|
||||
#ifdef IOS
|
||||
&menu_ctx_ios,
|
||||
#endif
|
||||
#if defined(HAVE_RMENU)
|
||||
&menu_ctx_rmenu,
|
||||
#endif
|
||||
|
@ -263,7 +263,6 @@ extern menu_ctx_driver_t menu_ctx_rmenu_xui;
|
||||
extern menu_ctx_driver_t menu_ctx_rgui;
|
||||
extern menu_ctx_driver_t menu_ctx_glui;
|
||||
extern menu_ctx_driver_t menu_ctx_xmb;
|
||||
extern menu_ctx_driver_t menu_ctx_ios;
|
||||
extern menu_ctx_driver_t menu_ctx_null;
|
||||
|
||||
/**
|
||||
|
@ -50,7 +50,7 @@ void notify_content_loaded(void)
|
||||
[ap showGameView];
|
||||
}
|
||||
|
||||
static int ui_companion_cocoatouch_entry_iterate(void *data, unsigned action)
|
||||
static int ui_companion_cocoatouch_iterate(void *data, unsigned action)
|
||||
{
|
||||
(void)data;
|
||||
|
||||
|
@ -22,6 +22,9 @@
|
||||
#endif
|
||||
|
||||
static const ui_companion_driver_t *ui_companion_drivers[] = {
|
||||
#ifdef IOS
|
||||
&ui_companion_cocoatouch,
|
||||
#endif
|
||||
&ui_companion_null,
|
||||
NULL
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user