Skip to content

Commit fbf5d9b

Browse files
committed
Only allow pausing when there is an active core
1 parent 1ad5896 commit fbf5d9b

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

retroarch.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4236,6 +4236,9 @@ 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+
command_event(CMD_EVENT_UNPAUSE, NULL);
42394242

42404243
/* Save auto state */
42414244
if ( runloop_st
@@ -4736,21 +4739,19 @@ bool command_event(enum event_command cmd, void *data)
47364739
break;
47374740
case CMD_EVENT_PAUSE_TOGGLE:
47384741
{
4739-
bool paused = (runloop_st->flags & RUNLOOP_FLAG_PAUSED) ? true : false;
4742+
/* Allow pause toggling only when there is an active core. */
4743+
bool paused = !((runloop_st->flags & RUNLOOP_FLAG_PAUSED) ? true : false) &&
4744+
(runloop_st->flags & RUNLOOP_FLAG_CORE_RUNNING) ? true : false;
47404745
#ifdef HAVE_ACCESSIBILITY
47414746
bool accessibility_enable
47424747
= settings->bools.accessibility_enable;
47434748
unsigned accessibility_narrator_speech_speed
47444749
= settings->uints.accessibility_narrator_speech_speed;
47454750
#endif
4746-
47474751
#ifdef HAVE_NETWORKING
47484752
if (!netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_PAUSE, NULL))
47494753
break;
47504754
#endif
4751-
4752-
paused = !paused;
4753-
47544755
#ifdef HAVE_ACCESSIBILITY
47554756
if (is_accessibility_enabled(
47564757
accessibility_enable,
@@ -4788,7 +4789,9 @@ bool command_event(enum event_command cmd, void *data)
47884789
if (!netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_PAUSE, NULL))
47894790
break;
47904791
#endif
4791-
runloop_st->flags |= RUNLOOP_FLAG_PAUSED;
4792+
/* Allow pausing only when there is an active core. */
4793+
if ((runloop_st->flags & RUNLOOP_FLAG_CORE_RUNNING) ? true : false)
4794+
runloop_st->flags |= RUNLOOP_FLAG_PAUSED;
47924795
runloop_pause_checks();
47934796
break;
47944797
case CMD_EVENT_MENU_PAUSE_LIBRETRO:

0 commit comments

Comments
 (0)