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 #define MAX_ARGS 32
int (*frontend_loop)(signature(), args_type() args);
static retro_keyboard_event_t key_event; static retro_keyboard_event_t key_event;
static int main_entry_iterate_shutdown(signature(), args_type() args) 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) 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 #ifdef HAVE_MENU
else if (g_extern.lifecycle_state & (1ULL << MODE_MENU_PREINIT)) if (g_extern.system.shutdown)
{ return main_entry_iterate_shutdown(signature_expand(), args);
RARCH_LOG("Frontend loop state changed : MODE_MENU_PREINIT.\n"); if (g_extern.lifecycle_state & (1ULL << MODE_CLEAR_INPUT))
frontend_loop = main_entry_iterate_menu_preinit; return main_entry_iterate_clear_input(signature_expand(), args);
} if (g_extern.lifecycle_state & (1ULL << MODE_LOAD_GAME))
else if (g_extern.lifecycle_state & (1ULL << MODE_MENU)) return main_entry_iterate_load_content(signature_expand(), args);
{ if (g_extern.lifecycle_state & (1ULL << MODE_GAME))
RARCH_LOG("Frontend loop state changed : MODE_MENU.\n"); return main_entry_iterate_content(signature_expand(), args);
frontend_loop = main_entry_iterate_menu; if (g_extern.lifecycle_state & (1ULL << MODE_MENU_PREINIT))
} return main_entry_iterate_menu_preinit(signature_expand(), args);
#endif 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) int main_entry_iterate_content(signature(), args_type() args)
@ -408,12 +393,10 @@ returntype main_entry(signature())
if (ret) if (ret)
#endif #endif
rarch_playlist_push(g_extern.history, g_extern.fullpath); rarch_playlist_push(g_extern.history, g_extern.fullpath);
#else
frontend_loop = main_entry_iterate_content_nomenu;
#endif #endif
#if defined(HAVE_MAIN_LOOP) #if defined(HAVE_MAIN_LOOP)
while (frontend_loop && !frontend_loop(signature_expand(), args)); while (!main_entry_decide(signature_expand(), args));
main_exit(args); main_exit(args);
#endif #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); int main_entry_iterate_menu(signature(), args_type() args);
#endif #endif
extern int (*frontend_loop)(signature(), args_type() args);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -31,7 +31,7 @@ static void do_iteration(void)
if (!(g_extern.main_is_init && !g_extern.is_paused)) if (!(g_extern.main_is_init && !g_extern.is_paused))
return; return;
if (!frontend_loop || (frontend_loop && frontend_loop(0, NULL, NULL))) if (main_entry_decide(0, NULL, NULL))
{ {
main_exit(NULL); main_exit(NULL);
return; return;

View File

@ -27,7 +27,7 @@
static void emscripten_mainloop(void) 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); main_exit(NULL);
exit(0); exit(0);

View File

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