Refactor main entry iteration function
This commit is contained in:
parent
bdf9df6c2e
commit
ff9a16d407
|
@ -74,49 +74,12 @@ int main_entry_decide(signature(), args_type() args)
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
if (g_extern.system.shutdown)
|
if (g_extern.system.shutdown)
|
||||||
ret = main_entry_iterate_shutdown(signature_expand(), args);
|
ret = main_entry_iterate_shutdown(signature_expand(), args);
|
||||||
if (g_extern.lifecycle_state & (1ULL << MODE_GAME))
|
else if (g_extern.lifecycle_state & (1ULL << MODE_MENU))
|
||||||
ret = main_entry_iterate_content(signature_expand(), args);
|
|
||||||
if (g_extern.lifecycle_state & (1ULL << MODE_MENU))
|
|
||||||
ret = main_entry_iterate_menu(signature_expand(), args);
|
|
||||||
|
|
||||||
if (driver.frontend_ctx && driver.frontend_ctx->process_events)
|
|
||||||
driver.frontend_ctx->process_events(args);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
#else
|
|
||||||
return main_entry_iterate_content_nomenu(signature_expand(), args);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
int main_entry_iterate_content(signature(), args_type() args)
|
|
||||||
{
|
|
||||||
if (!rarch_main_iterate())
|
|
||||||
{
|
{
|
||||||
rarch_main_set_state(RARCH_ACTION_STATE_RUNNING_FINISHED);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef HAVE_MENU
|
|
||||||
static int main_entry_iterate_content_nomenu(signature(), args_type() args)
|
|
||||||
{
|
|
||||||
if (!rarch_main_iterate())
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_MENU
|
|
||||||
int main_entry_iterate_menu(signature(), args_type() args)
|
|
||||||
{
|
|
||||||
retro_input_t input, old_state = 0;
|
retro_input_t input, old_state = 0;
|
||||||
|
|
||||||
if (menu_iterate())
|
if (!menu_iterate())
|
||||||
return 0;
|
{
|
||||||
|
|
||||||
rarch_main_set_state(RARCH_ACTION_STATE_MENU_RUNNING_FINISHED);
|
rarch_main_set_state(RARCH_ACTION_STATE_MENU_RUNNING_FINISHED);
|
||||||
driver_set_nonblock_state(driver.nonblock_state);
|
driver_set_nonblock_state(driver.nonblock_state);
|
||||||
|
|
||||||
|
@ -128,12 +91,29 @@ int main_entry_iterate_menu(signature(), args_type() args)
|
||||||
|
|
||||||
if (BIND_PRESSED(input, RARCH_QUIT_KEY) ||
|
if (BIND_PRESSED(input, RARCH_QUIT_KEY) ||
|
||||||
!driver.video->alive(driver.video_data))
|
!driver.video->alive(driver.video_data))
|
||||||
|
ret = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
else if (g_extern.lifecycle_state & (1ULL << MODE_GAME))
|
||||||
|
{
|
||||||
|
if (!rarch_main_iterate())
|
||||||
|
rarch_main_set_state(RARCH_ACTION_STATE_RUNNING_FINISHED);
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (driver.frontend_ctx && driver.frontend_ctx->process_events)
|
||||||
|
driver.frontend_ctx->process_events(args);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
#else
|
||||||
|
if (!rarch_main_iterate())
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void main_exit(args_type() args)
|
void main_exit(args_type() args)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue