diff --git a/frontend/frontend.c b/frontend/frontend.c index 56e813f833..99e8a9e2c9 100644 --- a/frontend/frontend.c +++ b/frontend/frontend.c @@ -80,6 +80,26 @@ static int main_entry_iterate_shutdown(signature(), args_type() args) return 0; } +int main_entry_decide(signature(), args_type() args) +{ + frontend_loop = NULL; + + if (g_extern.lifecycle_state & (1ULL << MODE_CLEAR_INPUT)) + frontend_loop = main_entry_iterate_clear_input; + else if (g_extern.lifecycle_state & (1ULL << MODE_LOAD_GAME)) + frontend_loop = main_entry_iterate_load_content; + else if (g_extern.lifecycle_state & (1ULL << MODE_GAME)) + frontend_loop = main_entry_iterate_content; +#ifdef HAVE_MENU + else if (g_extern.lifecycle_state & (1ULL << MODE_MENU_PREINIT)) + frontend_loop = main_entry_iterate_menu_preinit; + else if (g_extern.lifecycle_state & (1ULL << MODE_MENU)) + frontend_loop = main_entry_iterate_menu; +#endif + + return 0; +} + int main_entry_iterate_content(signature(), args_type() args) { if (g_extern.system.shutdown) diff --git a/frontend/frontend_context.h b/frontend/frontend_context.h index 7331d286f7..6ba113cda4 100644 --- a/frontend/frontend_context.h +++ b/frontend/frontend_context.h @@ -77,6 +77,7 @@ const frontend_ctx_driver_t *frontend_ctx_find_driver(const char *ident); /* Finds first suitable driver and initialize. */ const frontend_ctx_driver_t *frontend_ctx_init_first(void); +int main_entry_decide(signature(), args_type() args); int main_entry_iterate_clear_input(signature(), args_type() args); int main_entry_iterate_load_content(signature(), args_type() args); int main_entry_iterate_content(signature(), args_type() args); diff --git a/retroarch.c b/retroarch.c index e25248c7f3..a67af7d7f8 100644 --- a/retroarch.c +++ b/retroarch.c @@ -3336,18 +3336,7 @@ void rarch_main_set_state(unsigned cmd) break; } - if (g_extern.lifecycle_state & (1ULL << MODE_CLEAR_INPUT)) - frontend_loop = main_entry_iterate_clear_input; - else if (g_extern.lifecycle_state & (1ULL << MODE_LOAD_GAME)) - frontend_loop = main_entry_iterate_load_content; - else if (g_extern.lifecycle_state & (1ULL << MODE_GAME)) - frontend_loop = main_entry_iterate_content; -#ifdef HAVE_MENU - else if (g_extern.lifecycle_state & (1ULL << MODE_MENU_PREINIT)) - frontend_loop = main_entry_iterate_menu_preinit; - else if (g_extern.lifecycle_state & (1ULL << MODE_MENU)) - frontend_loop = main_entry_iterate_menu; -#endif + frontend_loop = main_entry_decide; } void rarch_main_command(unsigned cmd)