Optimize fastforwarding runtime check - menu widgets function

was being called every frame unnecessarily
This commit is contained in:
twinaphex 2019-08-10 06:25:50 +02:00
parent 60932b18ad
commit 1de946a1b7
1 changed files with 21 additions and 14 deletions

View File

@ -22901,6 +22901,25 @@ static bool menu_display_libretro(void)
}
#endif
static void update_fastforwarding_state(void)
{
/* Display the fast forward state to the user, if needed. */
if (runloop_fastmotion)
{
#if defined(HAVE_MENU) && defined(HAVE_MENU_WIDGETS)
if (!menu_widgets_set_fast_forward(true))
#endif
runloop_msg_queue_push(
msg_hash_to_str(MSG_FAST_FORWARD), 1, 1, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
#if defined(HAVE_MENU) && defined(HAVE_MENU_WIDGETS)
else
{
menu_widgets_set_fast_forward(false);
}
#endif
}
static enum runloop_state runloop_check_state(
settings_t *settings,
bool input_nonblock_state,
@ -23515,6 +23534,7 @@ static enum runloop_state runloop_check_state(
runloop_fastmotion = true;
}
driver_set_nonblock_state();
update_fastforwarding_state();
}
else if (old_hold_button_state != new_hold_button_state)
{
@ -23530,22 +23550,9 @@ static enum runloop_state runloop_check_state(
fastforward_after_frames = 1;
}
driver_set_nonblock_state();
update_fastforwarding_state();
}
/* Display the fast forward state to the user, if needed. */
if (runloop_fastmotion)
{
#if defined(HAVE_MENU) && defined(HAVE_MENU_WIDGETS)
if (!menu_widgets_set_fast_forward(true))
#endif
runloop_msg_queue_push(
msg_hash_to_str(MSG_FAST_FORWARD), 1, 1, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
#if defined(HAVE_MENU) && defined(HAVE_MENU_WIDGETS)
else
menu_widgets_set_fast_forward(false);
#endif
old_button_state = new_button_state;
old_hold_button_state = new_hold_button_state;
}