Get rid of frontend_loop

This commit is contained in:
twinaphex 2014-09-14 16:29:09 +02:00
parent cb1eea1ec2
commit 2284395c4d
5 changed files with 19 additions and 41 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -3332,8 +3332,6 @@ void rarch_main_set_state(unsigned cmd)
default:
break;
}
frontend_loop = main_entry_decide;
}
void rarch_main_command(unsigned cmd)