1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-08 12:15:49 +00:00

Create rarch_menu_running/rarch_menu_running_finished

This commit is contained in:
twinaphex 2017-05-15 04:31:40 +02:00
parent c70916ca31
commit e2c7671e9f
7 changed files with 52 additions and 56 deletions

View File

@ -1888,9 +1888,9 @@ bool command_event(enum event_command cmd, void *data)
case CMD_EVENT_MENU_TOGGLE:
#ifdef HAVE_MENU
if (menu_driver_is_alive())
rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL);
rarch_menu_running_finished();
else
rarch_ctl(RARCH_CTL_MENU_RUNNING, NULL);
rarch_menu_running();
#endif
break;
case CMD_EVENT_CONTROLLERS_INIT:
@ -2304,7 +2304,7 @@ bool command_event(enum event_command cmd, void *data)
#endif
break;
case CMD_EVENT_RESUME:
rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL);
rarch_menu_running_finished();
if (ui_companion_is_on_foreground())
ui_companion_driver_toggle();
break;

View File

@ -4104,9 +4104,7 @@ static void action_ok_netplay_enable_client_hostname_cb(
}
menu_input_dialog_end();
/* Force the menu to close */
rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL);
rarch_menu_running_finished();
}
#endif

View File

@ -295,7 +295,7 @@ static void handshake_password(void *ignore, const char *line)
#ifdef HAVE_MENU
menu_input_dialog_end();
rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL);
rarch_menu_running_finished();
#endif
}
#endif
@ -394,7 +394,7 @@ bool netplay_handshake_init(netplay_t *netplay,
{
#ifdef HAVE_MENU
menu_input_ctx_line_t line;
rarch_ctl(RARCH_CTL_MENU_RUNNING, NULL);
rarch_menu_running();
#endif
handshake_password_netplay = netplay;

View File

@ -1295,6 +1295,35 @@ bool retroarch_is_on_main_thread(void)
return true;
}
void rarch_menu_running(void)
{
#ifdef HAVE_MENU
menu_driver_ctl(RARCH_MENU_CTL_SET_TOGGLE, NULL);
#endif
#ifdef HAVE_OVERLAY
{
settings_t *settings = config_get_ptr();
if (settings && settings->bools.input_overlay_hide_in_menu)
command_event(CMD_EVENT_OVERLAY_DEINIT, NULL);
}
#endif
}
void rarch_menu_running_finished(void)
{
#ifdef HAVE_MENU
menu_driver_ctl(RARCH_MENU_CTL_UNSET_TOGGLE, NULL);
#endif
video_driver_set_texture_enable(false, false);
#ifdef HAVE_OVERLAY
{
settings_t *settings = config_get_ptr();
if (settings && settings->bools.input_overlay_hide_in_menu)
command_event(CMD_EVENT_OVERLAY_INIT, NULL);
}
#endif
}
bool rarch_ctl(enum rarch_ctl_state state, void *data)
{
switch(state)
@ -1459,31 +1488,6 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
break;
case RARCH_CTL_IS_BLOCK_CONFIG_READ:
return rarch_block_config_read;
case RARCH_CTL_MENU_RUNNING:
#ifdef HAVE_MENU
menu_driver_ctl(RARCH_MENU_CTL_SET_TOGGLE, NULL);
#endif
#ifdef HAVE_OVERLAY
{
settings_t *settings = config_get_ptr();
if (settings && settings->bools.input_overlay_hide_in_menu)
command_event(CMD_EVENT_OVERLAY_DEINIT, NULL);
}
#endif
break;
case RARCH_CTL_MENU_RUNNING_FINISHED:
#ifdef HAVE_MENU
menu_driver_ctl(RARCH_MENU_CTL_UNSET_TOGGLE, NULL);
#endif
video_driver_set_texture_enable(false, false);
#ifdef HAVE_OVERLAY
{
settings_t *settings = config_get_ptr();
if (settings && settings->bools.input_overlay_hide_in_menu)
command_event(CMD_EVENT_OVERLAY_INIT, NULL);
}
#endif
break;
case RARCH_CTL_NONE:
default:
return false;
@ -1806,9 +1810,7 @@ bool retroarch_main_quit(void)
#endif
runloop_shutdown_initiated = true;
#ifdef HAVE_MENU
rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL);
#endif
rarch_menu_running_finished();
return true;
}
@ -2387,7 +2389,7 @@ static enum runloop_state runloop_check_state(
iter.action = action;
if (!menu_driver_iterate(&iter))
rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL);
rarch_menu_running_finished();
if (focused || !runloop_idle)
menu_driver_render(runloop_idle, rarch_is_inited,
@ -2417,7 +2419,7 @@ static enum runloop_state runloop_check_state(
{
if (rarch_is_inited && (current_core_type != CORE_TYPE_DUMMY))
{
rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL);
rarch_menu_running_finished();
menu_event_kb_set(false, RETROK_F1);
}
}
@ -2429,12 +2431,12 @@ static enum runloop_state runloop_check_state(
if (menu_driver_is_alive())
{
if (rarch_is_inited && (current_core_type != CORE_TYPE_DUMMY))
rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL);
rarch_menu_running_finished();
}
else
{
menu_display_toggle_set_reason(MENU_TOGGLE_REASON_USER);
rarch_ctl(RARCH_CTL_MENU_RUNNING, NULL);
rarch_menu_running();
}
}
else

