Cache menu_driver_is_alive function call

This commit is contained in:
twinaphex 2017-05-17 08:47:23 +02:00
parent ffac0c119e
commit 54c526f1e2

View File

@ -2265,6 +2265,11 @@ static enum runloop_state runloop_check_state(
uint64_t frame_count = 0; uint64_t frame_count = 0;
bool focused = true; bool focused = true;
bool pause_pressed = runloop_cmd_triggered(trigger_input, RARCH_PAUSE_TOGGLE); bool pause_pressed = runloop_cmd_triggered(trigger_input, RARCH_PAUSE_TOGGLE);
#ifdef HAVE_MENU
bool menu_is_alive = menu_driver_is_alive();
#else
bool menu_is_alive = false;
#endif
video_driver_get_status(&frame_count, &is_alive, &is_focused); video_driver_get_status(&frame_count, &is_alive, &is_focused);
@ -2273,11 +2278,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
|| menu_driver_is_alive();
#endif
;
if (fullscreen_toggled) if (fullscreen_toggled)
command_event(CMD_EVENT_FULLSCREEN_TOGGLE, NULL); command_event(CMD_EVENT_FULLSCREEN_TOGGLE, NULL);
@ -2335,7 +2336,7 @@ static enum runloop_state runloop_check_state(
} }
#ifdef HAVE_MENU #ifdef HAVE_MENU
if (menu_driver_is_alive()) if (menu_is_alive)
{ {
menu_ctx_iterate_t iter; menu_ctx_iterate_t iter;
core_poll(); core_poll();
@ -2375,7 +2376,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_is_alive()) if (menu_is_alive)
{ {
if (rarch_is_inited && (current_core_type != CORE_TYPE_DUMMY)) if (rarch_is_inited && (current_core_type != CORE_TYPE_DUMMY))
{ {
@ -2388,7 +2389,7 @@ static enum runloop_state runloop_check_state(
runloop_cmd_triggered(trigger_input, RARCH_MENU_TOGGLE)) || runloop_cmd_triggered(trigger_input, RARCH_MENU_TOGGLE)) ||
(current_core_type == CORE_TYPE_DUMMY)) (current_core_type == CORE_TYPE_DUMMY))
{ {
if (menu_driver_is_alive()) if (menu_is_alive)
{ {
if (rarch_is_inited && (current_core_type != CORE_TYPE_DUMMY)) if (rarch_is_inited && (current_core_type != CORE_TYPE_DUMMY))
rarch_menu_running_finished(); rarch_menu_running_finished();
@ -2402,7 +2403,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_is_alive()) if (menu_is_alive)
{ {
if (!settings->bools.menu_throttle_framerate && !settings->floats.fastforward_ratio) if (!settings->bools.menu_throttle_framerate && !settings->floats.fastforward_ratio)
return RUNLOOP_STATE_MENU_ITERATE; return RUNLOOP_STATE_MENU_ITERATE;