Skip to content

Commit b2790ca

Browse files
authored
Prevent stale menu state in runloop check (#15698)
1 parent 72841d6 commit b2790ca

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

runloop.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5776,13 +5776,16 @@ static enum runloop_state_enum runloop_check_state(
57765776
if ( (pressed && !old_pressed)
57775777
|| core_type_is_dummy)
57785778
{
5779-
if (menu_st->flags & MENU_ST_FLAG_ALIVE)
5779+
if (menu_is_alive)
57805780
{
57815781
if (rarch_is_initialized && !core_type_is_dummy)
57825782
retroarch_menu_running_finished(false);
57835783
}
57845784
else
57855785
retroarch_menu_running();
5786+
5787+
/* Update menu state if it has changed */
5788+
menu_is_alive = (menu_st->flags & MENU_ST_FLAG_ALIVE) ? true : false;
57865789
}
57875790

57885791
old_pressed = pressed;
@@ -5992,7 +5995,7 @@ static enum runloop_state_enum runloop_check_state(
59925995
(runloop_st->flags & RUNLOOP_FLAG_IDLE) ? true : false);
59935996
}
59945997

5995-
if ( (menu_st->flags & MENU_ST_FLAG_ALIVE)
5998+
if ( (menu_is_alive)
59965999
&& !(runloop_st->flags & RUNLOOP_FLAG_IDLE))
59976000
if (display_menu_libretro(runloop_st, input_st,
59986001
settings->floats.slowmotion_ratio,
@@ -6039,7 +6042,6 @@ static enum runloop_state_enum runloop_check_state(
60396042
/* Check close content hotkey */
60406043
HOTKEY_CHECK(RARCH_CLOSE_CONTENT_KEY, CMD_EVENT_CLOSE_CONTENT, true, NULL);
60416044

6042-
60436045
/* Check FPS hotkey */
60446046
HOTKEY_CHECK(RARCH_FPS_TOGGLE, CMD_EVENT_FPS_TOGGLE, true, NULL);
60456047

@@ -6114,7 +6116,7 @@ static enum runloop_state_enum runloop_check_state(
61146116

61156117
#ifdef HAVE_MENU
61166118
/* Don't allow rewinding while menu is active */
6117-
if (menu_st->flags & MENU_ST_FLAG_ALIVE)
6119+
if (menu_is_alive)
61186120
rewind_pressed = false;
61196121
#endif
61206122

@@ -6135,7 +6137,7 @@ static enum runloop_state_enum runloop_check_state(
61356137
settings->uints.rewind_granularity,
61366138
runloop_paused
61376139
#ifdef HAVE_MENU
6138-
|| ( (menu_st->flags & MENU_ST_FLAG_ALIVE)
6140+
|| ( (menu_is_alive)
61396141
&& settings->bools.menu_pause_libretro)
61406142
#endif
61416143
,
@@ -6161,7 +6163,7 @@ static enum runloop_state_enum runloop_check_state(
61616163

61626164
if (rewinding && runloop_paused
61636165
#ifdef HAVE_MENU
6164-
&& !(menu_st->flags & MENU_ST_FLAG_ALIVE)
6166+
&& !(menu_is_alive)
61656167
#endif
61666168
)
61676169
{
@@ -6181,7 +6183,7 @@ static enum runloop_state_enum runloop_check_state(
61816183

61826184
/* Check pause hotkey in menu */
61836185
#ifdef HAVE_MENU
6184-
if (menu_st->flags & MENU_ST_FLAG_ALIVE)
6186+
if (menu_is_alive)
61856187
{
61866188
static bool old_pause_pressed = false;
61876189
bool pause_pressed = BIT256_GET(current_bits, RARCH_PAUSE_TOGGLE);
@@ -6198,7 +6200,7 @@ static enum runloop_state_enum runloop_check_state(
61986200

61996201
#ifdef HAVE_MENU
62006202
/* Stop checking the rest of the hotkeys if menu is alive */
6201-
if (menu_st->flags & MENU_ST_FLAG_ALIVE)
6203+
if (menu_is_alive)
62026204
{
62036205
float fastforward_ratio = runloop_get_fastforward_ratio(settings,
62046206
&runloop_st->fastmotion_override.current);

0 commit comments

Comments
 (0)