Move menu_driver_is_alive to retroarch.c

This commit is contained in:
twinaphex 2019-08-09 21:31:51 +02:00
parent 4600195895
commit b0f088d5fd
4 changed files with 31 additions and 30 deletions

View File

@ -197,9 +197,6 @@ static bool menu_driver_pending_quick_menu = false;
static bool menu_driver_prevent_populate = false;
/* Is the menu driver still running? */
static bool menu_driver_alive = false;
/* A menu toggle has been requested; if the menu was running,
* it will be closed; if the menu was not running, it will be opened */
static bool menu_driver_toggled = false;
@ -2023,17 +2020,6 @@ bool menu_driver_get_load_content_animation_data(menu_texture_item *icon, char *
&& menu_driver_ctx->get_load_content_animation_data(menu_userdata, icon, playlist_name);
}
void menu_driver_set_alive(bool val)
{
menu_driver_alive = val;
}
/* Checks if the menu is still running */
bool menu_driver_is_alive(void)
{
return menu_driver_alive;
}
/* Checks if the menu framebuffer is set.
* This would usually only return true
* for framebuffer-based menu drivers, like RGUI. */
@ -2249,7 +2235,6 @@ void menu_driver_destroy(void)
menu_driver_pending_quit = false;
menu_driver_pending_shutdown = false;
menu_driver_prevent_populate = false;
menu_driver_alive = false;
menu_driver_data_own = false;
menu_driver_ctx = NULL;
menu_userdata = NULL;

View File

@ -517,10 +517,6 @@ bool menu_driver_get_load_content_animation_data(menu_texture_item *icon, char *
* return true for RGUI, for instance. */
bool menu_driver_is_texture_set(void);
void menu_driver_set_alive(bool val);
bool menu_driver_is_alive(void);
bool menu_driver_iterate(menu_ctx_iterate_t *iterate);
bool menu_driver_list_clear(file_list_t *list);

View File

@ -921,6 +921,21 @@ enum menu_mouse_action
static unsigned char menu_keyboard_key_state[RETROK_LAST] = {0};
static menu_input_t menu_input_state;
/* Is the menu driver still running? */
static bool menu_driver_alive = false;
void menu_driver_set_alive(bool val)
{
menu_driver_alive = val;
}
/* Checks if the menu is still running */
bool menu_driver_is_alive(void)
{
return menu_driver_alive;
}
#endif
/* RECORDING GLOBAL VARIABLES */
@ -3860,7 +3875,7 @@ bool command_event(enum event_command cmd, void *data)
break;
case CMD_EVENT_MENU_TOGGLE:
#ifdef HAVE_MENU
if (menu_driver_is_alive())
if (menu_driver_alive)
retroarch_menu_running_finished(false);
else
retroarch_menu_running();
@ -3999,7 +4014,7 @@ bool command_event(enum event_command cmd, void *data)
if (settings->bools.video_fullscreen)
video_driver_hide_mouse();
if (menu_driver_is_alive())
if (menu_driver_alive)
command_event(CMD_EVENT_VIDEO_SET_BLOCKING_STATE, NULL);
}
#endif
@ -4427,7 +4442,7 @@ TODO: Add a setting for these tweaks */
break;
case CMD_EVENT_MENU_PAUSE_LIBRETRO:
#ifdef HAVE_MENU
if (menu_driver_is_alive())
if (menu_driver_alive)
{
settings_t *settings = configuration_settings;
if (settings && settings->bools.menu_pause_libretro)
@ -10119,7 +10134,7 @@ static void input_overlay_loaded(retro_task_t *task,
#ifdef HAVE_MENU
/* We can't display when the menu is up */
if (data->hide_in_menu && menu_driver_is_alive())
if (data->hide_in_menu && menu_driver_alive)
{
if (data->overlay_enable)
goto abort_load;
@ -10685,7 +10700,7 @@ static void input_driver_poll(void)
#endif
#ifdef HAVE_MENU
if (!menu_driver_is_alive())
if (!menu_driver_alive)
#endif
if (settings->bools.input_remap_binds_enable && input_driver_mapper)
{
@ -18348,7 +18363,7 @@ void video_driver_build_info(video_frame_info_t *video_info)
video_info->msg_bgcolor_enable = settings->bools.video_msg_bgcolor_enable;
#ifdef HAVE_MENU
video_info->menu_is_alive = menu_driver_is_alive();
video_info->menu_is_alive = menu_driver_alive;
video_info->menu_footer_opacity = settings->floats.menu_footer_opacity;
video_info->menu_header_opacity = settings->floats.menu_header_opacity;
video_info->materialui_color_theme = settings->uints.menu_materialui_color_theme;
@ -19842,6 +19857,7 @@ bool driver_ctl(enum driver_ctl_state state, void *data)
#ifdef HAVE_MENU
menu_driver_destroy();
menu_driver_alive = false;
#endif
location_driver_active = false;
location_driver = NULL;
@ -21647,7 +21663,7 @@ bool retroarch_main_init(int argc, char *argv[])
/* Check if menu was active prior to core initialization */
if (!content_launched_from_cli()
#ifdef HAVE_MENU
|| menu_driver_is_alive()
|| menu_driver_alive
#endif
)
{
@ -22900,7 +22916,7 @@ static enum runloop_state runloop_check_state(
bool rarch_is_initialized = rarch_is_inited;
#ifdef HAVE_MENU
bool menu_driver_binding_state = menu_driver_is_binding_state();
bool menu_is_alive = menu_driver_is_alive();
bool menu_is_alive = menu_driver_alive;
unsigned menu_toggle_gamepad_combo = settings->uints.input_menu_toggle_gamepad_combo;
#ifdef HAVE_EASTEREGG
static uint64_t seq = 0;
@ -23291,7 +23307,7 @@ static enum runloop_state runloop_check_state(
if (menu_keyboard_key_state[RETROK_F1] == 1)
{
if (menu_driver_is_alive())
if (menu_driver_alive)
{
if (rarch_is_initialized && !core_type_is_dummy)
{
@ -23304,7 +23320,7 @@ static enum runloop_state runloop_check_state(
(pressed && !old_pressed)) ||
core_type_is_dummy)
{
if (menu_driver_is_alive())
if (menu_driver_alive)
{
if (rarch_is_initialized && !core_type_is_dummy)
retroarch_menu_running_finished(false);
@ -23382,7 +23398,7 @@ static enum runloop_state runloop_check_state(
/* Check if we have pressed the netplay host toggle button */
HOTKEY_CHECK(RARCH_NETPLAY_HOST_TOGGLE, CMD_EVENT_NETPLAY_HOST_TOGGLE, true, NULL);
if (menu_driver_is_alive())
if (menu_driver_alive)
{
if (!settings->bools.menu_throttle_framerate && !fastforward_ratio)
return RUNLOOP_STATE_MENU_ITERATE;

View File

@ -2101,6 +2101,10 @@ const void *camera_driver_find_handle(int index);
**/
const char *camera_driver_find_ident(int index);
void menu_driver_set_alive(bool val);
bool menu_driver_is_alive(void);
RETRO_END_DECLS
#endif