mirror of
https://github.com/libretro/RetroArch
synced 2025-03-03 04:14:00 +00:00
(Apple) Move some C common code from ObjC file to platform_apple.c
This commit is contained in:
parent
6b0f9d3698
commit
5033a39a1d
@ -31,8 +31,6 @@ bool apple_is_running;
|
||||
bool apple_use_tv_mode;
|
||||
NSString* apple_core;
|
||||
|
||||
static CFRunLoopObserverRef iterate_observer;
|
||||
|
||||
static void apple_rarch_exited(void)
|
||||
{
|
||||
NSString* used_core = (NSString*)apple_core;
|
||||
@ -52,41 +50,6 @@ static void apple_rarch_exited(void)
|
||||
apple_run_core(nil, 0);
|
||||
}
|
||||
|
||||
static void do_iteration(void)
|
||||
{
|
||||
bool iterate = iterate_observer && apple_is_running && !g_extern.is_paused;
|
||||
|
||||
if (!iterate)
|
||||
return;
|
||||
|
||||
if (main_entry_iterate(0, NULL, NULL))
|
||||
{
|
||||
main_exit(NULL);
|
||||
apple_rarch_exited();
|
||||
}
|
||||
else
|
||||
CFRunLoopWakeUp(CFRunLoopGetMain());
|
||||
}
|
||||
|
||||
void apple_start_iteration(void)
|
||||
{
|
||||
if (iterate_observer)
|
||||
return;
|
||||
|
||||
iterate_observer = CFRunLoopObserverCreate(0, kCFRunLoopBeforeWaiting, true, 0, (CFRunLoopObserverCallBack)do_iteration, 0);
|
||||
CFRunLoopAddObserver(CFRunLoopGetMain(), iterate_observer, kCFRunLoopCommonModes);
|
||||
}
|
||||
|
||||
void apple_stop_iteration(void)
|
||||
{
|
||||
if (!iterate_observer)
|
||||
return;
|
||||
|
||||
CFRunLoopObserverInvalidate(iterate_observer);
|
||||
CFRelease(iterate_observer);
|
||||
iterate_observer = 0;
|
||||
}
|
||||
|
||||
void apple_run_core(NSString* core, const char* file)
|
||||
{
|
||||
if (apple_is_running)
|
||||
|
@ -26,8 +26,45 @@
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
static CFRunLoopObserverRef iterate_observer;
|
||||
|
||||
extern bool apple_is_running;
|
||||
|
||||
static void do_iteration(void)
|
||||
{
|
||||
bool iterate = iterate_observer && apple_is_running && !g_extern.is_paused;
|
||||
|
||||
if (!iterate)
|
||||
return;
|
||||
|
||||
if (main_entry_iterate(0, NULL, NULL))
|
||||
{
|
||||
main_exit(NULL);
|
||||
apple_rarch_exited();
|
||||
}
|
||||
else
|
||||
CFRunLoopWakeUp(CFRunLoopGetMain());
|
||||
}
|
||||
|
||||
void apple_start_iteration(void)
|
||||
{
|
||||
if (iterate_observer)
|
||||
return;
|
||||
|
||||
iterate_observer = CFRunLoopObserverCreate(0, kCFRunLoopBeforeWaiting, true, 0, (CFRunLoopObserverCallBack)do_iteration, 0);
|
||||
CFRunLoopAddObserver(CFRunLoopGetMain(), iterate_observer, kCFRunLoopCommonModes);
|
||||
}
|
||||
|
||||
void apple_stop_iteration(void)
|
||||
{
|
||||
if (!iterate_observer)
|
||||
return;
|
||||
|
||||
CFRunLoopObserverInvalidate(iterate_observer);
|
||||
CFRelease(iterate_observer);
|
||||
iterate_observer = 0;
|
||||
}
|
||||
|
||||
void apple_event_basic_command(enum basic_event_t action)
|
||||
{
|
||||
switch (action)
|
||||
|
Loading…
x
Reference in New Issue
Block a user