(Runloop) Use more flags

This commit is contained in:
LibretroAdmin 2022-10-10 19:54:54 +02:00
parent 2371e5cbd2
commit cc3a339011
8 changed files with 89 additions and 77 deletions

View File

@ -807,9 +807,9 @@ void audio_driver_sample(int16_t left, int16_t right)
recording_st->driver->push_audio(recording_st->data, &ffemu_data); recording_st->driver->push_audio(recording_st->data, &ffemu_data);
} }
if (!( runloop_st->paused if (!( (runloop_st->flags & RUNLOOP_FLAG_PAUSED)
|| !(audio_st->flags & AUDIO_FLAG_ACTIVE) || !(audio_st->flags & AUDIO_FLAG_ACTIVE)
|| !audio_st->output_samples_buf)) || !(audio_st->output_samples_buf)))
audio_driver_flush(audio_st, audio_driver_flush(audio_st,
config_get_ptr()->floats.slowmotion_ratio, config_get_ptr()->floats.slowmotion_ratio,
config_get_ptr()->bools.audio_fastforward_mute, config_get_ptr()->bools.audio_fastforward_mute,
@ -855,9 +855,9 @@ size_t audio_driver_sample_batch(const int16_t *data, size_t frames)
record_st->driver->push_audio(record_st->data, &ffemu_data); record_st->driver->push_audio(record_st->data, &ffemu_data);
} }
if (!( runloop_st->paused if (!( (runloop_st->flags & RUNLOOP_FLAG_PAUSED)
|| !(audio_st->flags & AUDIO_FLAG_ACTIVE) || !(audio_st->flags & AUDIO_FLAG_ACTIVE)
|| !audio_st->output_samples_buf)) || !(audio_st->output_samples_buf)))
audio_driver_flush(audio_st, audio_driver_flush(audio_st,
config_get_ptr()->floats.slowmotion_ratio, config_get_ptr()->floats.slowmotion_ratio,
config_get_ptr()->bools.audio_fastforward_mute, config_get_ptr()->bools.audio_fastforward_mute,
@ -1574,7 +1574,8 @@ bool audio_driver_disable_callback(void)
bool audio_driver_callback(void) bool audio_driver_callback(void)
{ {
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
bool runloop_paused = runloop_state_get_ptr()->paused; uint32_t runloop_flags = runloop_get_flags();
bool runloop_paused = runloop_flags & RUNLOOP_FLAG_PAUSED;
#ifdef HAVE_MENU #ifdef HAVE_MENU
#ifdef HAVE_NETWORKING #ifdef HAVE_NETWORKING
bool core_paused = runloop_paused || bool core_paused = runloop_paused ||
@ -1672,9 +1673,9 @@ void audio_driver_frame_is_reverse(void)
} }
if (!( if (!(
runloop_st->paused (runloop_st->flags & RUNLOOP_FLAG_PAUSED)
|| !(audio_st->flags & AUDIO_FLAG_ACTIVE) || !(audio_st->flags & AUDIO_FLAG_ACTIVE)
|| !audio_st->output_samples_buf)) || !(audio_st->output_samples_buf)))
if (!(audio_st->flags & AUDIO_FLAG_SUSPENDED)) if (!(audio_st->flags & AUDIO_FLAG_SUSPENDED))
{ {
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
@ -1825,7 +1826,7 @@ void audio_driver_menu_sample(void)
unsigned sample_count = (info->sample_rate / info->fps) * 2; unsigned sample_count = (info->sample_rate / info->fps) * 2;
audio_driver_state_t *audio_st = &audio_driver_st; audio_driver_state_t *audio_st = &audio_driver_st;
bool check_flush = !( bool check_flush = !(
(runloop_st->paused) (runloop_st->flags & RUNLOOP_FLAG_PAUSED)
|| !(audio_st->flags & AUDIO_FLAG_ACTIVE) || !(audio_st->flags & AUDIO_FLAG_ACTIVE)
|| !audio_st->output_samples_buf); || !audio_st->output_samples_buf);
if ((audio_st->flags & AUDIO_FLAG_SUSPENDED)) if ((audio_st->flags & AUDIO_FLAG_SUSPENDED))

View File

@ -814,7 +814,7 @@ bool command_get_status(command_t *cmd, const char* arg)
core_info_get_current_core(&core_info); core_info_get_current_core(&core_info);
if (runloop_st->paused) if (runloop_st->flags & RUNLOOP_FLAG_PAUSED)
status = "PAUSED"; status = "PAUSED";
if (core_info) if (core_info)
system_id = core_info->system_id; system_id = core_info->system_id;

View File

@ -2832,11 +2832,11 @@ VIDEO_FLAG_WIDGETS_FAST_FORWARD;
video_info->overlay_behind_menu = false; video_info->overlay_behind_menu = false;
#endif #endif
video_info->runloop_is_paused = runloop_st->paused; video_info->runloop_is_paused = runloop_st->flags & RUNLOOP_FLAG_PAUSED;
video_info->runloop_is_slowmotion = runloop_st->flags & RUNLOOP_FLAG_SLOWMOTION; video_info->runloop_is_slowmotion = runloop_st->flags & RUNLOOP_FLAG_SLOWMOTION;
video_info->fastforward_frameskip = settings->bools.fastforward_frameskip; video_info->fastforward_frameskip = settings->bools.fastforward_frameskip;
video_info->input_driver_nonblock_state = input_st ? video_info->input_driver_nonblock_state = input_st ?
(input_st->flags & INP_FLAG_NONBLOCKING) : false; (input_st->flags & INP_FLAG_NONBLOCKING) : false;
video_info->input_driver_grab_mouse_state = (input_st->flags & video_info->input_driver_grab_mouse_state = (input_st->flags &
INP_FLAG_GRAB_MOUSE_STATE); INP_FLAG_GRAB_MOUSE_STATE);
@ -3630,7 +3630,7 @@ void video_driver_frame(const void *data, unsigned width,
runloop_state_t *runloop_st = runloop_state_get_ptr(); runloop_state_t *runloop_st = runloop_state_get_ptr();
const enum retro_pixel_format const enum retro_pixel_format
video_driver_pix_fmt = video_st->pix_fmt; video_driver_pix_fmt = video_st->pix_fmt;
bool runloop_idle = runloop_st->idle; bool runloop_idle = runloop_st->flags & RUNLOOP_FLAG_IDLE;
bool video_driver_active = video_st->flags & VIDEO_FLAG_ACTIVE; bool video_driver_active = video_st->flags & VIDEO_FLAG_ACTIVE;
#if defined(HAVE_GFX_WIDGETS) #if defined(HAVE_GFX_WIDGETS)
dispgfx_widget_t *p_dispwidget = dispwidget_get_ptr(); dispgfx_widget_t *p_dispwidget = dispwidget_get_ptr();

View File

@ -1571,13 +1571,8 @@ bool command_event(enum event_command cmd, void *data)
if (ai_service_pause) if (ai_service_pause)
{ {
/* pause on call, unpause on second press. */ /* Unpause on second press */
if (!runloop_st->paused) if (runloop_st->flags & RUNLOOP_FLAG_PAUSED)
{
command_event(CMD_EVENT_PAUSE, NULL);
command_event(CMD_EVENT_AI_SERVICE_CALL, NULL);
}
else
{ {
#ifdef HAVE_ACCESSIBILITY #ifdef HAVE_ACCESSIBILITY
bool accessibility_enable = settings->bools.accessibility_enable; bool accessibility_enable = settings->bools.accessibility_enable;
@ -1592,6 +1587,11 @@ bool command_event(enum event_command cmd, void *data)
#endif #endif
command_event(CMD_EVENT_UNPAUSE, NULL); command_event(CMD_EVENT_UNPAUSE, NULL);
} }
else /* Pause on call */
{
command_event(CMD_EVENT_PAUSE, NULL);
command_event(CMD_EVENT_AI_SERVICE_CALL, NULL);
}
} }
else else
{ {
@ -2662,8 +2662,9 @@ bool command_event(enum event_command cmd, void *data)
break; break;
#endif #endif
boolean = runloop_st->paused; boolean = ((runloop_st->flags & RUNLOOP_FLAG_PAUSED) >
boolean = !boolean; 0);
boolean = !boolean;
#ifdef HAVE_ACCESSIBILITY #ifdef HAVE_ACCESSIBILITY
if (is_accessibility_enabled( if (is_accessibility_enabled(
@ -2683,7 +2684,10 @@ bool command_event(enum event_command cmd, void *data)
} }
#endif #endif
runloop_st->paused = boolean; if (boolean)
runloop_st->flags |= RUNLOOP_FLAG_PAUSED;
else
runloop_st->flags &= ~RUNLOOP_FLAG_PAUSED;
runloop_pause_checks(); runloop_pause_checks();
} }
break; break;
@ -2694,7 +2698,7 @@ bool command_event(enum event_command cmd, void *data)
#endif #endif
boolean = false; boolean = false;
runloop_st->paused = boolean; runloop_st->flags &= ~RUNLOOP_FLAG_PAUSED;
runloop_pause_checks(); runloop_pause_checks();
break; break;
case CMD_EVENT_PAUSE: case CMD_EVENT_PAUSE:
@ -2704,7 +2708,7 @@ bool command_event(enum event_command cmd, void *data)
#endif #endif
boolean = true; boolean = true;
runloop_st->paused = boolean; runloop_st->flags |= RUNLOOP_FLAG_PAUSED;
runloop_pause_checks(); runloop_pause_checks();
break; break;
case CMD_EVENT_MENU_PAUSE_LIBRETRO: case CMD_EVENT_MENU_PAUSE_LIBRETRO:
@ -3404,7 +3408,7 @@ bool command_event(enum event_command cmd, void *data)
else else
#endif #endif
{ {
bool paused = runloop_st->paused; bool paused = runloop_st->flags & RUNLOOP_FLAG_PAUSED;
if (data) if (data)
paused = *((bool*)data); paused = *((bool*)data);
@ -3917,9 +3921,9 @@ void emscripten_mainloop(void)
bool black_frame_insertion = settings->uints.video_black_frame_insertion; bool black_frame_insertion = settings->uints.video_black_frame_insertion;
bool input_driver_nonblock_state = input_st ? bool input_driver_nonblock_state = input_st ?
(input_st->flags & INP_FLAG_NONBLOCKING) : false; (input_st->flags & INP_FLAG_NONBLOCKING) : false;
runloop_state_t *runloop_st = runloop_state_get_ptr(); uint32_t runloop_flags = runloop_get_flags();
bool runloop_is_slowmotion = runloop_st->flags & RUNLOOP_FLAG_SLOWMOTION; bool runloop_is_slowmotion = runloop_flags & RUNLOOP_FLAG_SLOWMOTION;
bool runloop_is_paused = runloop_st->paused; bool runloop_is_paused = runloop_flags & RUNLOOP_FLAG_PAUSED;
RWebAudioRecalibrateTime(); RWebAudioRecalibrateTime();
@ -5798,13 +5802,13 @@ bool retroarch_ctl(enum rarch_ctl_state state, void *data)
{ {
input_driver_state_t *input_st = input_state_get_ptr(); input_driver_state_t *input_st = input_state_get_ptr();
runloop_st->perfcnt_enable = false; runloop_st->perfcnt_enable = false;
runloop_st->idle = false;
runloop_st->paused = false;
#ifdef HAVE_CONFIGFILE #ifdef HAVE_CONFIGFILE
runloop_st->flags &= ~RUNLOOP_FLAG_OVERRIDES_ACTIVE; runloop_st->flags &= ~RUNLOOP_FLAG_OVERRIDES_ACTIVE;
#endif #endif
runloop_st->flags &= ~(RUNLOOP_FLAG_AUTOSAVE runloop_st->flags &= ~(RUNLOOP_FLAG_AUTOSAVE
| RUNLOOP_FLAG_SLOWMOTION | RUNLOOP_FLAG_SLOWMOTION
| RUNLOOP_FLAG_IDLE
| RUNLOOP_FLAG_PAUSED
); );
runloop_frame_time_free(); runloop_frame_time_free();
runloop_audio_buffer_status_free(); runloop_audio_buffer_status_free();
@ -5817,13 +5821,16 @@ bool retroarch_ctl(enum rarch_ctl_state state, void *data)
} }
break; break;
case RARCH_CTL_IS_IDLE: case RARCH_CTL_IS_IDLE:
return runloop_st->idle; return ((runloop_st->flags & RUNLOOP_FLAG_IDLE) > 0);
case RARCH_CTL_SET_IDLE: case RARCH_CTL_SET_IDLE:
{ {
bool *ptr = (bool*)data; bool *ptr = (bool*)data;
if (!ptr) if (!ptr)
return false; return false;
runloop_st->idle = *ptr; if (*ptr)
runloop_st->flags |= RUNLOOP_FLAG_IDLE;
else
runloop_st->flags &= ~RUNLOOP_FLAG_IDLE;
} }
break; break;
case RARCH_CTL_SET_PAUSED: case RARCH_CTL_SET_PAUSED:
@ -5831,11 +5838,14 @@ bool retroarch_ctl(enum rarch_ctl_state state, void *data)
bool *ptr = (bool*)data; bool *ptr = (bool*)data;
if (!ptr) if (!ptr)
return false; return false;
runloop_st->paused = *ptr; if (*ptr)
runloop_st->flags |= RUNLOOP_FLAG_PAUSED;
else
runloop_st->flags &= ~RUNLOOP_FLAG_PAUSED;
} }
break; break;
case RARCH_CTL_IS_PAUSED: case RARCH_CTL_IS_PAUSED:
return runloop_st->paused; return ((runloop_st->flags & RUNLOOP_FLAG_PAUSED) > 0);
case RARCH_CTL_SET_SHUTDOWN: case RARCH_CTL_SET_SHUTDOWN:
runloop_st->flags |= RUNLOOP_FLAG_SHUTDOWN_INITIATED; runloop_st->flags |= RUNLOOP_FLAG_SHUTDOWN_INITIATED;
break; break;

View File

@ -3126,7 +3126,7 @@ bool runloop_environment_cb(unsigned cmd, void *data)
audio_state_get_ptr(); audio_state_get_ptr();
bool menu_opened = false; bool menu_opened = false;
bool core_paused = runloop_st->paused; bool core_paused = runloop_st->flags & RUNLOOP_FLAG_PAUSED;
bool no_audio = ((audio_st->flags & AUDIO_FLAG_SUSPENDED) bool no_audio = ((audio_st->flags & AUDIO_FLAG_SUSPENDED)
|| !(audio_st->flags & AUDIO_FLAG_ACTIVE)); || !(audio_st->flags & AUDIO_FLAG_ACTIVE));
float core_fps = (float)video_st->av_info.timing.fps; float core_fps = (float)video_st->av_info.timing.fps;
@ -5657,8 +5657,8 @@ void runloop_pause_checks(void)
presence_userdata_t userdata; presence_userdata_t userdata;
#endif #endif
runloop_state_t *runloop_st = &runloop_state; runloop_state_t *runloop_st = &runloop_state;
bool is_paused = runloop_st->paused; bool is_paused = runloop_st->flags & RUNLOOP_FLAG_PAUSED;
bool is_idle = runloop_st->idle; bool is_idle = runloop_st->flags & RUNLOOP_FLAG_IDLE;
#if defined(HAVE_GFX_WIDGETS) #if defined(HAVE_GFX_WIDGETS)
video_driver_state_t *video_st = video_state_get_ptr(); video_driver_state_t *video_st = video_state_get_ptr();
dispgfx_widget_t *p_dispwidget = dispwidget_get_ptr(); dispgfx_widget_t *p_dispwidget = dispwidget_get_ptr();
@ -6384,7 +6384,7 @@ static bool display_menu_libretro(
bool libretro_running, bool libretro_running,
retro_time_t current_time) retro_time_t current_time)
{ {
bool runloop_idle = runloop_st->idle; bool runloop_idle = runloop_st->flags & RUNLOOP_FLAG_IDLE;
video_driver_state_t*video_st = video_state_get_ptr(); video_driver_state_t*video_st = video_state_get_ptr();
if ( video_st->poke if ( video_st->poke
@ -6469,7 +6469,7 @@ static enum runloop_state_enum runloop_check_state(
uint64_t frame_count = 0; uint64_t frame_count = 0;
bool focused = true; bool focused = true;
bool rarch_is_initialized = runloop_st->is_inited; bool rarch_is_initialized = runloop_st->is_inited;
bool runloop_paused = runloop_st->paused; bool runloop_paused = runloop_st->flags & RUNLOOP_FLAG_PAUSED;
bool pause_nonactive = settings->bools.pause_nonactive; bool pause_nonactive = settings->bools.pause_nonactive;
unsigned quit_gamepad_combo = settings->uints.input_quit_gamepad_combo; unsigned quit_gamepad_combo = settings->uints.input_quit_gamepad_combo;
#ifdef HAVE_MENU #ifdef HAVE_MENU
@ -6586,11 +6586,14 @@ MENU_ST_FLAG_IS_BINDING;
/* Automatic mouse grab on focus */ /* Automatic mouse grab on focus */
if ( settings->bools.input_auto_mouse_grab if ( settings->bools.input_auto_mouse_grab
&& is_focused && (is_focused)
&& (is_focused != runloop_st->focused) && (is_focused != (((runloop_st->flags & RUNLOOP_FLAG_FOCUSED)) > 0))
&& !(input_st->flags & INP_FLAG_GRAB_MOUSE_STATE)) && !(input_st->flags & INP_FLAG_GRAB_MOUSE_STATE))
command_event(CMD_EVENT_GRAB_MOUSE_TOGGLE, NULL); command_event(CMD_EVENT_GRAB_MOUSE_TOGGLE, NULL);
runloop_st->focused = is_focused; if (is_focused)
runloop_st->flags |= RUNLOOP_FLAG_FOCUSED;
else
runloop_st->flags &= ~RUNLOOP_FLAG_FOCUSED;
#ifdef HAVE_OVERLAY #ifdef HAVE_OVERLAY
if (settings->bools.input_overlay_enable) if (settings->bools.input_overlay_enable)
@ -6959,7 +6962,7 @@ MENU_ST_FLAG_IS_BINDING;
retroarch_menu_running_finished(false); retroarch_menu_running_finished(false);
} }
if (focused || !runloop_st->idle) if (focused || !(runloop_st->flags & RUNLOOP_FLAG_IDLE))
{ {
bool runloop_is_inited = runloop_st->is_inited; bool runloop_is_inited = runloop_st->is_inited;
#ifdef HAVE_NETWORKING #ifdef HAVE_NETWORKING
@ -7004,11 +7007,11 @@ MENU_ST_FLAG_IS_BINDING;
menu->userdata, menu->userdata,
video_st->width, video_st->width,
video_st->height, video_st->height,
runloop_st->idle); runloop_st->flags & RUNLOOP_FLAG_IDLE);
} }
if ( (menu_st->flags & MENU_ST_FLAG_ALIVE) if ( (menu_st->flags & MENU_ST_FLAG_ALIVE)
&& !(runloop_st->idle)) && !(runloop_st->flags & RUNLOOP_FLAG_IDLE))
if (display_menu_libretro(runloop_st, input_st, if (display_menu_libretro(runloop_st, input_st,
settings->floats.slowmotion_ratio, settings->floats.slowmotion_ratio,
libretro_running, current_time)) libretro_running, current_time))
@ -7028,14 +7031,14 @@ MENU_ST_FLAG_IS_BINDING;
old_input = current_bits; old_input = current_bits;
old_action = action; old_action = action;
if (!focused || runloop_st->idle) if (!focused || (runloop_st->flags & RUNLOOP_FLAG_IDLE))
return RUNLOOP_STATE_POLLED_AND_SLEEP; return RUNLOOP_STATE_POLLED_AND_SLEEP;
} }
else else
#endif #endif
#endif #endif
{ {
if (runloop_st->idle) if (runloop_st->flags & RUNLOOP_FLAG_IDLE)
{ {
cbs->poll_cb(); cbs->poll_cb();
return RUNLOOP_STATE_POLLED_AND_SLEEP; return RUNLOOP_STATE_POLLED_AND_SLEEP;
@ -7203,8 +7206,10 @@ MENU_ST_FLAG_IS_BINDING;
{ {
static int unpaused_frames = 0; static int unpaused_frames = 0;
if (runloop_st->flags & RUNLOOP_FLAG_PAUSED)
unpaused_frames = 0;
else
/* Frame advance is not allowed when achievement hardcore is active */ /* Frame advance is not allowed when achievement hardcore is active */
if (!runloop_st->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)
@ -7213,8 +7218,6 @@ MENU_ST_FLAG_IS_BINDING;
pause_pressed = false; pause_pressed = false;
} }
} }
else
unpaused_frames = 0;
} }
else else
#endif #endif
@ -7223,7 +7226,7 @@ MENU_ST_FLAG_IS_BINDING;
trig_frameadvance = frameadvance_pressed && !old_frameadvance; trig_frameadvance = frameadvance_pressed && !old_frameadvance;
/* FRAMEADVANCE will set us into pause mode. */ /* FRAMEADVANCE will set us into pause mode. */
pause_pressed |= !runloop_st->paused pause_pressed |= (!(runloop_st->flags & RUNLOOP_FLAG_PAUSED))
&& trig_frameadvance; && trig_frameadvance;
} }
@ -7244,9 +7247,9 @@ MENU_ST_FLAG_IS_BINDING;
old_pause_pressed = pause_pressed; old_pause_pressed = pause_pressed;
old_frameadvance = frameadvance_pressed; old_frameadvance = frameadvance_pressed;
if (runloop_st->paused) if (runloop_st->flags & RUNLOOP_FLAG_PAUSED)
{ {
bool toggle = !runloop_st->idle ? true : false; bool toggle = (!(runloop_st->flags & RUNLOOP_FLAG_IDLE)) ? true : false;
HOTKEY_CHECK(RARCH_FULLSCREEN_TOGGLE_KEY, HOTKEY_CHECK(RARCH_FULLSCREEN_TOGGLE_KEY,
CMD_EVENT_FULLSCREEN_TOGGLE, true, &toggle); CMD_EVENT_FULLSCREEN_TOGGLE, true, &toggle);
@ -7451,7 +7454,7 @@ MENU_ST_FLAG_IS_BINDING;
&runloop_st->current_core, &runloop_st->current_core,
BIT256_GET(current_bits, RARCH_REWIND), BIT256_GET(current_bits, RARCH_REWIND),
settings->uints.rewind_granularity, settings->uints.rewind_granularity,
runloop_st->paused, runloop_st->flags & RUNLOOP_FLAG_PAUSED,
s, sizeof(s), &t); s, sizeof(s), &t);
#if defined(HAVE_GFX_WIDGETS) #if defined(HAVE_GFX_WIDGETS)
@ -7499,7 +7502,7 @@ MENU_ST_FLAG_IS_BINDING;
if (runloop_st->flags & RUNLOOP_FLAG_SLOWMOTION) if (runloop_st->flags & RUNLOOP_FLAG_SLOWMOTION)
{ {
if (settings->uints.video_black_frame_insertion) if (settings->uints.video_black_frame_insertion)
if (!runloop_st->idle) if (!(runloop_st->flags & RUNLOOP_FLAG_IDLE))
video_driver_cached_frame(); video_driver_cached_frame();
#if defined(HAVE_GFX_WIDGETS) #if defined(HAVE_GFX_WIDGETS)
@ -7669,10 +7672,10 @@ int runloop_iterate(void)
#else #else
bool menu_pause_libretro = settings->bools.menu_pause_libretro; bool menu_pause_libretro = settings->bools.menu_pause_libretro;
#endif #endif
bool core_paused = runloop_st->paused || bool core_paused = (runloop_st->flags &
(menu_pause_libretro && (menu_state_get_ptr()->flags & MENU_ST_FLAG_ALIVE)); RUNLOOP_FLAG_PAUSED) || (menu_pause_libretro && (menu_state_get_ptr()->flags & MENU_ST_FLAG_ALIVE));
#else #else
bool core_paused = runloop_st->paused; bool core_paused = (runloop_st->flags & RUNLOOP_FLAG_PAUSED);
#endif #endif
float slowmotion_ratio = settings->floats.slowmotion_ratio; float slowmotion_ratio = settings->floats.slowmotion_ratio;
#ifdef HAVE_CHEEVOS #ifdef HAVE_CHEEVOS
@ -7697,7 +7700,8 @@ int runloop_iterate(void)
* Limits frame time if fast forward ratio throttle is enabled. */ * Limits frame time if fast forward ratio throttle is enabled. */
retro_usec_t runloop_last_frame_time = runloop_st->frame_time_last; retro_usec_t runloop_last_frame_time = runloop_st->frame_time_last;
retro_time_t current = current_time; retro_time_t current = current_time;
bool is_locked_fps = (runloop_st->paused bool is_locked_fps = (
(runloop_st->flags & RUNLOOP_FLAG_PAUSED)
|| (input_st->flags & INP_FLAG_NONBLOCKING)) || (input_st->flags & INP_FLAG_NONBLOCKING))
| !!recording_st->data; | !!recording_st->data;
retro_time_t delta = (!runloop_last_frame_time || is_locked_fps) retro_time_t delta = (!runloop_last_frame_time || is_locked_fps)
@ -7726,7 +7730,7 @@ int runloop_iterate(void)
unsigned audio_buf_occupancy = 0; unsigned audio_buf_occupancy = 0;
bool audio_buf_underrun = false; bool audio_buf_underrun = false;
if (!( runloop_st->paused if (!( (runloop_st->flags & RUNLOOP_FLAG_PAUSED)
|| !(audio_st->flags & AUDIO_FLAG_ACTIVE) || !(audio_st->flags & AUDIO_FLAG_ACTIVE)
|| !(audio_st->output_samples_buf)) || !(audio_st->output_samples_buf))
&& audio_st->current_audio->write_avail && audio_st->current_audio->write_avail

View File

@ -159,7 +159,10 @@ enum runloop_flags
RUNLOOP_FLAG_RUNAHEAD_SECONDARY_CORE_AVAILABLE = (1 << 23), RUNLOOP_FLAG_RUNAHEAD_SECONDARY_CORE_AVAILABLE = (1 << 23),
RUNLOOP_FLAG_RUNAHEAD_FORCE_INPUT_DIRTY = (1 << 24), RUNLOOP_FLAG_RUNAHEAD_FORCE_INPUT_DIRTY = (1 << 24),
RUNLOOP_FLAG_SLOWMOTION = (1 << 25), RUNLOOP_FLAG_SLOWMOTION = (1 << 25),
RUNLOOP_FLAG_FASTMOTION = (1 << 26) RUNLOOP_FLAG_FASTMOTION = (1 << 26),
RUNLOOP_FLAG_PAUSED = (1 << 27),
RUNLOOP_FLAG_IDLE = (1 << 28),
RUNLOOP_FLAG_FOCUSED = (1 << 29)
}; };
struct runloop struct runloop
@ -296,9 +299,6 @@ struct runloop
bool is_inited; bool is_inited;
bool missing_bios; bool missing_bios;
bool force_nonblock; bool force_nonblock;
bool paused;
bool idle;
bool focused;
bool perfcnt_enable; bool perfcnt_enable;
}; };

View File

@ -545,7 +545,7 @@ bool take_screenshot(
bool savestate, bool has_valid_framebuffer, bool savestate, bool has_valid_framebuffer,
bool fullpath, bool use_thread) bool fullpath, bool use_thread)
{ {
runloop_state_t *runloop_st = runloop_state_get_ptr(); uint32_t runloop_flags = runloop_get_flags();
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
bool video_gpu_screenshot = settings->bools.video_gpu_screenshot; bool video_gpu_screenshot = settings->bools.video_gpu_screenshot;
bool is_paused = false; bool is_paused = false;
@ -557,13 +557,10 @@ bool take_screenshot(
/* Avoid GPU screenshots with savestates */ /* Avoid GPU screenshots with savestates */
if (supports_viewport_read && video_gpu_screenshot && !savestate) if (supports_viewport_read && video_gpu_screenshot && !savestate)
prefer_viewport_read = true; prefer_viewport_read = true;
if (runloop_st) is_paused = runloop_flags & RUNLOOP_FLAG_PAUSED;
{ is_idle = runloop_flags & RUNLOOP_FLAG_IDLE;
is_paused = runloop_st->paused;
is_idle = runloop_st->idle;
}
/* No way to infer screenshot directory. */ /* No way to infer screenshot directory. */
if ( string_is_empty(screenshot_dir) if ( string_is_empty(screenshot_dir)

View File

@ -53,7 +53,7 @@
static void task_auto_translate_handler(retro_task_t *task) static void task_auto_translate_handler(retro_task_t *task)
{ {
int *mode_ptr = (int*)task->user_data; int *mode_ptr = (int*)task->user_data;
runloop_state_t *runloop_st = runloop_state_get_ptr(); uint32_t runloop_flags = runloop_get_flags();
access_state_t *access_st = access_state_get_ptr(); access_state_t *access_st = access_state_get_ptr();
#ifdef HAVE_ACCESSIBILITY #ifdef HAVE_ACCESSIBILITY
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
@ -91,7 +91,7 @@ task_finished:
if (*mode_ptr == 1 || *mode_ptr == 2) if (*mode_ptr == 1 || *mode_ptr == 2)
{ {
bool was_paused = runloop_st->paused; bool was_paused = runloop_flags & RUNLOOP_FLAG_PAUSED;
command_event(CMD_EVENT_AI_SERVICE_CALL, &was_paused); command_event(CMD_EVENT_AI_SERVICE_CALL, &was_paused);
} }
if (task->user_data) if (task->user_data)
@ -157,11 +157,11 @@ static void handle_translation_cb(
char* auto_string = NULL; char* auto_string = NULL;
char* key_string = NULL; char* key_string = NULL;
settings_t* settings = config_get_ptr(); settings_t* settings = config_get_ptr();
runloop_state_t *runloop_st = runloop_state_get_ptr(); uint32_t runloop_flags = runloop_get_flags();
#ifdef HAVE_ACCESSIBILITY #ifdef HAVE_ACCESSIBILITY
input_driver_state_t *input_st = input_state_get_ptr(); input_driver_state_t *input_st = input_state_get_ptr();
#endif #endif
bool was_paused = runloop_st->paused; bool was_paused = runloop_flags & RUNLOOP_FLAG_PAUSED;
video_driver_state_t video_driver_state_t
*video_st = video_state_get_ptr(); *video_st = video_state_get_ptr();
const enum retro_pixel_format const enum retro_pixel_format