(Apple) Refactor do_iteration

This commit is contained in:
Twinaphex 2015-03-07 17:27:17 +01:00
parent e86efd320c
commit 1a62614c78

View File

@ -30,6 +30,14 @@
//#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_stop_iteration(void);
@ -48,43 +56,25 @@ static int do_ra_iteration(void)
static void do_iteration(CFRunLoopObserverRef observer, CFRunLoopActivity activity,
void *info)
{
#ifdef DEBUG_RUNLOOP
if (activity & kCFRunLoopEntry)
switch (activity)
{
RARCH_LOG("RUNLOOP ENTRY, frame: %d.\n", g_runloop.frames.video.count);
}
if (activity & kCFRunLoopBeforeTimers)
case kCFRunLoopEntry:
CF_LOG("RUNLOOP ENTRY, frame: %d.\n", g_runloop.frames.video.count);
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);
}
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
CF_LOG("RUNLOOP BEFORE WAITING, frame: %d.\n", g_runloop.frames.video.count);
int ret = do_ra_iteration();
if (ret == -1)
return;
CFRunLoopWakeUp(CFRunLoopGetMain());
}
CFRunLoopWakeUp(CFRunLoopGetMain());
/* TODO/FIXME
I am almost positive that this is not necessary and is actually a
@ -144,6 +134,18 @@ static void do_iteration(CFRunLoopObserverRef observer, CFRunLoopActivity activi
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)
{