mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 16:09:47 +00:00
Ability to set FPS update interval (new setting - fps_update_interval)
This commit is contained in:
parent
73663104b3
commit
72bde77ef0
@ -660,6 +660,9 @@ static const int wasapi_sh_buffer_length = -16; /* auto */
|
||||
/* Enables displaying the current frames per second. */
|
||||
#define DEFAULT_FPS_SHOW false
|
||||
|
||||
/* FPS display will be updated at the set interval (in frames) */
|
||||
#define DEFAULT_FPS_UPDATE_INTERVAL 256
|
||||
|
||||
/* Enables displaying the current frame count. */
|
||||
#define DEFAULT_FRAMECOUNT_SHOW false
|
||||
|
||||
|
@ -1696,6 +1696,7 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings,
|
||||
SETTING_UINT("input_turbo_period", &settings->uints.input_turbo_period, true, turbo_period, false);
|
||||
SETTING_UINT("input_duty_cycle", &settings->uints.input_turbo_duty_cycle, true, turbo_duty_cycle, false);
|
||||
SETTING_UINT("input_max_users", input_driver_get_uint(INPUT_ACTION_MAX_USERS), true, input_max_users, false);
|
||||
SETTING_UINT("fps_update_interval", &settings->uints.fps_update_interval, true, DEFAULT_FPS_UPDATE_INTERVAL, false);
|
||||
SETTING_UINT("input_menu_toggle_gamepad_combo", &settings->uints.input_menu_toggle_gamepad_combo, true, menu_toggle_gamepad_combo, false);
|
||||
SETTING_UINT("audio_latency", &settings->uints.audio_latency, false, 0 /* TODO */, false);
|
||||
SETTING_UINT("audio_resampler_quality", &settings->uints.audio_resampler_quality, true, audio_resampler_quality_level, false);
|
||||
|
@ -413,6 +413,8 @@ typedef struct settings
|
||||
unsigned audio_block_frames;
|
||||
unsigned audio_latency;
|
||||
|
||||
unsigned fps_update_interval;
|
||||
|
||||
unsigned input_block_timeout;
|
||||
|
||||
unsigned audio_resampler_quality;
|
||||
|
@ -3826,3 +3826,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_FRONTEND_LOG_LEVEL,
|
||||
"Sets log level for the frontend. If a log level issued by the frontend is below this value, it is ignored."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_FPS_UPDATE_INTERVAL,
|
||||
"Framerate Update Interval (in frames)")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_FPS_UPDATE_INTERVAL,
|
||||
"Framerate display will be updated at the set interval (in frames).")
|
||||
|
@ -4844,3 +4844,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_FRONTEND_LOG_LEVEL,
|
||||
"Sets log level for the frontend. If a log level issued by the frontend is below this value, it is ignored."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_FPS_UPDATE_INTERVAL,
|
||||
"Framerate Update Interval (in frames)")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_FPS_UPDATE_INTERVAL,
|
||||
"Framerate display will be updated at the set interval (in frames).")
|
||||
|
@ -3602,3 +3602,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_FRONTEND_LOG_LEVEL,
|
||||
"Sets log level for the frontend. If a log level issued by the frontend is below this value, it is ignored."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_FPS_UPDATE_INTERVAL,
|
||||
"Framerate Update Interval (in frames)")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_FPS_UPDATE_INTERVAL,
|
||||
"Framerate display will be updated at the set interval (in frames).")
|
||||
|
@ -3731,3 +3731,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_FRONTEND_LOG_LEVEL,
|
||||
"Sets log level for the frontend. If a log level issued by the frontend is below this value, it is ignored."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_FPS_UPDATE_INTERVAL,
|
||||
"Framerate Update Interval (in frames)")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_FPS_UPDATE_INTERVAL,
|
||||
"Framerate display will be updated at the set interval (in frames).")
|
||||
|
@ -7808,3 +7808,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_FRONTEND_LOG_LEVEL,
|
||||
"Sets log level for the frontend. If a log level issued by the frontend is below this value, it is ignored."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_FPS_UPDATE_INTERVAL,
|
||||
"Framerate Update Interval (in frames)")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_FPS_UPDATE_INTERVAL,
|
||||
"Framerate display will be updated at the set interval (in frames).")
|
||||
|
@ -3490,3 +3490,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_FRONTEND_LOG_LEVEL,
|
||||
"Sets log level for the frontend. If a log level issued by the frontend is below this value, it is ignored."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_FPS_UPDATE_INTERVAL,
|
||||
"Framerate Update Interval (in frames)")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_FPS_UPDATE_INTERVAL,
|
||||
"Framerate display will be updated at the set interval (in frames).")
|
||||
|
@ -7960,3 +7960,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_FRONTEND_LOG_LEVEL,
|
||||
"Sets log level for the frontend. If a log level issued by the frontend is below this value, it is ignored."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_FPS_UPDATE_INTERVAL,
|
||||
"Framerate Update Interval (in frames)")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_FPS_UPDATE_INTERVAL,
|
||||
"Framerate display will be updated at the set interval (in frames).")
|
||||
|
@ -8748,3 +8748,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_FRONTEND_LOG_LEVEL,
|
||||
"Sets log level for the frontend. If a log level issued by the frontend is below this value, it is ignored."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_FPS_UPDATE_INTERVAL,
|
||||
"Framerate Update Interval (in frames)")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_FPS_UPDATE_INTERVAL,
|
||||
"Framerate display will be updated at the set interval (in frames).")
|
||||
|
@ -3711,3 +3711,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_FRONTEND_LOG_LEVEL,
|
||||
"Sets log level for the frontend. If a log level issued by the frontend is below this value, it is ignored."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_FPS_UPDATE_INTERVAL,
|
||||
"Framerate Update Interval (in frames)")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_FPS_UPDATE_INTERVAL,
|
||||
"Framerate display will be updated at the set interval (in frames).")
|
||||
|
@ -9123,3 +9123,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_FRONTEND_LOG_LEVEL,
|
||||
"Sets log level for the frontend. If a log level issued by the frontend is below this value, it is ignored."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_FPS_UPDATE_INTERVAL,
|
||||
"Framerate Update Interval (in frames)")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_FPS_UPDATE_INTERVAL,
|
||||
"Framerate display will be updated at the set interval (in frames).")
|
||||
|
@ -8955,3 +8955,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_FRONTEND_LOG_LEVEL,
|
||||
"Sets log level for the frontend. If a log level issued by the frontend is below this value, it is ignored."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_FPS_UPDATE_INTERVAL,
|
||||
"Framerate Update Interval (in frames)")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_FPS_UPDATE_INTERVAL,
|
||||
"Framerate display will be updated at the set interval (in frames).")
|
||||
|
@ -1977,3 +1977,5 @@ MSG_HASH(MENU_ENUM_LABEL_VIDEO_RECORD_THREADS,
|
||||
"video_record_threads")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VIDEO_GPU_INDEX,
|
||||
"gpu_index")
|
||||
MSG_HASH(MENU_ENUM_LABEL_FPS_UPDATE_INTERVAL,
|
||||
"fps_update_interval")
|
||||
|
@ -3484,3 +3484,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_FRONTEND_LOG_LEVEL,
|
||||
"Sets log level for the frontend. If a log level issued by the frontend is below this value, it is ignored."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_FPS_UPDATE_INTERVAL,
|
||||
"Framerate Update Interval (in frames)")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_FPS_UPDATE_INTERVAL,
|
||||
"Framerate display will be updated at the set interval (in frames).")
|
||||
|
@ -4275,3 +4275,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_FRONTEND_LOG_LEVEL,
|
||||
"Sets log level for the frontend. If a log level issued by the frontend is below this value, it is ignored."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_FPS_UPDATE_INTERVAL,
|
||||
"Framerate Update Interval (in frames)")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_FPS_UPDATE_INTERVAL,
|
||||
"Framerate display will be updated at the set interval (in frames).")
|
||||
|
@ -9035,3 +9035,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_FRONTEND_LOG_LEVEL,
|
||||
"Sets log level for the frontend. If a log level issued by the frontend is below this value, it is ignored."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_FPS_UPDATE_INTERVAL,
|
||||
"Framerate Update Interval (in frames)")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_FPS_UPDATE_INTERVAL,
|
||||
"Framerate display will be updated at the set interval (in frames).")
|
||||
|
@ -3556,3 +3556,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_FRONTEND_LOG_LEVEL,
|
||||
"Sets log level for the frontend. If a log level issued by the frontend is below this value, it is ignored."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_FPS_UPDATE_INTERVAL,
|
||||
"Framerate Update Interval (in frames)")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_FPS_UPDATE_INTERVAL,
|
||||
"Framerate display will be updated at the set interval (in frames).")
|
||||
|
@ -3754,3 +3754,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_FRONTEND_LOG_LEVEL,
|
||||
"Sets log level for the frontend. If a log level issued by the frontend is below this value, it is ignored."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_FPS_UPDATE_INTERVAL,
|
||||
"Framerate Update Interval (in frames)")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_FPS_UPDATE_INTERVAL,
|
||||
"Framerate display will be updated at the set interval (in frames).")
|
||||
|
@ -8760,3 +8760,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_FRONTEND_LOG_LEVEL,
|
||||
"Sets log level for the frontend. If a log level issued by the frontend is below this value, it is ignored."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_FPS_UPDATE_INTERVAL,
|
||||
"Framerate Update Interval (in frames)")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_FPS_UPDATE_INTERVAL,
|
||||
"Framerate display will be updated at the set interval (in frames).")
|
||||
|
@ -9083,3 +9083,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_FRONTEND_LOG_LEVEL,
|
||||
"Sets log level for the frontend. If a log level issued by the frontend is below this value, it is ignored."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_FPS_UPDATE_INTERVAL,
|
||||
"Framerate Update Interval (in frames)")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_FPS_UPDATE_INTERVAL,
|
||||
"Framerate display will be updated at the set interval (in frames).")
|
||||
|
@ -3646,3 +3646,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_FRONTEND_LOG_LEVEL,
|
||||
"Sets log level for the frontend. If a log level issued by the frontend is below this value, it is ignored."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_FPS_UPDATE_INTERVAL,
|
||||
"Framerate Update Interval (in frames)")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_FPS_UPDATE_INTERVAL,
|
||||
"Framerate display will be updated at the set interval (in frames).")
|
||||
|
@ -173,6 +173,7 @@ default_sublabel_macro(action_bind_sublabel_user_language, MENU_
|
||||
default_sublabel_macro(action_bind_sublabel_max_swapchain_images, MENU_ENUM_SUBLABEL_VIDEO_MAX_SWAPCHAIN_IMAGES )
|
||||
default_sublabel_macro(action_bind_sublabel_online_updater, MENU_ENUM_SUBLABEL_ONLINE_UPDATER)
|
||||
default_sublabel_macro(action_bind_sublabel_fps_show, MENU_ENUM_SUBLABEL_FPS_SHOW)
|
||||
default_sublabel_macro(action_bind_sublabel_fps_update_interval, MENU_ENUM_SUBLABEL_FPS_UPDATE_INTERVAL)
|
||||
default_sublabel_macro(action_bind_sublabel_framecount_show, MENU_ENUM_SUBLABEL_FRAMECOUNT_SHOW)
|
||||
default_sublabel_macro(action_bind_sublabel_memory_show, MENU_ENUM_SUBLABEL_MEMORY_SHOW)
|
||||
default_sublabel_macro(action_bind_sublabel_statistics_show, MENU_ENUM_SUBLABEL_STATISTICS_SHOW)
|
||||
@ -2422,6 +2423,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
|
||||
case MENU_ENUM_LABEL_FPS_SHOW:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_fps_show);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_FPS_UPDATE_INTERVAL:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_fps_update_interval);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_FRAMECOUNT_SHOW:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_framecount_show);
|
||||
break;
|
||||
|
@ -4675,6 +4675,7 @@ unsigned menu_displaylist_build_list(file_list_t *list, enum menu_displaylist_ct
|
||||
menu_displaylist_build_info_t build_list[] = {
|
||||
{MENU_ENUM_LABEL_VIDEO_FONT_ENABLE, PARSE_ONLY_BOOL },
|
||||
{MENU_ENUM_LABEL_FPS_SHOW, PARSE_ONLY_BOOL },
|
||||
{MENU_ENUM_LABEL_FPS_UPDATE_INTERVAL, PARSE_ONLY_UINT },
|
||||
{MENU_ENUM_LABEL_FRAMECOUNT_SHOW, PARSE_ONLY_BOOL },
|
||||
{MENU_ENUM_LABEL_STATISTICS_SHOW, PARSE_ONLY_BOOL },
|
||||
{MENU_ENUM_LABEL_MEMORY_SHOW, PARSE_ONLY_BOOL },
|
||||
|
@ -8386,6 +8386,20 @@ static bool setting_append_list(
|
||||
general_read_handler,
|
||||
SD_FLAG_NONE);
|
||||
|
||||
CONFIG_UINT(
|
||||
list, list_info,
|
||||
&settings->uints.fps_update_interval,
|
||||
MENU_ENUM_LABEL_FPS_UPDATE_INTERVAL,
|
||||
MENU_ENUM_LABEL_VALUE_FPS_UPDATE_INTERVAL,
|
||||
DEFAULT_FPS_UPDATE_INTERVAL,
|
||||
&group_info,
|
||||
&subgroup_info,
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint_special;
|
||||
menu_settings_list_current_add_range(list, list_info, 1, 512, 1, true, true);
|
||||
|
||||
CONFIG_BOOL(
|
||||
list, list_info,
|
||||
&settings->bools.video_memory_show,
|
||||
|
@ -1379,6 +1379,7 @@ enum msg_hash_enums
|
||||
MENU_LABEL(SHADER_PREV),
|
||||
MENU_LABEL(FRAME_ADVANCE),
|
||||
MENU_LABEL(FPS_SHOW),
|
||||
MENU_LABEL(FPS_UPDATE_INTERVAL),
|
||||
MENU_LABEL(MEMORY_SHOW),
|
||||
MENU_LABEL(STATISTICS_SHOW),
|
||||
MENU_LABEL(FRAMECOUNT_SHOW),
|
||||
|
14
retroarch.c
14
retroarch.c
@ -1321,8 +1321,6 @@ static void retroarch_unset_runtime_shader_preset(void)
|
||||
|
||||
#define TIME_TO_FPS(last_time, new_time, frames) ((1000000.0f * (frames)) / ((new_time) - (last_time)))
|
||||
|
||||
#define FPS_UPDATE_INTERVAL 256
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
#define video_driver_is_threaded_internal() ((!video_driver_is_hw_context() && video_driver_threaded) ? true : false)
|
||||
#else
|
||||
@ -18223,15 +18221,18 @@ void video_driver_frame(const void *data, unsigned width,
|
||||
strlcat(video_info.fps_text, frames_text, sizeof(video_info.fps_text));
|
||||
}
|
||||
|
||||
if ((video_driver_frame_count % FPS_UPDATE_INTERVAL) == 0)
|
||||
if ((video_driver_frame_count % video_info.fps_update_interval) == 0)
|
||||
{
|
||||
last_fps = TIME_TO_FPS(curr_time, new_time, FPS_UPDATE_INTERVAL);
|
||||
last_fps = TIME_TO_FPS(curr_time, new_time,
|
||||
video_info.fps_update_interval);
|
||||
|
||||
strlcpy(video_driver_window_title, title, sizeof(video_driver_window_title));
|
||||
strlcpy(video_driver_window_title,
|
||||
title, sizeof(video_driver_window_title));
|
||||
|
||||
if (!string_is_empty(video_info.fps_text))
|
||||
{
|
||||
strlcat(video_driver_window_title, "|| ", sizeof(video_driver_window_title));
|
||||
strlcat(video_driver_window_title, "|| ",
|
||||
sizeof(video_driver_window_title));
|
||||
strlcat(video_driver_window_title,
|
||||
video_info.fps_text, sizeof(video_driver_window_title));
|
||||
}
|
||||
@ -18509,6 +18510,7 @@ void video_driver_build_info(video_frame_info_t *video_info)
|
||||
video_info->hard_sync = settings->bools.video_hard_sync;
|
||||
video_info->hard_sync_frames = settings->uints.video_hard_sync_frames;
|
||||
video_info->fps_show = settings->bools.video_fps_show;
|
||||
video_info->fps_update_interval = settings->uints.fps_update_interval;
|
||||
video_info->statistics_show = settings->bools.video_statistics_show;
|
||||
video_info->framecount_show = settings->bools.video_framecount_show;
|
||||
video_info->scale_integer = settings->bools.video_scale_integer;
|
||||
|
@ -1157,6 +1157,7 @@ typedef struct video_frame_info
|
||||
int custom_vp_y;
|
||||
int crt_switch_center_adjust;
|
||||
|
||||
unsigned fps_update_interval;
|
||||
unsigned hard_sync_frames;
|
||||
unsigned aspect_ratio_idx;
|
||||
unsigned max_swapchain_images;
|
||||
|
@ -31,6 +31,7 @@ QWidget *NotificationsPage::widget()
|
||||
CheckableSettingsGroup *bgGroup = new CheckableSettingsGroup(MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_ENABLE);
|
||||
|
||||
notificationsGroup->add(MENU_ENUM_LABEL_FPS_SHOW);
|
||||
notificationsGroup->add(MENU_ENUM_LABEL_FPS_UPDATE_INTERVAL);
|
||||
notificationsGroup->add(MENU_ENUM_LABEL_FRAMECOUNT_SHOW);
|
||||
notificationsGroup->add(MENU_ENUM_LABEL_MEMORY_SHOW);
|
||||
notificationsGroup->add(MENU_ENUM_LABEL_STATISTICS_SHOW);
|
||||
|
Loading…
Reference in New Issue
Block a user