diff --git a/frontend/frontend.c b/frontend/frontend.c index 1888248fcb..512d4891fd 100644 --- a/frontend/frontend.c +++ b/frontend/frontend.c @@ -63,8 +63,6 @@ #define MAX_ARGS 32 -int (*frontend_loop)(signature(), args_type() args); - static retro_keyboard_event_t key_event; static int main_entry_iterate_shutdown(signature(), args_type() args) @@ -82,37 +80,24 @@ static int main_entry_iterate_shutdown(signature(), args_type() args) int main_entry_decide(signature(), args_type() args) { - frontend_loop = NULL; - - if (g_extern.lifecycle_state & (1ULL << MODE_CLEAR_INPUT)) - { - RARCH_LOG("Frontend loop state changed : MODE_CLEAR_INPUT.\n"); - frontend_loop = main_entry_iterate_clear_input; - } - else if (g_extern.lifecycle_state & (1ULL << MODE_LOAD_GAME)) - { - RARCH_LOG("Frontend loop state changed : MODE_LOAD_GAME.\n"); - frontend_loop = main_entry_iterate_load_content; - } - else if (g_extern.lifecycle_state & (1ULL << MODE_GAME)) - { - RARCH_LOG("Frontend loop state changed : MODE_GAME.\n"); - frontend_loop = main_entry_iterate_content; - } #ifdef HAVE_MENU - else if (g_extern.lifecycle_state & (1ULL << MODE_MENU_PREINIT)) - { - RARCH_LOG("Frontend loop state changed : MODE_MENU_PREINIT.\n"); - frontend_loop = main_entry_iterate_menu_preinit; - } - else if (g_extern.lifecycle_state & (1ULL << MODE_MENU)) - { - RARCH_LOG("Frontend loop state changed : MODE_MENU.\n"); - frontend_loop = main_entry_iterate_menu; - } -#endif + if (g_extern.system.shutdown) + return main_entry_iterate_shutdown(signature_expand(), args); + if (g_extern.lifecycle_state & (1ULL << MODE_CLEAR_INPUT)) + return main_entry_iterate_clear_input(signature_expand(), args); + if (g_extern.lifecycle_state & (1ULL << MODE_LOAD_GAME)) + return main_entry_iterate_load_content(signature_expand(), args); + if (g_extern.lifecycle_state & (1ULL << MODE_GAME)) + return main_entry_iterate_content(signature_expand(), args); + if (g_extern.lifecycle_state & (1ULL << MODE_MENU_PREINIT)) + return main_entry_iterate_menu_preinit(signature_expand(), args); + if (g_extern.lifecycle_state & (1ULL << MODE_MENU)) + return main_entry_iterate_menu(signature_expand(), args); - return 0; + return 1; +#else + return main_entry_iterate_content_nomenu(signature_expand(), args); +#endif } int main_entry_iterate_content(signature(), args_type() args) @@ -408,12 +393,10 @@ returntype main_entry(signature()) if (ret) #endif rarch_playlist_push(g_extern.history, g_extern.fullpath); -#else - frontend_loop = main_entry_iterate_content_nomenu; #endif #if defined(HAVE_MAIN_LOOP) - while (frontend_loop && !frontend_loop(signature_expand(), args)); + while (!main_entry_decide(signature_expand(), args)); main_exit(args); #endif diff --git a/frontend/frontend_context.h b/frontend/frontend_context.h index 6ba113cda4..e51466dad9 100644 --- a/frontend/frontend_context.h +++ b/frontend/frontend_context.h @@ -86,9 +86,6 @@ int main_entry_iterate_menu_preinit(signature(), args_type() args); int main_entry_iterate_menu(signature(), args_type() args); #endif -extern int (*frontend_loop)(signature(), args_type() args); - - #ifdef __cplusplus } #endif diff --git a/frontend/platform/platform_apple.c b/frontend/platform/platform_apple.c index b646fde300..9ff7f520d2 100644 --- a/frontend/platform/platform_apple.c +++ b/frontend/platform/platform_apple.c @@ -31,7 +31,7 @@ static void do_iteration(void) if (!(g_extern.main_is_init && !g_extern.is_paused)) return; - if (!frontend_loop || (frontend_loop && frontend_loop(0, NULL, NULL))) + if (main_entry_decide(0, NULL, NULL)) { main_exit(NULL); return; diff --git a/frontend/platform/platform_emscripten.c b/frontend/platform/platform_emscripten.c index e7364a32b2..138906e552 100644 --- a/frontend/platform/platform_emscripten.c +++ b/frontend/platform/platform_emscripten.c @@ -27,7 +27,7 @@ static void emscripten_mainloop(void) { - if (frontend_loop || (frontend_loop && frontend_loop(0, NULL, NULL))) + if (main_entry_decide(0, NULL, NULL)) { main_exit(NULL); exit(0); diff --git a/retroarch.c b/retroarch.c index ee6dc10f94..5217ff7c0c 100644 --- a/retroarch.c +++ b/retroarch.c @@ -3332,8 +3332,6 @@ void rarch_main_set_state(unsigned cmd) default: break; } - - frontend_loop = main_entry_decide; } void rarch_main_command(unsigned cmd)