Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion retroarch.c
Original file line number Diff line number Diff line change
Expand Up @@ -4232,6 +4232,10 @@ bool command_event(enum event_command cmd, void *data)
video_driver_state_t
*video_st = video_state_get_ptr();
rarch_system_info_t *sys_info = &runloop_st->system;

/* Restore unpaused state */
runloop_st->paused_hotkey = false;
command_event(CMD_EVENT_UNPAUSE, NULL);

/* The platform that uses ram_state_save calls it when the content
* ends and writes it to a file */
Expand Down Expand Up @@ -4743,7 +4747,9 @@ bool command_event(enum event_command cmd, void *data)
unsigned accessibility_narrator_speech_speed
= settings->uints.accessibility_narrator_speech_speed;
#endif

/* Allow pause toggling only when there is an active core. */
if (!(runloop_st->flags & RUNLOOP_FLAG_CORE_RUNNING))
break;
#ifdef HAVE_NETWORKING
if (!netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_PAUSE, NULL))
break;
Expand Down Expand Up @@ -4784,6 +4790,9 @@ bool command_event(enum event_command cmd, void *data)
runloop_pause_checks();
break;
case CMD_EVENT_PAUSE:
/* Allow pausing only when there is an active core. */
if (!(runloop_st->flags & RUNLOOP_FLAG_CORE_RUNNING))
break;
#ifdef HAVE_NETWORKING
if (!netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_PAUSE, NULL))
break;
Expand Down
12 changes: 5 additions & 7 deletions runloop.c
Original file line number Diff line number Diff line change
Expand Up @@ -5539,7 +5539,6 @@ static bool display_menu_libretro(
}

static void runloop_pause_toggle(
bool *runloop_paused_hotkey,
bool pause_pressed, bool old_pause_pressed,
bool focused, bool old_focus)
{
Expand All @@ -5551,7 +5550,7 @@ static void runloop_pause_toggle(
{
/* Keep track of hotkey triggered pause to
* distinguish it from menu triggered pause */
*runloop_paused_hotkey = !(runloop_st->flags & RUNLOOP_FLAG_PAUSED);
runloop_st->paused_hotkey = !(runloop_st->flags & RUNLOOP_FLAG_PAUSED);
command_event(CMD_EVENT_PAUSE_TOGGLE, NULL);
}
else if (!old_focus)
Expand Down Expand Up @@ -5587,7 +5586,6 @@ static enum runloop_state_enum runloop_check_state(
gfx_display_t *p_disp = disp_get_ptr();
runloop_state_t *runloop_st = &runloop_state;
static bool old_focus = true;
static bool runloop_paused_hotkey = false;
struct retro_callbacks *cbs = &runloop_st->retro_ctx;
bool is_focused = false;
bool is_alive = false;
Expand Down Expand Up @@ -5669,10 +5667,10 @@ static enum runloop_state_enum runloop_check_state(
{
BIT256_CLEAR_ALL(current_bits);
if ( runloop_paused
&& !runloop_paused_hotkey
&& !runloop_st->paused_hotkey
&& menu_pause_libretro)
BIT256_SET(current_bits, RARCH_PAUSE_TOGGLE);
else if (runloop_paused_hotkey)
else if (runloop_st->paused_hotkey)
{
/* Restore pause if pause is triggered with both hotkey and menu,
* and restore cached video frame to continue properly to
Expand Down Expand Up @@ -6518,7 +6516,7 @@ static enum runloop_state_enum runloop_check_state(
bool pause_pressed = BIT256_GET(current_bits, RARCH_PAUSE_TOGGLE);

/* Decide pause hotkey */
runloop_pause_toggle(&runloop_paused_hotkey,
runloop_pause_toggle(
pause_pressed, old_pause_pressed,
focused, old_focus);

Expand Down Expand Up @@ -6595,7 +6593,7 @@ static enum runloop_state_enum runloop_check_state(
}

/* Decide pause hotkey */
runloop_pause_toggle(&runloop_paused_hotkey,
runloop_pause_toggle(
pause_pressed, old_pause_pressed,
focused, old_focus);

Expand Down
1 change: 1 addition & 0 deletions runloop.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ struct runloop
} name;

bool perfcnt_enable;
bool paused_hotkey;
};

typedef struct runloop runloop_state_t;
Expand Down
Loading