mirror of
https://github.com/libretro/RetroArch
synced 2025-03-30 07:20:36 +00:00
Simplify RUNLOOP_CTL_IS_SLOWMOTION
This commit is contained in:
parent
6fbad68561
commit
34f3963e4e
@ -483,7 +483,6 @@ void audio_driver_set_nonblocking_state(bool enable)
|
||||
**/
|
||||
static bool audio_driver_flush(const int16_t *data, size_t samples)
|
||||
{
|
||||
bool is_slowmotion;
|
||||
static struct retro_perf_counter audio_convert_s16 = {0};
|
||||
static struct retro_perf_counter audio_convert_float = {0};
|
||||
static struct retro_perf_counter audio_dsp = {0};
|
||||
@ -536,9 +535,7 @@ static bool audio_driver_flush(const int16_t *data, size_t samples)
|
||||
|
||||
src_data.ratio = audio_driver_data.src_ratio;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_IS_SLOWMOTION, &is_slowmotion);
|
||||
|
||||
if (is_slowmotion)
|
||||
if (runloop_ctl(RUNLOOP_CTL_IS_SLOWMOTION, NULL))
|
||||
src_data.ratio *= settings->slowmotion_ratio;
|
||||
|
||||
audio_driver_ctl(RARCH_AUDIO_CTL_RESAMPLER_PROCESS, &src_data);
|
||||
|
@ -1808,7 +1808,6 @@ static bool gl_frame(void *data, const void *frame,
|
||||
video_shader_ctx_mvp_t mvp;
|
||||
video_shader_ctx_coords_t coords;
|
||||
video_shader_ctx_params_t params;
|
||||
bool is_slowmotion;
|
||||
unsigned width, height;
|
||||
struct gfx_tex_info feedback_info;
|
||||
video_shader_ctx_info_t shader_info;
|
||||
@ -2047,14 +2046,13 @@ static bool gl_frame(void *data, const void *frame,
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
runloop_ctl(RUNLOOP_CTL_IS_SLOWMOTION, &is_slowmotion);
|
||||
|
||||
/* Disable BFI during fast forward, slow-motion,
|
||||
* and pause to prevent flicker. */
|
||||
if (
|
||||
settings->video.black_frame_insertion
|
||||
&& !input_driver_ctl(RARCH_INPUT_CTL_IS_NONBLOCK_STATE, NULL)
|
||||
&& !is_slowmotion
|
||||
&& !runloop_ctl(RUNLOOP_CTL_IS_SLOWMOTION, NULL)
|
||||
&& !runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL))
|
||||
{
|
||||
gfx_ctx_ctl(GFX_CTL_SWAP_BUFFERS, NULL);
|
||||
|
12
runloop.c
12
runloop.c
@ -873,13 +873,7 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
|
||||
}
|
||||
break;
|
||||
case RUNLOOP_CTL_IS_SLOWMOTION:
|
||||
{
|
||||
bool *ptr = (bool*)data;
|
||||
if (!ptr)
|
||||
return false;
|
||||
*ptr = runloop_slowmotion;
|
||||
}
|
||||
break;
|
||||
return runloop_slowmotion;
|
||||
case RUNLOOP_CTL_SET_SLOWMOTION:
|
||||
{
|
||||
bool *ptr = (bool*)data;
|
||||
@ -1284,19 +1278,17 @@ int runloop_iterate(unsigned *sleep_ms)
|
||||
/* Updates frame timing if frame timing callback is in use by the core.
|
||||
* Limits frame time if fast forward ratio throttle is enabled. */
|
||||
|
||||
bool is_slowmotion;
|
||||
retro_time_t current = retro_get_time_usec();
|
||||
retro_time_t delta = current - frame_time_last;
|
||||
bool is_locked_fps = (runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL) ||
|
||||
input_driver_ctl(RARCH_INPUT_CTL_IS_NONBLOCK_STATE, NULL)) |
|
||||
!!recording_driver_get_data_ptr();
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_IS_SLOWMOTION, &is_slowmotion);
|
||||
|
||||
if (!frame_time_last || is_locked_fps)
|
||||
delta = system->frame_time.reference;
|
||||
|
||||
if (!is_locked_fps && is_slowmotion)
|
||||
if (!is_locked_fps && runloop_ctl(RUNLOOP_CTL_IS_SLOWMOTION, NULL))
|
||||
delta /= settings->slowmotion_ratio;
|
||||
|
||||
frame_time_last = current;
|
||||
|
Loading…
x
Reference in New Issue
Block a user