Skip to content

Commit 09a4aef

Browse files
committed
Only allow pausing when there is an active core
Revert "Only allow pausing when there is an active core" This reverts commit fbf5d9b. Stash Only allow pausing when there is an active core
1 parent 1ad5896 commit 09a4aef

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

retroarch.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4236,6 +4236,10 @@ bool command_event(enum event_command cmd, void *data)
42364236
/* The platform that uses ram_state_save calls it when the content
42374237
* ends and writes it to a file */
42384238
ram_state_to_file();
4239+
4240+
/* Restore unpaused state */
4241+
runloop_st->paused_hotkey = false;
4242+
command_event(CMD_EVENT_UNPAUSE, NULL);
42394243

42404244
/* Save auto state */
42414245
if ( runloop_st
@@ -4736,6 +4740,10 @@ bool command_event(enum event_command cmd, void *data)
47364740
break;
47374741
case CMD_EVENT_PAUSE_TOGGLE:
47384742
{
4743+
/* Allow pause toggling only when there is an active core. */
4744+
if (!(runloop_st->flags & RUNLOOP_FLAG_CORE_RUNNING))
4745+
break;
4746+
47394747
bool paused = (runloop_st->flags & RUNLOOP_FLAG_PAUSED) ? true : false;
47404748
#ifdef HAVE_ACCESSIBILITY
47414749
bool accessibility_enable
@@ -4784,6 +4792,9 @@ bool command_event(enum event_command cmd, void *data)
47844792
runloop_pause_checks();
47854793
break;
47864794
case CMD_EVENT_PAUSE:
4795+
/* Allow pausing only when there is an active core. */
4796+
if (!(runloop_st->flags & RUNLOOP_FLAG_CORE_RUNNING))
4797+
break;
47874798
#ifdef HAVE_NETWORKING
47884799
if (!netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_PAUSE, NULL))
47894800
break;

runloop.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5587,7 +5587,6 @@ static enum runloop_state_enum runloop_check_state(
55875587
gfx_display_t *p_disp = disp_get_ptr();
55885588
runloop_state_t *runloop_st = &runloop_state;
55895589
static bool old_focus = true;
5590-
static bool runloop_paused_hotkey = false;
55915590
struct retro_callbacks *cbs = &runloop_st->retro_ctx;
55925591
bool is_focused = false;
55935592
bool is_alive = false;
@@ -5669,10 +5668,10 @@ static enum runloop_state_enum runloop_check_state(
56695668
{
56705669
BIT256_CLEAR_ALL(current_bits);
56715670
if ( runloop_paused
5672-
&& !runloop_paused_hotkey
5671+
&& !runloop_st->paused_hotkey
56735672
&& menu_pause_libretro)
56745673
BIT256_SET(current_bits, RARCH_PAUSE_TOGGLE);
5675-
else if (runloop_paused_hotkey)
5674+
else if (runloop_st->paused_hotkey)
56765675
{
56775676
/* Restore pause if pause is triggered with both hotkey and menu,
56785677
* and restore cached video frame to continue properly to
@@ -6518,7 +6517,7 @@ static enum runloop_state_enum runloop_check_state(
65186517
bool pause_pressed = BIT256_GET(current_bits, RARCH_PAUSE_TOGGLE);
65196518

65206519
/* Decide pause hotkey */
6521-
runloop_pause_toggle(&runloop_paused_hotkey,
6520+
runloop_pause_toggle(&runloop_st->paused_hotkey,
65226521
pause_pressed, old_pause_pressed,
65236522
focused, old_focus);
65246523

@@ -6595,7 +6594,7 @@ static enum runloop_state_enum runloop_check_state(
65956594
}
65966595

65976596
/* Decide pause hotkey */
6598-
runloop_pause_toggle(&runloop_paused_hotkey,
6597+
runloop_pause_toggle(&runloop_st->paused_hotkey,
65996598
pause_pressed, old_pause_pressed,
66006599
focused, old_focus);
66016600

runloop.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ struct runloop
300300
} name;
301301

302302
bool perfcnt_enable;
303+
bool paused_hotkey;
303304
};
304305

305306
typedef struct runloop runloop_state_t;

0 commit comments

Comments
 (0)