rarch_render_cached_frame - do early return if g_runloop.is_idle

is true - reduces CPU activity in iOS Cocoa menu substantially
(from 96% CPU to 16%)
This commit is contained in:
Twinaphex 2015-03-08 01:58:19 +01:00
parent 5b3ab881ba
commit 9027b35eb8
2 changed files with 20 additions and 10 deletions

View File

@ -226,18 +226,23 @@ enum
return (RetroArch_iOS*)[[UIApplication sharedApplication] delegate];
}
void switch_to_ios(void) {
if ( apple_platform != NULL ) {
RetroArch_iOS *ap = (RetroArch_iOS *)apple_platform;
[ap showPauseMenu:ap];
}
void switch_to_ios(void)
{
if (!apple_platform)
return;
RetroArch_iOS *ap = (RetroArch_iOS *)apple_platform;
g_runloop.is_idle = true;
[ap showPauseMenu:ap];
}
void notify_content_loaded(void) {
if ( apple_platform != NULL ) {
RetroArch_iOS *ap = (RetroArch_iOS *)apple_platform;
[ap showGameView];
}
void notify_content_loaded(void)
{
if (!apple_platform)
return;
RetroArch_iOS *ap = (RetroArch_iOS *)apple_platform;
[ap showGameView];
}
- (void)applicationDidFinishLaunching:(UIApplication *)application
@ -334,11 +339,13 @@ void notify_content_loaded(void) {
[[UIApplication sharedApplication] setIdleTimerDisabled:true];
[self.window setRootViewController:[RAGameView get]];
g_runloop.is_paused = false;
g_runloop.is_idle = false;
}
- (IBAction)showPauseMenu:(id)sender
{
g_runloop.is_paused = true;
g_runloop.is_idle = true;
[[UIApplication sharedApplication] setStatusBarHidden:false withAnimation:UIStatusBarAnimationNone];
[[UIApplication sharedApplication] setIdleTimerDisabled:false];
[self.window setRootViewController:self];

View File

@ -78,6 +78,9 @@ void rarch_render_cached_frame(void)
{
void *recording = driver.recording_data;
if (g_runloop.is_idle)
return;
/* Cannot allow recording when pushing duped frames. */
driver.recording_data = NULL;