(Apple) Refactor do_iteration

This commit is contained in:
Twinaphex 2015-03-07 17:27:17 +01:00
parent e86efd320c
commit 1a62614c78
1 changed files with 95 additions and 93 deletions

View File

@ -30,6 +30,14 @@
//#define DEBUG_RUNLOOP //#define DEBUG_RUNLOOP
#ifdef DEBUG_RUNLOOP
#include "../../retroarch_logger.h"
#define CF_LOG(...) RARCH_LOG(__VA_ARGS__)
#else
#define CF_LOG(...)
#endif
void apple_start_iteration(void); void apple_start_iteration(void);
void apple_stop_iteration(void); void apple_stop_iteration(void);
@ -48,43 +56,25 @@ static int do_ra_iteration(void)
static void do_iteration(CFRunLoopObserverRef observer, CFRunLoopActivity activity, static void do_iteration(CFRunLoopObserverRef observer, CFRunLoopActivity activity,
void *info) void *info)
{ {
#ifdef DEBUG_RUNLOOP switch (activity)
if (activity & kCFRunLoopEntry)
{ {
RARCH_LOG("RUNLOOP ENTRY, frame: %d.\n", g_runloop.frames.video.count); case kCFRunLoopEntry:
} CF_LOG("RUNLOOP ENTRY, frame: %d.\n", g_runloop.frames.video.count);
if (activity & kCFRunLoopBeforeTimers) break;
case kCFRunLoopBeforeTimers:
CF_LOG("RUNLOOP BEFORE TIMERS, frame: %d.\n", g_runloop.frames.video.count);
break;
case kCFRunLoopAfterWaiting:
CF_LOG("RUNLOOP AFTER WAITING, frame: %d.\n", g_runloop.frames.video.count);
break;
case kCFRunLoopBeforeWaiting:
{ {
RARCH_LOG("RUNLOOP BEFORE TIMERS, frame: %d.\n", g_runloop.frames.video.count); CF_LOG("RUNLOOP BEFORE WAITING, frame: %d.\n", g_runloop.frames.video.count);
}
if (activity & kCFRunLoopAfterWaiting)
{
RARCH_LOG("RUNLOOP AFTER WAITING, frame: %d.\n", g_runloop.frames.video.count);
}
if (activity & kCFRunLoopBeforeSources)
{
RARCH_LOG("RUNLOOP BEFORE SOURCES, frame: %d\n.", g_runloop.frames.video.count);
}
if (activity & kCFRunLoopExit)
{
RARCH_LOG("RUNLOOP EXIT, frame: %d.\n", g_runloop.frames.video.count);
}
if (activity & kCFRunLoopAllActivities)
{
RARCH_LOG("RUNLOOP ALL ACTIVITIES, frame: %d.\n", g_runloop.frames.video.count);
}
if (activity & kCFRunLoopBeforeWaiting)
#endif
{
#ifdef DEBUG_RUNLOOP
RARCH_LOG("RUNLOOP BEFORE WAITING, frame: %d.\n", g_runloop.frames.video.count);
#endif
int ret = do_ra_iteration(); int ret = do_ra_iteration();
if (ret == -1) if (ret == -1)
return; return;
CFRunLoopWakeUp(CFRunLoopGetMain());
}
CFRunLoopWakeUp(CFRunLoopGetMain());
/* TODO/FIXME /* TODO/FIXME
I am almost positive that this is not necessary and is actually a I am almost positive that this is not necessary and is actually a
@ -143,6 +133,18 @@ static void do_iteration(CFRunLoopObserverRef observer, CFRunLoopActivity activi
"ugly way" first because it is the most expedient and "ugly way" first because it is the most expedient and
safe. Other eyeballs should decide if it isn't necessary. safe. Other eyeballs should decide if it isn't necessary.
*/ */
}
break;
case kCFRunLoopBeforeSources:
CF_LOG("RUNLOOP BEFORE SOURCES, frame: %d\n.", g_runloop.frames.video.count);
break;
case kCFRunLoopExit:
CF_LOG("RUNLOOP EXIT, frame: %d.\n", g_runloop.frames.video.count);
break;
case kCFRunLoopAllActivities:
CF_LOG("RUNLOOP ALL ACTIVITIES, frame: %d.\n", g_runloop.frames.video.count);
break;
}
} }
void apple_start_iteration(void) void apple_start_iteration(void)