View File

@ -49,10 +49,6 @@ enum rarch_ctl_state
RARCH_CTL_DESTROY,
/* Menu running? */
RARCH_CTL_MENU_RUNNING,
RARCH_CTL_MENU_RUNNING_FINISHED,
RARCH_CTL_SET_PATHS_REDIRECT,
RARCH_CTL_IS_BPS_PREF,
@ -355,6 +351,10 @@ void runloop_set(enum runloop_action action);
void runloop_unset(enum runloop_action action);
void rarch_menu_running(void);
void rarch_menu_running_finished(void);
bool retroarch_is_on_main_thread(void);
rarch_system_info_t *runloop_get_system_info(void);

View File

@ -1150,7 +1150,7 @@ bool task_push_load_content_from_playlist_from_menu(
free(error_string);
}
rarch_ctl(RARCH_CTL_MENU_RUNNING, NULL);
rarch_menu_running();
ret = false;
goto end;
@ -1158,7 +1158,7 @@ bool task_push_load_content_from_playlist_from_menu(
#ifndef HAVE_DYNAMIC
runloop_ctl(RUNLOOP_CTL_SET_SHUTDOWN, NULL);
rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL);
rarch_menu_running_finished();
#endif
/* Load core */
@ -1253,9 +1253,7 @@ bool task_push_start_current_core(content_ctx_info_t *content_info)
free(error_string);
}
#ifdef HAVE_MENU
rarch_ctl(RARCH_CTL_MENU_RUNNING, NULL);
#endif
rarch_menu_running();
ret = false;
goto end;
@ -1384,7 +1382,7 @@ bool task_push_load_content_with_new_core_from_menu(
free(error_string);
}
rarch_ctl(RARCH_CTL_MENU_RUNNING, NULL);
rarch_menu_running();
ret = false;
goto end;
@ -1552,9 +1550,7 @@ bool task_push_start_builtin_core(
/* Load content */
if (!task_load_content_callback(content_info, true, false))
{
#ifdef HAVE_MENU
rarch_ctl(RARCH_CTL_MENU_RUNNING, NULL);
#endif
rarch_menu_running();
return false;
}
@ -1603,7 +1599,7 @@ bool task_push_load_content_with_core_from_menu(
/* Load content */
if (!task_load_content_callback(content_info, true, false))
{
rarch_ctl(RARCH_CTL_MENU_RUNNING, NULL);
rarch_menu_running();
return false;
}

View File

@ -56,7 +56,7 @@ static void rarch_enable_ui(void)
runloop_ctl(RUNLOOP_CTL_SET_PAUSED, &boolean);
runloop_ctl(RUNLOOP_CTL_SET_IDLE, &boolean);
rarch_ctl(RARCH_CTL_MENU_RUNNING, NULL);
rarch_menu_running();
}
static void rarch_disable_ui(void)
@ -67,7 +67,7 @@ static void rarch_disable_ui(void)
runloop_ctl(RUNLOOP_CTL_SET_PAUSED, &boolean);
runloop_ctl(RUNLOOP_CTL_SET_IDLE, &boolean);
rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL);
rarch_menu_running_finished();
#ifdef HAVE_AVFOUNDATION
[[RetroArch_iOS get] supportOtherAudioSessions];
#endif