RetroArch/frontend/platform/platform_apple.c

84 lines
2.5 KiB
C
Raw Normal View History

2013-07-27 17:40:21 +02:00
/* RetroArch - A frontend for libretro.
2014-01-01 01:50:59 +01:00
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2014 - Daniel De Matteis
* Copyright (C) 2012-2014 - Jason Fetters
2013-07-27 17:40:21 +02:00
*
* 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.
2013-07-27 17:40:21 +02:00
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "../menu/menu_common.h"
#include "../../settings_data.h"
2013-07-28 23:01:16 +02:00
2014-05-03 07:17:59 +02:00
#include "../frontend.h"
2013-07-27 17:40:21 +02:00
#include <stdint.h>
#include "../../boolean.h"
#include <stddef.h>
#include <string.h>
static CFRunLoopObserverRef iterate_observer;
static void do_iteration(void)
{
2014-07-24 05:00:30 +02:00
if (!(g_extern.main_is_init && !g_extern.is_paused))
2014-05-12 16:37:02 +02:00
return;
2014-09-05 16:38:58 +02:00
if (!frontend_loop || (frontend_loop && frontend_loop(0, NULL, NULL)))
2014-05-12 16:37:02 +02:00
{
main_exit(NULL);
return;
}
CFRunLoopWakeUp(CFRunLoopGetMain());
}
void apple_start_iteration(void)
{
2014-09-02 17:42:44 +02:00
iterate_observer = CFRunLoopObserverCreate(0, kCFRunLoopBeforeWaiting,
true, 0, (CFRunLoopObserverCallBack)do_iteration, 0);
CFRunLoopAddObserver(CFRunLoopGetMain(), iterate_observer,
kCFRunLoopCommonModes);
}
void apple_stop_iteration(void)
{
CFRunLoopObserverInvalidate(iterate_observer);
CFRelease(iterate_observer);
iterate_observer = 0;
}
extern void apple_rarch_exited(void);
static void frontend_apple_shutdown(bool unused)
{
apple_rarch_exited();
}
static int frontend_apple_get_rating(void)
{
/* TODO/FIXME - look at unique identifier per device and
* determine rating for some */
return -1;
}
2013-07-27 17:40:21 +02:00
const frontend_ctx_driver_t frontend_ctx_apple = {
NULL, /* environment_get */
2013-07-27 17:40:21 +02:00
NULL, /* init */
NULL, /* deinit */
NULL, /* exitspawn */
NULL, /* process_args */
NULL, /* process_events */
2013-07-27 17:40:21 +02:00
NULL, /* exec */
frontend_apple_shutdown, /* shutdown */
NULL, /* get_name */
frontend_apple_get_rating, /* get_rating */
2013-07-27 17:40:21 +02:00
"apple",
};