mirror of
https://github.com/libretro/RetroArch.git
synced 2025-01-19 07:16:21 +00:00
Refine frontend_loop some more
This commit is contained in:
parent
1426e705c9
commit
4569b4f32c
@ -69,12 +69,28 @@
|
||||
|
||||
#define MAX_ARGS 32
|
||||
|
||||
int (*frontend_loop)(args_type() args);
|
||||
int (*frontend_loop)(signature(), args_type() args);
|
||||
|
||||
static retro_keyboard_event_t key_event;
|
||||
|
||||
int main_entry_iterate_content(args_type() args)
|
||||
static int main_entry_iterate_shutdown(signature(), args_type() args)
|
||||
{
|
||||
(void)args;
|
||||
|
||||
if (!g_settings.load_dummy_on_core_shutdown)
|
||||
return 1;
|
||||
|
||||
/* Load dummy core instead of exiting RetroArch completely. */
|
||||
rarch_main_command(RARCH_CMD_PREPARE_DUMMY);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main_entry_iterate_content(signature(), args_type() args)
|
||||
{
|
||||
if (g_extern.system.shutdown)
|
||||
return main_entry_iterate_shutdown(signature_expand(), args);
|
||||
|
||||
if (!rarch_main_iterate())
|
||||
{
|
||||
rarch_main_set_state(RARCH_ACTION_STATE_RUNNING_FINISHED);
|
||||
@ -88,10 +104,13 @@ int main_entry_iterate_content(args_type() args)
|
||||
}
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
int main_entry_iterate_clear_input(args_type() args)
|
||||
int main_entry_iterate_clear_input(signature(), args_type() args)
|
||||
{
|
||||
(void)args;
|
||||
|
||||
if (g_extern.system.shutdown)
|
||||
return main_entry_iterate_shutdown(signature_expand(), args);
|
||||
|
||||
rarch_input_poll();
|
||||
if (!menu_input())
|
||||
{
|
||||
@ -105,22 +124,13 @@ int main_entry_iterate_clear_input(args_type() args)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int main_entry_iterate_shutdown(args_type() args)
|
||||
|
||||
|
||||
int main_entry_iterate_load_content(signature(), args_type() args)
|
||||
{
|
||||
(void)args;
|
||||
if (g_extern.system.shutdown)
|
||||
return main_entry_iterate_shutdown(signature_expand(), args);
|
||||
|
||||
if (!g_settings.load_dummy_on_core_shutdown)
|
||||
return 1;
|
||||
|
||||
/* Load dummy core instead of exiting RetroArch completely. */
|
||||
rarch_main_command(RARCH_CMD_PREPARE_DUMMY);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int main_entry_iterate_load_content(args_type() args)
|
||||
{
|
||||
if (!load_menu_content())
|
||||
{
|
||||
/* If content loading fails, we go back to menu. */
|
||||
@ -134,10 +144,13 @@ int main_entry_iterate_load_content(args_type() args)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main_entry_iterate_menu_preinit(args_type() args)
|
||||
int main_entry_iterate_menu_preinit(signature(), args_type() args)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (g_extern.system.shutdown)
|
||||
return main_entry_iterate_shutdown(signature_expand(), args);
|
||||
|
||||
/* Menu should always run with vsync on. */
|
||||
rarch_main_command(RARCH_CMD_VIDEO_SET_BLOCKING_STATE);
|
||||
|
||||
@ -167,8 +180,11 @@ int main_entry_iterate_menu_preinit(args_type() args)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main_entry_iterate_menu(args_type() args)
|
||||
int main_entry_iterate_menu(signature(), args_type() args)
|
||||
{
|
||||
if (g_extern.system.shutdown)
|
||||
return main_entry_iterate_shutdown(signature_expand(), args);
|
||||
|
||||
if (menu_iterate())
|
||||
{
|
||||
if (driver.frontend_ctx && driver.frontend_ctx->process_events)
|
||||
@ -188,16 +204,6 @@ int main_entry_iterate_menu(args_type() args)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main_entry_iterate(signature(), args_type() args)
|
||||
{
|
||||
if (g_extern.system.shutdown)
|
||||
return main_entry_iterate_shutdown(args);
|
||||
if (frontend_loop)
|
||||
return frontend_loop(args);
|
||||
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@ -368,7 +374,7 @@ returntype main_entry(signature())
|
||||
|
||||
#if defined(HAVE_MAIN_LOOP)
|
||||
#if defined(HAVE_MENU)
|
||||
while (!main_entry_iterate(signature_expand(), args));
|
||||
while (frontend_loop && !frontend_loop(signature_expand(), args));
|
||||
#else
|
||||
while (rarch_main_iterate());
|
||||
#endif
|
||||
|
@ -27,8 +27,6 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int main_entry_iterate(signature(), args_type() args);
|
||||
|
||||
void main_exit(args_type() args);
|
||||
|
||||
returntype main_entry(signature());
|
||||
|
@ -27,10 +27,12 @@
|
||||
#if defined(ANDROID)
|
||||
#define args_type() struct android_app*
|
||||
#define signature() void* data
|
||||
#define signature_expand() data
|
||||
#define returntype void
|
||||
#else
|
||||
#define args_type() void*
|
||||
#define signature() int argc, char *argv[]
|
||||
#define signature_expand() argc, argv
|
||||
#define returntype int
|
||||
#endif
|
||||
|
||||
@ -72,14 +74,14 @@ const frontend_ctx_driver_t *frontend_ctx_find_driver(const char *ident); // Fin
|
||||
const frontend_ctx_driver_t *frontend_ctx_init_first(void); // Finds first suitable driver and initializes.
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
int main_entry_iterate_content(args_type() args);
|
||||
int main_entry_iterate_menu_preinit(args_type() args);
|
||||
int main_entry_iterate_menu(args_type() args);
|
||||
int main_entry_iterate_clear_input(args_type() args);
|
||||
int main_entry_iterate_load_content(args_type() args);
|
||||
int main_entry_iterate_content(signature(), args_type() args);
|
||||
int main_entry_iterate_menu_preinit(signature(), args_type() args);
|
||||
int main_entry_iterate_menu(signature(), args_type() args);
|
||||
int main_entry_iterate_clear_input(signature(), args_type() args);
|
||||
int main_entry_iterate_load_content(signature(), args_type() args);
|
||||
#endif
|
||||
|
||||
extern int (*frontend_loop)(args_type() args);
|
||||
extern int (*frontend_loop)(signature(), args_type() args);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -31,7 +31,7 @@ static void do_iteration(void)
|
||||
if (!(g_extern.main_is_init && !g_extern.is_paused))
|
||||
return;
|
||||
|
||||
if (main_entry_iterate(0, NULL, NULL))
|
||||
if (frontend_loop && frontend_loop(0, NULL, NULL))
|
||||
{
|
||||
main_exit(NULL);
|
||||
return;
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
static void emscripten_mainloop(void)
|
||||
{
|
||||
if (main_entry_iterate(0, NULL, NULL))
|
||||
if (frontend_loop && frontend_loop(0, NULL, NULL))
|
||||
{
|
||||
main_exit(NULL);
|
||||
exit(0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user