diff --git a/android/native/jni/android_general.h b/android/native/jni/android_general.h index e51f8630b5..b4e17f245b 100644 --- a/android/native/jni/android_general.h +++ b/android/native/jni/android_general.h @@ -60,5 +60,6 @@ struct jni_out_params_char extern struct droid g_android; 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 diff --git a/android/native/jni/main.c b/android/native/jni/main.c index defaadf7b4..701e7eb51b 100644 --- a/android/native/jni/main.c +++ b/android/native/jni/main.c @@ -260,7 +260,7 @@ void engine_handle_cmd(struct android_app* android_app, int32_t cmd) #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. int id; @@ -444,12 +444,7 @@ static void* android_app_entry(void* param) RARCH_LOG("RetroArch started.\n"); rarch_init_msg_queue(); g_android.last_orient = AConfiguration_getOrientation(android_app->config); - while (rarch_main_iterate()) - { - if(g_android.activity_paused) - if(!android_run_events(android_app)) - goto exit; - } + while(rarch_main_iterate()); 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)) RARCH_ERR("Failure writing android_app cmd: %s\n", strerror(errno)); diff --git a/retroarch.c b/retroarch.c index 3cf9bdede9..dcfdd4e616 100644 --- a/retroarch.c +++ b/retroarch.c @@ -2752,6 +2752,11 @@ bool rarch_main_iterate(void) return false; } +#ifdef ANDROID + if(g_android.activity_paused) + return android_run_events(g_android.app); +#endif + // Time to drop? if (input_key_pressed_func(RARCH_QUIT_KEY) || !video_alive_func())