Simplify pause button handling in runloop_check_state

This commit is contained in:
twinaphex 2021-03-07 18:38:33 +01:00
parent 681c5f0b2b
commit e7702ae20f
1 changed files with 7 additions and 12 deletions

View File

@ -37485,35 +37485,30 @@ static enum runloop_state runloop_check_state(
{ {
static bool old_frameadvance = false; static bool old_frameadvance = false;
static bool old_pause_pressed = false; static bool old_pause_pressed = false;
bool pause_pressed, frameadvance_pressed, trig_frameadvance; bool frameadvance_pressed = false;
bool trig_frameadvance = false;
bool pause_pressed = BIT256_GET(current_bits, RARCH_PAUSE_TOGGLE);
#ifdef HAVE_CHEEVOS #ifdef HAVE_CHEEVOS
if (cheevos_hardcore_active) if (cheevos_hardcore_active)
{ {
static int unpaused_frames = 0; static int unpaused_frames = 0;
/* frame advance is not allowed when achievement hardcore is active */ /* Frame advance is not allowed when achievement hardcore is active */
frameadvance_pressed = false;
trig_frameadvance = false;
pause_pressed = BIT256_GET(current_bits, RARCH_PAUSE_TOGGLE);
if (!p_rarch->runloop_paused) if (!p_rarch->runloop_paused)
{ {
/* limit pause to approximately three times per second (depending on core framerate) */ /* Limit pause to approximately three times per second (depending on core framerate) */
if (unpaused_frames < 20) if (unpaused_frames < 20)
{ {
++unpaused_frames; ++unpaused_frames;
pause_pressed = false; pause_pressed = false;
} }
} }
else else
unpaused_frames = 0; unpaused_frames = 0;
} }
else else
#endif #endif
{ {
pause_pressed = BIT256_GET(current_bits, RARCH_PAUSE_TOGGLE);
frameadvance_pressed = BIT256_GET(current_bits, RARCH_FRAMEADVANCE); frameadvance_pressed = BIT256_GET(current_bits, RARCH_FRAMEADVANCE);
trig_frameadvance = frameadvance_pressed && !old_frameadvance; trig_frameadvance = frameadvance_pressed && !old_frameadvance;