Create main_entry_decide to delegate decisionmaking process of

what to bind frontend_loop to
This commit is contained in:
twinaphex 2014-09-14 15:23:40 +02:00
parent 2d64c7aa8f
commit e9c865f56a
3 changed files with 22 additions and 12 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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)