Frame limiting improvements
This commit is contained in:
parent
2b273697c8
commit
c723710c90
|
@ -797,10 +797,8 @@ bool audio_driver_init_internal(
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Threaded driver is initially stopped. */
|
/* Threaded driver is initially stopped. */
|
||||||
if (
|
if ( (audio_driver_st.flags & AUDIO_FLAG_ACTIVE)
|
||||||
(audio_driver_st.flags & AUDIO_FLAG_ACTIVE)
|
&& audio_cb_inited)
|
||||||
&& audio_cb_inited
|
|
||||||
)
|
|
||||||
audio_driver_start(false);
|
audio_driver_start(false);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1444,7 +1442,8 @@ void audio_driver_load_system_sounds(void)
|
||||||
task_push_audio_mixer_load(path_ok, NULL, NULL, true, AUDIO_MIXER_SLOT_SELECTION_MANUAL, AUDIO_MIXER_SYSTEM_SLOT_OK);
|
task_push_audio_mixer_load(path_ok, NULL, NULL, true, AUDIO_MIXER_SLOT_SELECTION_MANUAL, AUDIO_MIXER_SYSTEM_SLOT_OK);
|
||||||
if (path_cancel && audio_enable_menu_cancel)
|
if (path_cancel && audio_enable_menu_cancel)
|
||||||
task_push_audio_mixer_load(path_cancel, NULL, NULL, true, AUDIO_MIXER_SLOT_SELECTION_MANUAL, AUDIO_MIXER_SYSTEM_SLOT_CANCEL);
|
task_push_audio_mixer_load(path_cancel, NULL, NULL, true, AUDIO_MIXER_SLOT_SELECTION_MANUAL, AUDIO_MIXER_SYSTEM_SLOT_CANCEL);
|
||||||
if (audio_enable_menu_notice) {
|
if (audio_enable_menu_notice)
|
||||||
|
{
|
||||||
if (path_notice)
|
if (path_notice)
|
||||||
task_push_audio_mixer_load(path_notice, NULL, NULL, true, AUDIO_MIXER_SLOT_SELECTION_MANUAL, AUDIO_MIXER_SYSTEM_SLOT_NOTICE);
|
task_push_audio_mixer_load(path_notice, NULL, NULL, true, AUDIO_MIXER_SLOT_SELECTION_MANUAL, AUDIO_MIXER_SYSTEM_SLOT_NOTICE);
|
||||||
if (path_notice_back)
|
if (path_notice_back)
|
||||||
|
@ -1882,11 +1881,10 @@ void audio_driver_menu_sample(void)
|
||||||
struct retro_system_av_info *av_info = &video_st->av_info;
|
struct retro_system_av_info *av_info = &video_st->av_info;
|
||||||
const struct retro_system_timing *info =
|
const struct retro_system_timing *info =
|
||||||
(const struct retro_system_timing*)&av_info->timing;
|
(const struct retro_system_timing*)&av_info->timing;
|
||||||
unsigned sample_count = (info->sample_rate / info->fps) * 2;
|
unsigned sample_count = floor(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_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))
|
||||||
check_flush = false;
|
check_flush = false;
|
||||||
|
|
|
@ -181,7 +181,7 @@ typedef struct
|
||||||
* up to (but excluding) the point where it's converted to 16-bit audio
|
* up to (but excluding) the point where it's converted to 16-bit audio
|
||||||
* to give to the driver.
|
* to give to the driver.
|
||||||
*/
|
*/
|
||||||
float *output_samples_buf;
|
float *output_samples_buf;
|
||||||
size_t output_samples_buf_length;
|
size_t output_samples_buf_length;
|
||||||
#ifdef HAVE_REWIND
|
#ifdef HAVE_REWIND
|
||||||
int16_t *rewind_buf;
|
int16_t *rewind_buf;
|
||||||
|
@ -229,8 +229,7 @@ typedef struct
|
||||||
size_t buffer_size;
|
size_t buffer_size;
|
||||||
size_t data_ptr;
|
size_t data_ptr;
|
||||||
|
|
||||||
unsigned free_samples_buf[
|
unsigned free_samples_buf[AUDIO_BUFFER_FREE_SAMPLES_COUNT];
|
||||||
AUDIO_BUFFER_FREE_SAMPLES_COUNT];
|
|
||||||
|
|
||||||
#ifdef HAVE_AUDIOMIXER
|
#ifdef HAVE_AUDIOMIXER
|
||||||
float mixer_volume_gain;
|
float mixer_volume_gain;
|
||||||
|
@ -252,7 +251,7 @@ typedef struct
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Sample the flush delta-time when fast forwarding to find the correct
|
/* Sample the flush delta-time when fast forwarding to find the correct
|
||||||
ressample ratio. */
|
resample ratio. */
|
||||||
retro_time_t last_flush_time;
|
retro_time_t last_flush_time;
|
||||||
/* Exponential moving average */
|
/* Exponential moving average */
|
||||||
retro_time_t avg_flush_delta;
|
retro_time_t avg_flush_delta;
|
||||||
|
|
|
@ -43,6 +43,10 @@
|
||||||
#include "../menu/menu_driver.h"
|
#include "../menu/menu_driver.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_NETWORKING
|
||||||
|
#include "../network/netplay/netplay.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "common/win32_common.h"
|
#include "common/win32_common.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -1681,7 +1685,6 @@ void video_driver_set_size(unsigned width, unsigned height)
|
||||||
* false (0) if:
|
* false (0) if:
|
||||||
* a) threaded video mode is enabled
|
* a) threaded video mode is enabled
|
||||||
* b) less than 2 frame time samples.
|
* b) less than 2 frame time samples.
|
||||||
* c) FPS monitor enable is off.
|
|
||||||
**/
|
**/
|
||||||
bool video_monitor_fps_statistics(double *refresh_rate,
|
bool video_monitor_fps_statistics(double *refresh_rate,
|
||||||
double *deviation, unsigned *sample_points)
|
double *deviation, unsigned *sample_points)
|
||||||
|
@ -2529,8 +2532,34 @@ void video_driver_build_info(video_frame_info_t *video_info)
|
||||||
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
|
#ifdef _WIN32
|
||||||
? (input_st->flags & INP_FLAG_NONBLOCKING) : false;
|
#ifdef HAVE_VULKAN
|
||||||
|
/* Vulkan in Windows does mailbox emulation
|
||||||
|
* in fullscreen with vsync, effectively
|
||||||
|
* discarding frames that can't be shown,
|
||||||
|
* therefore do not do it twice. */
|
||||||
|
if ( string_is_equal(video_driver_get_ident(), "vulkan")
|
||||||
|
&& settings->bools.video_vsync
|
||||||
|
&& video_info->fullscreen)
|
||||||
|
video_info->fastforward_frameskip = false;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_MENU
|
||||||
|
/* Count paused running menu also as paused runloop. */
|
||||||
|
if (video_info->menu_is_alive)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_NETWORKING
|
||||||
|
video_info->runloop_is_paused |= settings->bools.menu_pause_libretro &&
|
||||||
|
netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_PAUSE, NULL);
|
||||||
|
#else
|
||||||
|
video_info->runloop_is_paused |= settings->bools.menu_pause_libretro;
|
||||||
|
#endif
|
||||||
|
video_info->runloop_is_paused |= !video_info->libretro_running;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
video_info->input_driver_nonblock_state = input_st ? (input_st->flags & INP_FLAG_NONBLOCKING) : false;
|
||||||
video_info->input_driver_grab_mouse_state = (input_st->flags & INP_FLAG_GRAB_MOUSE_STATE);
|
video_info->input_driver_grab_mouse_state = (input_st->flags & INP_FLAG_GRAB_MOUSE_STATE);
|
||||||
video_info->disp_userdata = disp_get_ptr();
|
video_info->disp_userdata = disp_get_ptr();
|
||||||
|
|
||||||
|
@ -3262,6 +3291,7 @@ void video_driver_frame(const void *data, unsigned width,
|
||||||
video_st->frame_cache_width = width;
|
video_st->frame_cache_width = width;
|
||||||
video_st->frame_cache_height = height;
|
video_st->frame_cache_height = height;
|
||||||
video_st->frame_cache_pitch = pitch;
|
video_st->frame_cache_pitch = pitch;
|
||||||
|
video_st->frame_discard = false;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
video_st->scaler_ptr
|
video_st->scaler_ptr
|
||||||
|
@ -3280,23 +3310,30 @@ void video_driver_frame(const void *data, unsigned width,
|
||||||
|
|
||||||
video_driver_build_info(&video_info);
|
video_driver_build_info(&video_info);
|
||||||
|
|
||||||
|
/* Take target refresh rate as initial FPS value instead of 0.00 */
|
||||||
|
if (!last_fps)
|
||||||
|
last_fps = video_info.refresh_rate;
|
||||||
|
|
||||||
/* If fast forward is active and fast forward
|
/* If fast forward is active and fast forward
|
||||||
* frame skipping is enabled, drop any frames
|
* frame skipping is enabled, and when
|
||||||
* that occur at a rate higher than the core-set
|
* paused or menu active, drop any frames
|
||||||
|
* that occur at a rate higher than display
|
||||||
* refresh rate. However: We must always render
|
* refresh rate. However: We must always render
|
||||||
* the current frame when:
|
* the current frame when:
|
||||||
* - The menu is open
|
|
||||||
* - The last frame was NULL and the
|
* - The last frame was NULL and the
|
||||||
* current frame is not (i.e. if core was
|
* current frame is not (i.e. if core was
|
||||||
* previously sending duped frames, ensure
|
* previously sending duped frames, ensure
|
||||||
* that the next frame update is captured) */
|
* that the next frame update is captured) */
|
||||||
if ( video_info.input_driver_nonblock_state
|
if ( ( video_info.input_driver_nonblock_state
|
||||||
&& video_info.fastforward_frameskip
|
&& video_info.fastforward_frameskip
|
||||||
&& !(video_info.menu_is_alive
|
&& !(last_frame_duped && !!data)
|
||||||
|| (last_frame_duped && !!data)))
|
)
|
||||||
|
|| video_info.runloop_is_paused
|
||||||
|
)
|
||||||
{
|
{
|
||||||
retro_time_t frame_time_accumulator_prev = frame_time_accumulator;
|
retro_time_t frame_time_accumulator_prev = frame_time_accumulator;
|
||||||
retro_time_t frame_time_delta = new_time - last_time;
|
retro_time_t frame_time_delta = new_time - last_time;
|
||||||
|
retro_time_t frame_time_target = 1000000.0f / video_info.refresh_rate;
|
||||||
|
|
||||||
/* Ignore initial previous frame time
|
/* Ignore initial previous frame time
|
||||||
* to prevent rubber band startup */
|
* to prevent rubber band startup */
|
||||||
|
@ -3305,6 +3342,10 @@ void video_driver_frame(const void *data, unsigned width,
|
||||||
else if (nonblock_active < 0)
|
else if (nonblock_active < 0)
|
||||||
nonblock_active = 1;
|
nonblock_active = 1;
|
||||||
|
|
||||||
|
/* Plain paused and unrestricted menu rendering require harsh limiting */
|
||||||
|
if (video_info.runloop_is_paused)
|
||||||
|
video_st->frame_discard = true;
|
||||||
|
|
||||||
/* Accumulate the elapsed time since the
|
/* Accumulate the elapsed time since the
|
||||||
* last frame */
|
* last frame */
|
||||||
if (nonblock_active > 0)
|
if (nonblock_active > 0)
|
||||||
|
@ -3313,18 +3354,18 @@ void video_driver_frame(const void *data, unsigned width,
|
||||||
/* Render frame if the accumulated time is
|
/* Render frame if the accumulated time is
|
||||||
* greater than or equal to the expected
|
* greater than or equal to the expected
|
||||||
* core frame time */
|
* core frame time */
|
||||||
render_frame = frame_time_accumulator >=
|
render_frame = frame_time_accumulator >= frame_time_target;
|
||||||
video_st->core_frame_time;
|
|
||||||
|
|
||||||
/* If frame is to be rendered, subtract
|
/* If frame is to be rendered, subtract
|
||||||
* expected frame time from accumulator */
|
* expected frame time from accumulator */
|
||||||
if (render_frame)
|
if (render_frame)
|
||||||
{
|
{
|
||||||
frame_time_accumulator -= video_st->core_frame_time;
|
video_st->frame_discard = false;
|
||||||
|
frame_time_accumulator -= frame_time_target;
|
||||||
|
|
||||||
/* Prevent external frame limiters from
|
/* Prevent external frame limiters from
|
||||||
* pushing fast forward ratio down to 1x */
|
* pushing fast forward ratio down to 1x */
|
||||||
if (frame_time_accumulator + frame_time_accumulator_prev < video_st->core_frame_time)
|
if (frame_time_accumulator + frame_time_accumulator_prev < frame_time_target)
|
||||||
frame_time_accumulator -= frame_time_delta;
|
frame_time_accumulator -= frame_time_delta;
|
||||||
|
|
||||||
/* If fast forward is working correctly,
|
/* If fast forward is working correctly,
|
||||||
|
@ -3336,7 +3377,7 @@ void video_driver_frame(const void *data, unsigned width,
|
||||||
* will never empty and may potentially
|
* will never empty and may potentially
|
||||||
* overflow. If a 'runaway' accumulator
|
* overflow. If a 'runaway' accumulator
|
||||||
* is detected, we simply reset it */
|
* is detected, we simply reset it */
|
||||||
if (frame_time_accumulator > video_st->core_frame_time)
|
if (frame_time_accumulator > frame_time_target)
|
||||||
frame_time_accumulator = 0;
|
frame_time_accumulator = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3349,6 +3390,9 @@ void video_driver_frame(const void *data, unsigned width,
|
||||||
last_time = new_time;
|
last_time = new_time;
|
||||||
last_frame_duped = !data;
|
last_frame_duped = !data;
|
||||||
|
|
||||||
|
if (video_st->frame_discard)
|
||||||
|
return;
|
||||||
|
|
||||||
/* Get the amount of frames per seconds. */
|
/* Get the amount of frames per seconds. */
|
||||||
if (video_st->frame_count)
|
if (video_st->frame_count)
|
||||||
{
|
{
|
||||||
|
@ -3654,6 +3698,7 @@ void video_driver_frame(const void *data, unsigned width,
|
||||||
audio_stats.close_to_underrun = 0.0f;
|
audio_stats.close_to_underrun = 0.0f;
|
||||||
audio_stats.close_to_blocking = 0.0f;
|
audio_stats.close_to_blocking = 0.0f;
|
||||||
|
|
||||||
|
audio_compute_buffer_statistics(&audio_stats);
|
||||||
video_monitor_fps_statistics(NULL, &stddev, NULL);
|
video_monitor_fps_statistics(NULL, &stddev, NULL);
|
||||||
|
|
||||||
video_info.osd_stat_params.x = 0.008f;
|
video_info.osd_stat_params.x = 0.008f;
|
||||||
|
@ -3665,10 +3710,7 @@ void video_driver_frame(const void *data, unsigned width,
|
||||||
video_info.osd_stat_params.drop_y = (video_info.font_size / DEFAULT_FONT_SIZE) * -3;
|
video_info.osd_stat_params.drop_y = (video_info.font_size / DEFAULT_FONT_SIZE) * -3;
|
||||||
video_info.osd_stat_params.drop_mod = 0.1f;
|
video_info.osd_stat_params.drop_mod = 0.1f;
|
||||||
video_info.osd_stat_params.drop_alpha = 0.9f;
|
video_info.osd_stat_params.drop_alpha = 0.9f;
|
||||||
video_info.osd_stat_params.color = COLOR_ABGR(
|
video_info.osd_stat_params.color = COLOR_ABGR(alpha, blue, green, red);
|
||||||
alpha, blue, green, red);
|
|
||||||
|
|
||||||
audio_compute_buffer_statistics(&audio_stats);
|
|
||||||
|
|
||||||
latency_stats[0] = '\0';
|
latency_stats[0] = '\0';
|
||||||
tmp[0] = '\0';
|
tmp[0] = '\0';
|
||||||
|
|
|
@ -776,7 +776,6 @@ typedef struct
|
||||||
#endif
|
#endif
|
||||||
struct retro_system_av_info av_info; /* double alignment */
|
struct retro_system_av_info av_info; /* double alignment */
|
||||||
retro_time_t frame_time_samples[MEASURE_FRAME_TIME_SAMPLES_COUNT];
|
retro_time_t frame_time_samples[MEASURE_FRAME_TIME_SAMPLES_COUNT];
|
||||||
retro_time_t core_frame_time;
|
|
||||||
uint64_t frame_time_count;
|
uint64_t frame_time_count;
|
||||||
uint64_t frame_count;
|
uint64_t frame_count;
|
||||||
uint8_t *record_gpu_buffer;
|
uint8_t *record_gpu_buffer;
|
||||||
|
@ -868,6 +867,7 @@ typedef struct
|
||||||
uint8_t frame_delay_effective;
|
uint8_t frame_delay_effective;
|
||||||
bool frame_delay_pause;
|
bool frame_delay_pause;
|
||||||
|
|
||||||
|
bool frame_discard;
|
||||||
bool threaded;
|
bool threaded;
|
||||||
} video_driver_state_t;
|
} video_driver_state_t;
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "../audio/audio_driver.h"
|
#include "../audio/audio_driver.h"
|
||||||
|
#include "../midi_driver.h"
|
||||||
|
|
||||||
#include "menu_driver.h"
|
#include "menu_driver.h"
|
||||||
#include "menu_cbs.h"
|
#include "menu_cbs.h"
|
||||||
|
@ -5077,16 +5078,15 @@ unsigned menu_event(
|
||||||
input_driver_state_t *input_st = input_state_get_ptr();
|
input_driver_state_t *input_st = input_state_get_ptr();
|
||||||
input_driver_t *current_input = input_st->current_driver;
|
input_driver_t *current_input = input_st->current_driver;
|
||||||
const input_device_driver_t
|
const input_device_driver_t
|
||||||
*joypad = input_st->primary_joypad;
|
*joypad = input_st->primary_joypad;
|
||||||
#ifdef HAVE_MFI
|
#ifdef HAVE_MFI
|
||||||
const input_device_driver_t *sec_joypad =
|
const input_device_driver_t *sec_joypad = input_st->secondary_joypad;
|
||||||
input_st->secondary_joypad;
|
|
||||||
#else
|
#else
|
||||||
const input_device_driver_t *sec_joypad = NULL;
|
const input_device_driver_t *sec_joypad = NULL;
|
||||||
#endif
|
#endif
|
||||||
gfx_display_t *p_disp = disp_get_ptr();
|
gfx_display_t *p_disp = disp_get_ptr();
|
||||||
menu_input_pointer_hw_state_t *pointer_hw_state = &menu_st->input_pointer_hw_state;
|
menu_input_pointer_hw_state_t *pointer_hw_state = &menu_st->input_pointer_hw_state;
|
||||||
menu_handle_t *menu = menu_st->driver_data;
|
menu_handle_t *menu = menu_st->driver_data;
|
||||||
bool keyboard_mapping_blocked = input_st->flags & INP_FLAG_KB_MAPPING_BLOCKED;
|
bool keyboard_mapping_blocked = input_st->flags & INP_FLAG_KB_MAPPING_BLOCKED;
|
||||||
bool menu_mouse_enable = settings->bools.menu_mouse_enable;
|
bool menu_mouse_enable = settings->bools.menu_mouse_enable;
|
||||||
bool menu_pointer_enable = settings->bools.menu_pointer_enable;
|
bool menu_pointer_enable = settings->bools.menu_pointer_enable;
|
||||||
|
@ -5095,13 +5095,12 @@ unsigned menu_event(
|
||||||
bool menu_scroll_fast = settings->bools.menu_scroll_fast;
|
bool menu_scroll_fast = settings->bools.menu_scroll_fast;
|
||||||
bool pointer_enabled = settings->bools.menu_pointer_enable;
|
bool pointer_enabled = settings->bools.menu_pointer_enable;
|
||||||
unsigned input_touch_scale = settings->uints.input_touch_scale;
|
unsigned input_touch_scale = settings->uints.input_touch_scale;
|
||||||
unsigned menu_scroll_delay =
|
unsigned menu_scroll_delay = settings->uints.menu_scroll_delay;
|
||||||
settings->uints.menu_scroll_delay;
|
|
||||||
#ifdef HAVE_OVERLAY
|
#ifdef HAVE_OVERLAY
|
||||||
bool input_overlay_enable = settings->bools.input_overlay_enable;
|
bool input_overlay_enable = settings->bools.input_overlay_enable;
|
||||||
bool overlay_active = input_overlay_enable
|
bool overlay_active = input_overlay_enable
|
||||||
&& (input_st->overlay_ptr)
|
&& (input_st->overlay_ptr)
|
||||||
&& (input_st->overlay_ptr->flags & INPUT_OVERLAY_ALIVE);
|
&& (input_st->overlay_ptr->flags & INPUT_OVERLAY_ALIVE);
|
||||||
#else
|
#else
|
||||||
bool input_overlay_enable = false;
|
bool input_overlay_enable = false;
|
||||||
bool overlay_active = false;
|
bool overlay_active = false;
|
||||||
|
@ -5269,11 +5268,11 @@ unsigned menu_event(
|
||||||
* for old_input_state. */
|
* for old_input_state. */
|
||||||
|
|
||||||
first_held = true;
|
first_held = true;
|
||||||
|
delay_count = 0;
|
||||||
if (initial_held)
|
if (initial_held)
|
||||||
delay_timer = menu_scroll_delay;
|
delay_timer = menu_scroll_delay;
|
||||||
else
|
else
|
||||||
delay_timer = menu_scroll_fast ? 100 : 20;
|
delay_timer = menu_scroll_delay / 8;
|
||||||
delay_count = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (delay_count >= delay_timer)
|
if (delay_count >= delay_timer)
|
||||||
|
@ -5288,26 +5287,26 @@ unsigned menu_event(
|
||||||
new_scroll_accel = menu_st->scroll.acceleration;
|
new_scroll_accel = menu_st->scroll.acceleration;
|
||||||
|
|
||||||
if (menu_scroll_fast)
|
if (menu_scroll_fast)
|
||||||
new_scroll_accel = MIN(new_scroll_accel + 1, 64);
|
new_scroll_accel = MIN(new_scroll_accel + 1, 20);
|
||||||
else
|
else
|
||||||
new_scroll_accel = MIN(new_scroll_accel + 1, 5);
|
new_scroll_accel = MIN(new_scroll_accel + 1, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
initial_held = false;
|
initial_held = false;
|
||||||
|
delay_count += anim_get_ptr()->delta_time;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
set_scroll = true;
|
set_scroll = true;
|
||||||
first_held = false;
|
first_held = false;
|
||||||
initial_held = true;
|
initial_held = true;
|
||||||
|
delay_count = 0;
|
||||||
navigation_initial = 0;
|
navigation_initial = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (set_scroll)
|
if (set_scroll)
|
||||||
menu_st->scroll.acceleration = (unsigned)(new_scroll_accel);
|
menu_st->scroll.acceleration = (unsigned)(new_scroll_accel);
|
||||||
|
|
||||||
delay_count += anim_get_ptr()->delta_time;
|
|
||||||
|
|
||||||
if (display_kb)
|
if (display_kb)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_MIST
|
#ifdef HAVE_MIST
|
||||||
|
@ -6101,7 +6100,6 @@ void menu_driver_toggle(
|
||||||
*/
|
*/
|
||||||
video_driver_t *current_video = (video_driver_t*)curr_video_data;
|
video_driver_t *current_video = (video_driver_t*)curr_video_data;
|
||||||
bool pause_libretro = false;
|
bool pause_libretro = false;
|
||||||
bool audio_enable_menu = false;
|
|
||||||
runloop_state_t *runloop_st = runloop_state_get_ptr();
|
runloop_state_t *runloop_st = runloop_state_get_ptr();
|
||||||
struct menu_state *menu_st = &menu_driver_state;
|
struct menu_state *menu_st = &menu_driver_state;
|
||||||
bool runloop_shutdown_initiated = runloop_st->flags &
|
bool runloop_shutdown_initiated = runloop_st->flags &
|
||||||
|
@ -6120,9 +6118,6 @@ void menu_driver_toggle(
|
||||||
#else
|
#else
|
||||||
pause_libretro = settings->bools.menu_pause_libretro;
|
pause_libretro = settings->bools.menu_pause_libretro;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_AUDIOMIXER
|
|
||||||
audio_enable_menu = settings->bools.audio_enable_menu;
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_OVERLAY
|
#ifdef HAVE_OVERLAY
|
||||||
input_overlay_hide_in_menu = settings->bools.input_overlay_hide_in_menu;
|
input_overlay_hide_in_menu = settings->bools.input_overlay_hide_in_menu;
|
||||||
input_overlay_enable = settings->bools.input_overlay_enable;
|
input_overlay_enable = settings->bools.input_overlay_enable;
|
||||||
|
@ -6177,27 +6172,34 @@ void menu_driver_toggle(
|
||||||
|
|
||||||
menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH;
|
menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH;
|
||||||
|
|
||||||
/* Menu should always run with vsync on and
|
/* Enforce menu vsync accordingly. */
|
||||||
* a video swap interval of 1 */
|
if ( settings->bools.menu_throttle_framerate
|
||||||
if (current_video->set_nonblock_state)
|
&& current_video->set_nonblock_state)
|
||||||
current_video->set_nonblock_state(
|
current_video->set_nonblock_state(
|
||||||
video_driver_data,
|
video_driver_data,
|
||||||
false,
|
false,
|
||||||
video_driver_test_all_flags(GFX_CTX_FLAGS_ADAPTIVE_VSYNC) &&
|
video_driver_test_all_flags(GFX_CTX_FLAGS_ADAPTIVE_VSYNC) && video_adaptive_vsync,
|
||||||
video_adaptive_vsync,
|
1);
|
||||||
1
|
|
||||||
);
|
|
||||||
/* Stop all rumbling before entering the menu. */
|
/* Stop all rumbling before entering the menu. */
|
||||||
command_event(CMD_EVENT_RUMBLE_STOP, NULL);
|
command_event(CMD_EVENT_RUMBLE_STOP, NULL);
|
||||||
|
|
||||||
|
/* Always disable FF & SM when entering menu. */
|
||||||
|
input_state_get_ptr()->flags &= ~INP_FLAG_NONBLOCKING;
|
||||||
|
runloop_st->flags &= ~RUNLOOP_FLAG_FASTMOTION;
|
||||||
|
runloop_st->flags &= ~RUNLOOP_FLAG_SLOWMOTION;
|
||||||
|
#if defined(HAVE_GFX_WIDGETS)
|
||||||
|
video_state_get_ptr()->flags &= ~VIDEO_FLAG_WIDGETS_FAST_FORWARD;
|
||||||
|
video_state_get_ptr()->flags &= ~VIDEO_FLAG_WIDGETS_REWINDING;
|
||||||
|
#endif
|
||||||
|
driver_set_nonblock_state();
|
||||||
|
|
||||||
if (pause_libretro)
|
if (pause_libretro)
|
||||||
{ /* If the menu pauses the game... */
|
{
|
||||||
|
midi_driver_set_all_sounds_off();
|
||||||
#ifdef HAVE_MICROPHONE
|
#ifdef HAVE_MICROPHONE
|
||||||
command_event(CMD_EVENT_MICROPHONE_STOP, NULL);
|
command_event(CMD_EVENT_MICROPHONE_STOP, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!audio_enable_menu) /* If the menu shouldn't have audio... */
|
|
||||||
command_event(CMD_EVENT_AUDIO_STOP, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Override keyboard callback to redirect to menu instead.
|
/* Override keyboard callback to redirect to menu instead.
|
||||||
|
@ -6224,15 +6226,9 @@ void menu_driver_toggle(
|
||||||
driver_set_nonblock_state();
|
driver_set_nonblock_state();
|
||||||
|
|
||||||
if (pause_libretro)
|
if (pause_libretro)
|
||||||
{ /* If the menu pauses the game... */
|
{
|
||||||
|
|
||||||
if (!audio_enable_menu) /* ...and the menu doesn't have audio... */
|
|
||||||
command_event(CMD_EVENT_AUDIO_START, NULL);
|
|
||||||
/* ...then re-enable the audio driver (which we shut off earlier) */
|
|
||||||
|
|
||||||
#ifdef HAVE_MICROPHONE
|
#ifdef HAVE_MICROPHONE
|
||||||
command_event(CMD_EVENT_MICROPHONE_START, NULL);
|
command_event(CMD_EVENT_MICROPHONE_START, NULL);
|
||||||
/* Start the microphone, if it was paused beforehand */
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8291,6 +8291,7 @@ static void general_write_handler(rarch_setting_t *setting)
|
||||||
#ifdef HAVE_AUDIOMIXER
|
#ifdef HAVE_AUDIOMIXER
|
||||||
if (settings->bools.audio_enable_menu)
|
if (settings->bools.audio_enable_menu)
|
||||||
{
|
{
|
||||||
|
audio_driver_load_system_sounds();
|
||||||
if (settings->bools.audio_enable_menu_bgm)
|
if (settings->bools.audio_enable_menu_bgm)
|
||||||
audio_driver_mixer_play_menu_sound_looped(AUDIO_MIXER_SYSTEM_SLOT_BGM);
|
audio_driver_mixer_play_menu_sound_looped(AUDIO_MIXER_SYSTEM_SLOT_BGM);
|
||||||
else
|
else
|
||||||
|
@ -15398,6 +15399,7 @@ static bool setting_append_list(
|
||||||
general_read_handler,
|
general_read_handler,
|
||||||
SD_FLAG_ADVANCED
|
SD_FLAG_ADVANCED
|
||||||
);
|
);
|
||||||
|
MENU_SETTINGS_LIST_CURRENT_ADD_CMD(list, list_info, CMD_EVENT_REINIT);
|
||||||
|
|
||||||
END_SUB_GROUP(list, list_info, parent_group);
|
END_SUB_GROUP(list, list_info, parent_group);
|
||||||
END_GROUP(list, list_info, parent_group);
|
END_GROUP(list, list_info, parent_group);
|
||||||
|
@ -16626,7 +16628,6 @@ static bool setting_append_list(
|
||||||
SD_FLAG_CMD_APPLY_AUTO
|
SD_FLAG_CMD_APPLY_AUTO
|
||||||
);
|
);
|
||||||
MENU_SETTINGS_LIST_CURRENT_ADD_CMD(list, list_info, CMD_EVENT_MENU_PAUSE_LIBRETRO);
|
MENU_SETTINGS_LIST_CURRENT_ADD_CMD(list, list_info, CMD_EVENT_MENU_PAUSE_LIBRETRO);
|
||||||
SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_LAKKA_ADVANCED);
|
|
||||||
|
|
||||||
CONFIG_BOOL(
|
CONFIG_BOOL(
|
||||||
list, list_info,
|
list, list_info,
|
||||||
|
|
35
retroarch.c
35
retroarch.c
|
@ -2870,6 +2870,12 @@ bool command_event(enum event_command cmd, void *data)
|
||||||
command_event_reinit(
|
command_event_reinit(
|
||||||
data ? *(const int*)data : DRIVERS_CMD_ALL);
|
data ? *(const int*)data : DRIVERS_CMD_ALL);
|
||||||
|
|
||||||
|
#if defined(HAVE_AUDIOMIXER) && defined(HAVE_MENU)
|
||||||
|
/* Menu sounds require audio reinit */
|
||||||
|
if (settings->bools.audio_enable_menu)
|
||||||
|
command_event(CMD_EVENT_AUDIO_REINIT, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Recalibrate frame delay target */
|
/* Recalibrate frame delay target */
|
||||||
if (settings->bools.video_frame_delay_auto)
|
if (settings->bools.video_frame_delay_auto)
|
||||||
video_st->frame_delay_target = 0;
|
video_st->frame_delay_target = 0;
|
||||||
|
@ -2957,7 +2963,6 @@ bool command_event(enum event_command cmd, void *data)
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case CMD_EVENT_AUDIO_STOP:
|
case CMD_EVENT_AUDIO_STOP:
|
||||||
midi_driver_set_all_sounds_off();
|
|
||||||
#if defined(HAVE_AUDIOMIXER) && defined(HAVE_MENU)
|
#if defined(HAVE_AUDIOMIXER) && defined(HAVE_MENU)
|
||||||
if ( settings->bools.audio_enable_menu
|
if ( settings->bools.audio_enable_menu
|
||||||
&& menu_state_get_ptr()->flags & MENU_ST_FLAG_ALIVE)
|
&& menu_state_get_ptr()->flags & MENU_ST_FLAG_ALIVE)
|
||||||
|
@ -3617,6 +3622,7 @@ bool command_event(enum event_command cmd, void *data)
|
||||||
runloop_st->flags |= RUNLOOP_FLAG_PAUSED;
|
runloop_st->flags |= RUNLOOP_FLAG_PAUSED;
|
||||||
else
|
else
|
||||||
runloop_st->flags &= ~RUNLOOP_FLAG_PAUSED;
|
runloop_st->flags &= ~RUNLOOP_FLAG_PAUSED;
|
||||||
|
|
||||||
runloop_pause_checks();
|
runloop_pause_checks();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -3637,42 +3643,28 @@ bool command_event(enum event_command cmd, void *data)
|
||||||
runloop_pause_checks();
|
runloop_pause_checks();
|
||||||
break;
|
break;
|
||||||
case CMD_EVENT_MENU_PAUSE_LIBRETRO:
|
case CMD_EVENT_MENU_PAUSE_LIBRETRO:
|
||||||
#ifdef HAVE_MENU
|
|
||||||
if (menu_st->flags & MENU_ST_FLAG_ALIVE)
|
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_MENU
|
||||||
#ifdef HAVE_NETWORKING
|
#ifdef HAVE_NETWORKING
|
||||||
bool menu_pause_libretro = settings->bools.menu_pause_libretro &&
|
bool menu_pause_libretro = settings->bools.menu_pause_libretro &&
|
||||||
netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_PAUSE, NULL);
|
netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_PAUSE, NULL);
|
||||||
#else
|
#else
|
||||||
bool menu_pause_libretro = settings->bools.menu_pause_libretro;
|
bool menu_pause_libretro = settings->bools.menu_pause_libretro;
|
||||||
#endif
|
#endif
|
||||||
if (menu_pause_libretro)
|
if (menu_pause_libretro)
|
||||||
{ /* If entering the menu pauses the game... */
|
{
|
||||||
command_event(CMD_EVENT_AUDIO_STOP, NULL);
|
|
||||||
#ifdef HAVE_MICROPHONE
|
#ifdef HAVE_MICROPHONE
|
||||||
command_event(CMD_EVENT_MICROPHONE_STOP, NULL);
|
command_event(CMD_EVENT_MICROPHONE_STOP, NULL);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
command_event(CMD_EVENT_AUDIO_START, NULL);
|
|
||||||
#ifdef HAVE_MICROPHONE
|
#ifdef HAVE_MICROPHONE
|
||||||
command_event(CMD_EVENT_MICROPHONE_START, NULL);
|
command_event(CMD_EVENT_MICROPHONE_START, NULL);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#ifdef HAVE_NETWORKING
|
|
||||||
bool menu_pause_libretro = settings->bools.menu_pause_libretro &&
|
|
||||||
netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_PAUSE, NULL);
|
|
||||||
#else
|
|
||||||
bool menu_pause_libretro = settings->bools.menu_pause_libretro;
|
|
||||||
#endif
|
#endif
|
||||||
if (menu_pause_libretro)
|
|
||||||
command_event(CMD_EVENT_AUDIO_START, NULL);
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
#ifdef HAVE_NETWORKING
|
#ifdef HAVE_NETWORKING
|
||||||
case CMD_EVENT_NETPLAY_PING_TOGGLE:
|
case CMD_EVENT_NETPLAY_PING_TOGGLE:
|
||||||
|
@ -3941,13 +3933,6 @@ bool command_event(enum event_command cmd, void *data)
|
||||||
video_st->flags &= ~VIDEO_FLAG_IS_SWITCHING_DISPLAY_MODE;
|
video_st->flags &= ~VIDEO_FLAG_IS_SWITCHING_DISPLAY_MODE;
|
||||||
audio_st->flags &= ~AUDIO_FLAG_SUSPENDED;
|
audio_st->flags &= ~AUDIO_FLAG_SUSPENDED;
|
||||||
|
|
||||||
#if defined(HAVE_AUDIOMIXER) && defined(HAVE_MENU)
|
|
||||||
/* Menu sounds require audio reinit. */
|
|
||||||
if ( settings->bools.audio_enable_menu
|
|
||||||
&& menu_st->flags & MENU_ST_FLAG_ALIVE)
|
|
||||||
command_event(CMD_EVENT_AUDIO_REINIT, NULL);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (userdata && *userdata == true)
|
if (userdata && *userdata == true)
|
||||||
video_driver_cached_frame();
|
video_driver_cached_frame();
|
||||||
}
|
}
|
||||||
|
|
20
runloop.c
20
runloop.c
|
@ -2674,9 +2674,6 @@ bool runloop_environment_cb(unsigned cmd, void *data)
|
||||||
(*info)->timing.sample_rate);
|
(*info)->timing.sample_rate);
|
||||||
|
|
||||||
memcpy(av_info, *info, sizeof(*av_info));
|
memcpy(av_info, *info, sizeof(*av_info));
|
||||||
video_st->core_frame_time = 1000000 /
|
|
||||||
((video_st->av_info.timing.fps > 0.0) ?
|
|
||||||
video_st->av_info.timing.fps : 60.0);
|
|
||||||
|
|
||||||
command_event(CMD_EVENT_REINIT, &reinit_flags);
|
command_event(CMD_EVENT_REINIT, &reinit_flags);
|
||||||
|
|
||||||
|
@ -4507,13 +4504,9 @@ static bool runloop_event_load_core(runloop_state_t *runloop_st,
|
||||||
|
|
||||||
if (!core_verify_api_version(runloop_st))
|
if (!core_verify_api_version(runloop_st))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
core_init_libretro_cbs(runloop_st, &runloop_st->retro_ctx);
|
core_init_libretro_cbs(runloop_st, &runloop_st->retro_ctx);
|
||||||
|
|
||||||
runloop_st->current_core.retro_get_system_av_info(&video_st->av_info);
|
runloop_st->current_core.retro_get_system_av_info(&video_st->av_info);
|
||||||
video_st->core_frame_time = 1000000 /
|
|
||||||
((video_st->av_info.timing.fps > 0.0) ?
|
|
||||||
video_st->av_info.timing.fps : 60.0);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4692,11 +4685,11 @@ void runloop_pause_checks(void)
|
||||||
#ifdef HAVE_PRESENCE
|
#ifdef HAVE_PRESENCE
|
||||||
presence_userdata_t userdata;
|
presence_userdata_t userdata;
|
||||||
#endif
|
#endif
|
||||||
|
video_driver_state_t *video_st = video_state_get_ptr();
|
||||||
runloop_state_t *runloop_st = &runloop_state;
|
runloop_state_t *runloop_st = &runloop_state;
|
||||||
bool is_paused = runloop_st->flags & RUNLOOP_FLAG_PAUSED;
|
bool is_paused = runloop_st->flags & RUNLOOP_FLAG_PAUSED;
|
||||||
bool is_idle = runloop_st->flags & RUNLOOP_FLAG_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();
|
|
||||||
dispgfx_widget_t *p_dispwidget = dispwidget_get_ptr();
|
dispgfx_widget_t *p_dispwidget = dispwidget_get_ptr();
|
||||||
bool widgets_active = p_dispwidget->active;
|
bool widgets_active = p_dispwidget->active;
|
||||||
if (widgets_active)
|
if (widgets_active)
|
||||||
|
@ -4720,6 +4713,8 @@ void runloop_pause_checks(void)
|
||||||
if (!is_idle)
|
if (!is_idle)
|
||||||
video_driver_cached_frame();
|
video_driver_cached_frame();
|
||||||
|
|
||||||
|
midi_driver_set_all_sounds_off();
|
||||||
|
|
||||||
#ifdef HAVE_PRESENCE
|
#ifdef HAVE_PRESENCE
|
||||||
userdata.status = PRESENCE_GAME_PAUSED;
|
userdata.status = PRESENCE_GAME_PAUSED;
|
||||||
command_event(CMD_EVENT_PRESENCE_UPDATE, &userdata);
|
command_event(CMD_EVENT_PRESENCE_UPDATE, &userdata);
|
||||||
|
@ -4747,6 +4742,9 @@ void runloop_pause_checks(void)
|
||||||
|
|
||||||
/* Signal/reset paused rewind to take the initial step */
|
/* Signal/reset paused rewind to take the initial step */
|
||||||
runloop_st->run_frames_and_pause = -1;
|
runloop_st->run_frames_and_pause = -1;
|
||||||
|
|
||||||
|
/* Ignore frame delay target temporarily */
|
||||||
|
video_st->frame_delay_pause = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct string_list *path_get_subsystem_list(void)
|
struct string_list *path_get_subsystem_list(void)
|
||||||
|
@ -5401,6 +5399,10 @@ static enum runloop_state_enum runloop_check_state(
|
||||||
return RUNLOOP_STATE_QUIT;
|
return RUNLOOP_STATE_QUIT;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* When frames are generated quicker than necessary */
|
||||||
|
if (video_st->frame_discard)
|
||||||
|
return RUNLOOP_STATE_PAUSE;
|
||||||
|
|
||||||
BIT256_CLEAR_ALL_PTR(¤t_bits);
|
BIT256_CLEAR_ALL_PTR(¤t_bits);
|
||||||
|
|
||||||
input_st->flags &= ~(INP_FLAG_BLOCK_LIBRETRO_INPUT
|
input_st->flags &= ~(INP_FLAG_BLOCK_LIBRETRO_INPUT
|
||||||
|
|
Loading…
Reference in New Issue