mirror of
https://github.com/libretro/RetroArch
synced 2025-04-24 15:02:35 +00:00
(Frontend) Go through frontend_loop function pointer
This commit is contained in:
parent
f495170f3a
commit
1426e705c9
@ -69,10 +69,26 @@
|
|||||||
|
|
||||||
#define MAX_ARGS 32
|
#define MAX_ARGS 32
|
||||||
|
|
||||||
|
int (*frontend_loop)(args_type() args);
|
||||||
|
|
||||||
static retro_keyboard_event_t key_event;
|
static retro_keyboard_event_t key_event;
|
||||||
|
|
||||||
|
int main_entry_iterate_content(args_type() args)
|
||||||
|
{
|
||||||
|
if (!rarch_main_iterate())
|
||||||
|
{
|
||||||
|
rarch_main_set_state(RARCH_ACTION_STATE_RUNNING_FINISHED);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (driver.frontend_ctx && driver.frontend_ctx->process_events)
|
||||||
|
driver.frontend_ctx->process_events(args);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_MENU
|
#ifdef HAVE_MENU
|
||||||
static int main_entry_iterate_clear_input(args_type() args)
|
int main_entry_iterate_clear_input(args_type() args)
|
||||||
{
|
{
|
||||||
(void)args;
|
(void)args;
|
||||||
|
|
||||||
@ -102,21 +118,8 @@ static int main_entry_iterate_shutdown(args_type() args)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int main_entry_iterate_content(args_type() args)
|
|
||||||
{
|
|
||||||
if (!rarch_main_iterate())
|
|
||||||
{
|
|
||||||
rarch_main_set_state(RARCH_ACTION_STATE_RUNNING_FINISHED);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (driver.frontend_ctx && driver.frontend_ctx->process_events)
|
int main_entry_iterate_load_content(args_type() args)
|
||||||
driver.frontend_ctx->process_events(args);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int main_entry_iterate_load_content(args_type() args)
|
|
||||||
{
|
{
|
||||||
if (!load_menu_content())
|
if (!load_menu_content())
|
||||||
{
|
{
|
||||||
@ -131,7 +134,7 @@ static int main_entry_iterate_load_content(args_type() args)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int main_entry_iterate_menu_preinit(args_type() args)
|
int main_entry_iterate_menu_preinit(args_type() args)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -164,7 +167,7 @@ static int main_entry_iterate_menu_preinit(args_type() args)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int main_entry_iterate_menu(args_type() args)
|
int main_entry_iterate_menu(args_type() args)
|
||||||
{
|
{
|
||||||
if (menu_iterate())
|
if (menu_iterate())
|
||||||
{
|
{
|
||||||
@ -190,18 +193,9 @@ int main_entry_iterate(signature(), args_type() args)
|
|||||||
{
|
{
|
||||||
if (g_extern.system.shutdown)
|
if (g_extern.system.shutdown)
|
||||||
return main_entry_iterate_shutdown(args);
|
return main_entry_iterate_shutdown(args);
|
||||||
if (g_extern.lifecycle_state & (1ULL << MODE_CLEAR_INPUT))
|
if (frontend_loop)
|
||||||
return main_entry_iterate_clear_input(args);
|
return frontend_loop(args);
|
||||||
if (g_extern.lifecycle_state & (1ULL << MODE_LOAD_GAME))
|
|
||||||
return main_entry_iterate_load_content(args);
|
|
||||||
if (g_extern.lifecycle_state & (1ULL << MODE_GAME))
|
|
||||||
return main_entry_iterate_content(args);
|
|
||||||
#ifdef HAVE_MENU
|
|
||||||
if (g_extern.lifecycle_state & (1ULL << MODE_MENU_PREINIT))
|
|
||||||
return main_entry_iterate_menu_preinit(args);
|
|
||||||
if (g_extern.lifecycle_state & (1ULL << MODE_MENU))
|
|
||||||
return main_entry_iterate_menu(args);
|
|
||||||
#endif
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -23,16 +23,6 @@
|
|||||||
#include "../boolean.h"
|
#include "../boolean.h"
|
||||||
#include "frontend_context.h"
|
#include "frontend_context.h"
|
||||||
|
|
||||||
#if defined(ANDROID)
|
|
||||||
#define args_type() struct android_app*
|
|
||||||
#define signature() void* data
|
|
||||||
#define returntype void
|
|
||||||
#else
|
|
||||||
#define args_type() void*
|
|
||||||
#define signature() int argc, char *argv[]
|
|
||||||
#define returntype int
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
@ -24,6 +24,16 @@
|
|||||||
#include "../config.h"
|
#include "../config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(ANDROID)
|
||||||
|
#define args_type() struct android_app*
|
||||||
|
#define signature() void* data
|
||||||
|
#define returntype void
|
||||||
|
#else
|
||||||
|
#define args_type() void*
|
||||||
|
#define signature() int argc, char *argv[]
|
||||||
|
#define returntype int
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
@ -61,6 +71,17 @@ extern const frontend_ctx_driver_t frontend_ctx_null;
|
|||||||
const frontend_ctx_driver_t *frontend_ctx_find_driver(const char *ident); // Finds driver with ident. Does not initialize.
|
const frontend_ctx_driver_t *frontend_ctx_find_driver(const char *ident); // Finds driver with ident. Does not initialize.
|
||||||
const frontend_ctx_driver_t *frontend_ctx_init_first(void); // Finds first suitable driver and initializes.
|
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);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern int (*frontend_loop)(args_type() args);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
16
retroarch.c
16
retroarch.c
@ -3303,6 +3303,9 @@ static inline void limit_frame_time(void)
|
|||||||
|
|
||||||
void rarch_main_set_state(unsigned cmd)
|
void rarch_main_set_state(unsigned cmd)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
frontend_loop = NULL;
|
||||||
|
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
case RARCH_ACTION_STATE_MENU_PREINIT:
|
case RARCH_ACTION_STATE_MENU_PREINIT:
|
||||||
@ -3346,6 +3349,19 @@ void rarch_main_set_state(unsigned cmd)
|
|||||||
default:
|
default:
|
||||||
break;
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
void rarch_main_command(unsigned cmd)
|
void rarch_main_command(unsigned cmd)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user