diff --git a/android/native/jni/android_general.h b/android/native/jni/android_general.h index b4e17f245b..8a4ba73d8d 100644 --- a/android/native/jni/android_general.h +++ b/android/native/jni/android_general.h @@ -34,7 +34,6 @@ struct droid unsigned height; struct saved_state state; int32_t last_orient; - unsigned reinit_video; unsigned activity_paused; float disp_refresh_rate; }; diff --git a/android/native/jni/main.c b/android/native/jni/main.c index 701e7eb51b..a98093e128 100644 --- a/android/native/jni/main.c +++ b/android/native/jni/main.c @@ -145,19 +145,10 @@ void engine_handle_cmd(struct android_app* android_app, int32_t cmd) /* The window is being shown, get it ready. */ android_app->window = android_app->pendingWindow; - if (g_extern.lifecycle_state & (1ULL << RARCH_REENTRANT)) - { - gfx_ctx_init(); - g_extern.audio_active = true; - g_extern.video_active = true; - g_android.reinit_video = 1; - } pthread_cond_broadcast(&android_app->cond); pthread_mutex_unlock(&android_app->mutex); - if (android_app->window != NULL) - g_extern.lifecycle_state |= (1ULL << RARCH_WINDOW_READY); break; case APP_CMD_RESUME: @@ -200,8 +191,6 @@ void engine_handle_cmd(struct android_app* android_app, int32_t cmd) /* Setting reentrancy */ RARCH_LOG("Setting up RetroArch re-entrancy...\n"); g_extern.lifecycle_state |= (1ULL << RARCH_REENTRANT); - g_extern.audio_active = false; - g_extern.video_active = false; g_android.activity_paused = true; } break; @@ -232,7 +221,10 @@ void engine_handle_cmd(struct android_app* android_app, int32_t cmd) /* The window is being hidden or closed, clean it up. */ /* terminate display/EGL context here */ if(g_extern.lifecycle_state & (1ULL << RARCH_REENTRANT)) - gfx_ctx_destroy(); + { + uninit_drivers(); + g_extern.lifecycle_state &= ~(1ULL << RARCH_WINDOW_READY); + } /* POSTEXEC */ android_app->window = NULL; @@ -284,6 +276,15 @@ bool android_run_events(struct android_app* android_app) cmd = -1; engine_handle_cmd(android_app, cmd); + + if (cmd == APP_CMD_INIT_WINDOW) + { + if(g_extern.lifecycle_state & (1ULL << RARCH_REENTRANT)) + init_drivers(); + + if (android_app->window != NULL) + g_extern.lifecycle_state |= (1ULL << RARCH_WINDOW_READY); + } } // Check if we are exiting. diff --git a/gfx/context/androidegl_ctx.c b/gfx/context/androidegl_ctx.c index 6bfbe260d3..3867f959e3 100644 --- a/gfx/context/androidegl_ctx.c +++ b/gfx/context/androidegl_ctx.c @@ -239,14 +239,6 @@ static void gfx_ctx_check_window(bool *quit, RARCH_PERFORMANCE_STOP(alooper_pollonce); - if (g_android.reinit_video) - { - uninit_drivers(); - init_drivers(); - g_android.reinit_video = 0; - *resize = true; - } - int32_t new_orient = AConfiguration_getOrientation(g_android.app->config); if (new_orient != g_android.last_orient)