Do only one call to RARCH_MENU_CTL_IS_ALIVE

This commit is contained in:
twinaphex 2017-01-22 17:25:32 +01:00
parent e33f38d5b2
commit 73e621ad32

View File

@ -689,6 +689,7 @@ static enum runloop_state runloop_check_state(
uint64_t current_input, uint64_t current_input,
uint64_t old_input, uint64_t old_input,
uint64_t trigger_input, uint64_t trigger_input,
bool menu_is_alive,
unsigned *sleep_ms) unsigned *sleep_ms)
{ {
static bool old_focus = true; static bool old_focus = true;
@ -706,11 +707,7 @@ static enum runloop_state runloop_check_state(
if (runloop_cmd_triggered(trigger_input, RARCH_FULLSCREEN_TOGGLE_KEY)) if (runloop_cmd_triggered(trigger_input, RARCH_FULLSCREEN_TOGGLE_KEY))
{ {
bool fullscreen_toggled = !runloop_paused; bool fullscreen_toggled = !runloop_paused || menu_is_alive;
#ifdef HAVE_MENU
fullscreen_toggled = fullscreen_toggled ||
menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL);
#endif
if (fullscreen_toggled) if (fullscreen_toggled)
command_event(CMD_EVENT_FULLSCREEN_TOGGLE, NULL); command_event(CMD_EVENT_FULLSCREEN_TOGGLE, NULL);
@ -761,7 +758,7 @@ static enum runloop_state runloop_check_state(
} }
#ifdef HAVE_MENU #ifdef HAVE_MENU
if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)) if (menu_is_alive)
{ {
menu_ctx_iterate_t iter; menu_ctx_iterate_t iter;
core_poll(); core_poll();
@ -798,7 +795,7 @@ static enum runloop_state runloop_check_state(
#ifdef HAVE_MENU #ifdef HAVE_MENU
if (menu_event_kb_is_set(RETROK_F1) == 1) if (menu_event_kb_is_set(RETROK_F1) == 1)
{ {
if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)) if (menu_is_alive)
{ {
if (rarch_ctl(RARCH_CTL_IS_INITED, NULL) && if (rarch_ctl(RARCH_CTL_IS_INITED, NULL) &&
!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) !rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
@ -812,7 +809,7 @@ static enum runloop_state runloop_check_state(
runloop_cmd_triggered(trigger_input, RARCH_MENU_TOGGLE)) || runloop_cmd_triggered(trigger_input, RARCH_MENU_TOGGLE)) ||
rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
{ {
if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)) if (menu_is_alive)
{ {
if (rarch_ctl(RARCH_CTL_IS_INITED, NULL) && if (rarch_ctl(RARCH_CTL_IS_INITED, NULL) &&
!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) !rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
@ -827,7 +824,7 @@ static enum runloop_state runloop_check_state(
else else
menu_event_kb_set(false, RETROK_F1); menu_event_kb_set(false, RETROK_F1);
if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)) if (menu_is_alive)
{ {
if (!settings->menu.throttle_framerate && !settings->fastforward_ratio) if (!settings->menu.throttle_framerate && !settings->fastforward_ratio)
return RUNLOOP_STATE_MENU_ITERATE; return RUNLOOP_STATE_MENU_ITERATE;
@ -1046,10 +1043,15 @@ int runloop_iterate(unsigned *sleep_ms)
static uint64_t last_input = 0; static uint64_t last_input = 0;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
uint64_t old_input = last_input; uint64_t old_input = last_input;
#ifdef HAVE_MENU
bool menu_is_alive = menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL);
#else
bool menu_is_alive = false;
#endif
uint64_t current_input = uint64_t current_input =
#ifdef HAVE_MENU #ifdef HAVE_MENU
menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL) ? menu_is_alive ?
input_menu_keys_pressed(old_input, input_menu_keys_pressed(old_input,
&last_input, &trigger_input, runloop_paused) : &last_input, &trigger_input, runloop_paused) :
#endif #endif
@ -1088,6 +1090,7 @@ int runloop_iterate(unsigned *sleep_ms)
current_input, current_input,
old_input, old_input,
trigger_input, trigger_input,
menu_is_alive,
sleep_ms)) sleep_ms))
{ {
case RUNLOOP_STATE_QUIT: case RUNLOOP_STATE_QUIT: