(Android) Do Android pausing in a different way

This commit is contained in:
twinaphex 2012-12-15 19:17:26 +01:00
parent 7a67348b3c
commit 627fd567a9
3 changed files with 9 additions and 8 deletions

View File

@ -60,5 +60,6 @@ struct jni_out_params_char
extern struct droid g_android; extern struct droid g_android;
void jni_get_char_argv(struct jni_params *params, struct jni_out_params_char *out_params); void jni_get_char_argv(struct jni_params *params, struct jni_out_params_char *out_params);
bool android_run_events(struct android_app* android_app);
#endif #endif

View File

@ -260,7 +260,7 @@ void engine_handle_cmd(struct android_app* android_app, int32_t cmd)
#define MAX_ARGS 32 #define MAX_ARGS 32
static bool android_run_events(struct android_app* android_app) bool android_run_events(struct android_app* android_app)
{ {
// Read all pending events. // Read all pending events.
int id; int id;
@ -444,12 +444,7 @@ static void* android_app_entry(void* param)
RARCH_LOG("RetroArch started.\n"); RARCH_LOG("RetroArch started.\n");
rarch_init_msg_queue(); rarch_init_msg_queue();
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());
{
if(g_android.activity_paused)
if(!android_run_events(android_app))
goto exit;
}
RARCH_LOG("RetroArch stopped.\n"); RARCH_LOG("RetroArch stopped.\n");
} }
@ -488,7 +483,7 @@ exit:
} }
static void android_app_write_cmd(struct android_app* android_app, int8_t cmd) static inline void android_app_write_cmd(struct android_app* android_app, int8_t cmd)
{ {
if (write(android_app->msgwrite, &cmd, sizeof(cmd)) != sizeof(cmd)) if (write(android_app->msgwrite, &cmd, sizeof(cmd)) != sizeof(cmd))
RARCH_ERR("Failure writing android_app cmd: %s\n", strerror(errno)); RARCH_ERR("Failure writing android_app cmd: %s\n", strerror(errno));

View File

@ -2752,6 +2752,11 @@ bool rarch_main_iterate(void)
return false; return false;
} }
#ifdef ANDROID
if(g_android.activity_paused)
return android_run_events(g_android.app);
#endif
// Time to drop? // Time to drop?
if (input_key_pressed_func(RARCH_QUIT_KEY) || if (input_key_pressed_func(RARCH_QUIT_KEY) ||
!video_alive_func()) !video_alive_func())