(Android) Refactor RetroArch Android pause mode.

This commit is contained in:
twinaphex 2012-12-05 07:12:20 +01:00
parent aab0ed8fce
commit fa2b716d5e

View File

@ -270,6 +270,8 @@ static bool android_run_events(struct android_app* android_app)
// Read all pending events. // Read all pending events.
int id; int id;
RARCH_LOG("RetroArch Android paused.\n");
// Block forever waiting for events. // Block forever waiting for events.
while ((id = ALooper_pollOnce(g_android.activity_paused ? -1 : 100, NULL, 0, NULL)) >= 0) while ((id = ALooper_pollOnce(g_android.activity_paused ? -1 : 100, NULL, 0, NULL)) >= 0)
{ {
@ -293,6 +295,8 @@ static bool android_run_events(struct android_app* android_app)
if (android_app->destroyRequested != 0) if (android_app->destroyRequested != 0)
return false; return false;
} }
RARCH_LOG("RetroArch Android unpaused.\n");
return true; return true;
} }
@ -374,9 +378,7 @@ static void* android_app_entry(void* param)
while(!(g_android.input_state & (1ULL << RARCH_WINDOW_READY))) while(!(g_android.input_state & (1ULL << RARCH_WINDOW_READY)))
{ {
if(!android_run_events(android_app)) if(!android_run_events(android_app))
{
goto exit; goto exit;
}
} }
int init_ret; int init_ret;
@ -405,11 +407,9 @@ static void* android_app_entry(void* param)
g_android.last_orient = AConfiguration_getOrientation(android_app->config); g_android.last_orient = AConfiguration_getOrientation(android_app->config);
while (rarch_main_iterate()) while (rarch_main_iterate())
{ {
while(g_android.activity_paused) if(g_android.activity_paused)
{
if(!android_run_events(android_app)) if(!android_run_events(android_app))
goto exit; goto exit;
}
} }
RARCH_LOG("RetroArch stopped.\n"); RARCH_LOG("RetroArch stopped.\n");
} }