Skip to content

Commit fb7dcad

Browse files
libretroadminLibretroAdmin
authored andcommitted
video_driver: consolidate three frame-time reset toggles into one
Replaces the per-event reset toggles frame_time_counter_reset_after_fastforwarding frame_time_counter_reset_after_load_state frame_time_counter_reset_after_save_state with a single combined bool frame_time_counter_auto_reset Rationale ========= The three toggles all do the same thing -- drain the 'Estimated Screen Refresh Rate' sample buffer when an event known to introduce contaminated samples completes -- on three separate events. Splitting them was historical (each added at the time a particular contaminator was identified) rather than structurally motivated. As a UI, three identically-described toggles next to each other is harder to reason about than a single 'do best-effort cleanup' switch. This becomes more relevant after the previous gated-sampling commit: with 'Sample Frame Time Only In Stable State' on, the buffer never accepts contaminated samples in the first place, making the reset toggles entirely redundant. Folding them into one bool and hiding it under that condition keeps the submenu focused on the user's actual mental model -- either prevent contamination or clean it up afterwards. Behaviour ========= * Default: false (matches the prior aggregate -- all three old toggles defaulted off). * When true: drains video_st->frame_time_count = 0 after fast-forward toggle-off, save state, or load state. Same three events the previous toggles handled; combined under one switch. * When 'video_frame_time_sample_gated' is true, this toggle is hidden from the menu (still readable from config if the user set it manually, but irrelevant -- no samples to clean up). Migration ========= Old config keys frame_time_counter_reset_after_fastforwarding frame_time_counter_reset_after_load_state frame_time_counter_reset_after_save_state are silently ignored on load (config parser doesn't warn on unknown bool keys). Users who had any of them enabled will see the new combined setting at its default (false) and need to re-enable once if they want the cleanup behaviour. Acceptable regression given the prior defaults were all off anyway. Wiring ====== config.def.h DEFAULT_FRAME_TIME_COUNTER_AUTO_RESET configuration.{c,h} struct field + SETTING_BOOL command.c load/save state reset sites runloop.c fastmotion reset sites (incl. runloop_apply_fastmotion_override parameter rename) msg_hash.h enum msg_hash_lbl_str.h config key string intl/msg_hash_us.h 'Auto-Reset After Disruptive Events' + sublabel describing the relationship to the gated sampling setting menu/menu_setting.c CONFIG_BOOL registration (single, replacing three) menu/menu_displaylist.c build_list keeps the always-shown items (REFRESH_RATE_AUTO + GATED toggle); the AUTO_RESET entry is added via an explicit conditional PARSE_SETTINGS_ENUM call gated on !video_frame_time_sample_gated menu/cbs/menu_cbs_sublabel.c sublabel binding (single, replacing three) Compile-checked: command.o, runloop.o, configuration.o, intl/msg_hash_us.o, menu/menu_displaylist.o, menu/cbs/menu_cbs_sublabel.o all clean. menu/menu_setting.o has the same pre-existing DEFAULT_PLAYLIST_SHOW_INLINE_CORE_NAME sandbox build failure as before, unrelated.
1 parent d22e84c commit fb7dcad

11 files changed

Lines changed: 52 additions & 92 deletions

command.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ static void command_post_state_loaded(void)
8888
{
8989
video_driver_state_t *video_st =
9090
video_state_get_ptr();
91-
bool frame_time_counter_reset_after_load_state =
92-
config_get_ptr()->bools.frame_time_counter_reset_after_load_state;
93-
if (frame_time_counter_reset_after_load_state)
91+
bool frame_time_counter_auto_reset =
92+
config_get_ptr()->bools.frame_time_counter_auto_reset;
93+
if (frame_time_counter_auto_reset)
9494
video_st->frame_time_count = 0;
9595
}
9696
#if defined(HAVE_GFX_WIDGETS) && defined(HAVE_SCREENSHOTS)
@@ -2413,8 +2413,8 @@ bool command_event_main_state(unsigned cmd)
24132413
settings->bools.savestate_auto_index;
24142414
unsigned savestate_max_keep =
24152415
settings->uints.savestate_max_keep;
2416-
bool frame_time_counter_reset_after_save_state =
2417-
settings->bools.frame_time_counter_reset_after_save_state;
2416+
bool frame_time_counter_auto_reset =
2417+
settings->bools.frame_time_counter_auto_reset;
24182418

24192419
if (cmd == CMD_EVENT_SAVE_STATE)
24202420
content_save_state(state_path, true);
@@ -2425,7 +2425,7 @@ bool command_event_main_state(unsigned cmd)
24252425
if (savestate_auto_index && (savestate_max_keep > 0))
24262426
command_event_set_savestate_garbage_collect(settings);
24272427

2428-
if (frame_time_counter_reset_after_save_state)
2428+
if (frame_time_counter_auto_reset)
24292429
video_st->frame_time_count = 0;
24302430

24312431
ret = true;

config.def.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,19 @@
431431
* of slower convergence after content load. */
432432
#define DEFAULT_FRAME_TIME_SAMPLE_GATED false
433433

434+
/* When true, drains the 'Estimated Screen Refresh Rate' sample
435+
* buffer after fast-forward, save state, or load state -- events
436+
* whose timing doesn't reflect normal frame cadence and would
437+
* skew the deviation measurement. Best-effort cleanup for users
438+
* who haven't enabled DEFAULT_FRAME_TIME_SAMPLE_GATED (which
439+
* prevents the contamination at the source).
440+
*
441+
* Replaces three separate per-event reset toggles
442+
* (frame_time_counter_reset_after_{fastforwarding,load_state,
443+
* save_state}). Defaults to false to match the prior aggregate
444+
* behaviour (all three off). */
445+
#define DEFAULT_FRAME_TIME_COUNTER_AUTO_RESET false
446+
434447
/* Duplicates frames for the purposes of running Shaders at a higher framerate
435448
* than content framerate. Requires running screen at multiple of 60hz, and
436449
* don't combine with Swap_interval > 1, or BFI. (Though BFI can be done in a shader

configuration.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2266,9 +2266,7 @@ static struct config_bool_setting *populate_settings_bool(
22662266
SETTING_BOOL("playlist_use_filename", &settings->bools.playlist_use_filename, true, DEFAULT_PLAYLIST_USE_FILENAME, false);
22672267
SETTING_BOOL("playlist_allow_non_png", &settings->bools.playlist_allow_non_png, true, DEFAULT_PLAYLIST_ALLOW_NON_PNG, false);
22682268

2269-
SETTING_BOOL("frame_time_counter_reset_after_fastforwarding", &settings->bools.frame_time_counter_reset_after_fastforwarding, true, false, false);
2270-
SETTING_BOOL("frame_time_counter_reset_after_load_state", &settings->bools.frame_time_counter_reset_after_load_state, true, false, false);
2271-
SETTING_BOOL("frame_time_counter_reset_after_save_state", &settings->bools.frame_time_counter_reset_after_save_state, true, false, false);
2269+
SETTING_BOOL("frame_time_counter_auto_reset", &settings->bools.frame_time_counter_auto_reset, true, DEFAULT_FRAME_TIME_COUNTER_AUTO_RESET, false);
22722270

22732271
#ifdef HAVE_COMMAND
22742272
SETTING_BOOL("network_cmd_enable", &settings->bools.network_cmd_enable, true, DEFAULT_NETWORK_CMD_ENABLE, false);

configuration.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -794,9 +794,7 @@ typedef struct settings
794794
#endif
795795

796796
/* Frame time counter */
797-
bool frame_time_counter_reset_after_fastforwarding;
798-
bool frame_time_counter_reset_after_load_state;
799-
bool frame_time_counter_reset_after_save_state;
797+
bool frame_time_counter_auto_reset;
800798

801799
/* Menu */
802800
bool menu_enable_widgets;

intl/msg_hash_us.h

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5187,28 +5187,12 @@ MSG_HASH(
51875187
/* Settings > Frame Throttle > Frame Time Counter */
51885188

51895189
MSG_HASH(
5190-
MENU_ENUM_LABEL_VALUE_FRAME_TIME_COUNTER_RESET_AFTER_FASTFORWARDING,
5191-
"Reset After Fast-Forward"
5190+
MENU_ENUM_LABEL_VALUE_FRAME_TIME_COUNTER_AUTO_RESET,
5191+
"Auto-Reset After Disruptive Events"
51925192
)
51935193
MSG_HASH(
5194-
MENU_ENUM_SUBLABEL_FRAME_TIME_COUNTER_RESET_AFTER_FASTFORWARDING,
5195-
"Reset the frame time counter after fast-forwarding."
5196-
)
5197-
MSG_HASH(
5198-
MENU_ENUM_LABEL_VALUE_FRAME_TIME_COUNTER_RESET_AFTER_LOAD_STATE,
5199-
"Reset After Load State"
5200-
)
5201-
MSG_HASH(
5202-
MENU_ENUM_SUBLABEL_FRAME_TIME_COUNTER_RESET_AFTER_LOAD_STATE,
5203-
"Reset the frame time counter after loading a state."
5204-
)
5205-
MSG_HASH(
5206-
MENU_ENUM_LABEL_VALUE_FRAME_TIME_COUNTER_RESET_AFTER_SAVE_STATE,
5207-
"Reset After Save State"
5208-
)
5209-
MSG_HASH(
5210-
MENU_ENUM_SUBLABEL_FRAME_TIME_COUNTER_RESET_AFTER_SAVE_STATE,
5211-
"Reset the frame time counter after saving a state."
5194+
MENU_ENUM_SUBLABEL_FRAME_TIME_COUNTER_AUTO_RESET,
5195+
"Clear the 'Estimated Screen Refresh Rate' sample buffer after fast-forwarding, save state, or load state. These operations introduce timing samples that don't reflect normal frame cadence and would skew the deviation measurement. Best-effort cleanup; has no effect when 'Sample Frame Time Only In Stable State' is enabled (which prevents the contamination at the source)."
52125196
)
52135197

52145198
/* Settings > Recording */

menu/cbs/menu_cbs_sublabel.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,7 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_user_settings_list, MENU_
303303
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_recording_settings_list, MENU_ENUM_SUBLABEL_RECORDING_SETTINGS)
304304
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_frame_throttle_settings_list, MENU_ENUM_SUBLABEL_FRAME_THROTTLE_SETTINGS)
305305
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_frame_time_counter_settings_list, MENU_ENUM_SUBLABEL_FRAME_TIME_COUNTER_SETTINGS)
306-
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_frame_time_counter_reset_after_fastforwarding, MENU_ENUM_SUBLABEL_FRAME_TIME_COUNTER_RESET_AFTER_FASTFORWARDING)
307-
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_frame_time_counter_reset_after_load_state, MENU_ENUM_SUBLABEL_FRAME_TIME_COUNTER_RESET_AFTER_LOAD_STATE)
308-
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_frame_time_counter_reset_after_save_state, MENU_ENUM_SUBLABEL_FRAME_TIME_COUNTER_RESET_AFTER_SAVE_STATE)
306+
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_frame_time_counter_auto_reset, MENU_ENUM_SUBLABEL_FRAME_TIME_COUNTER_AUTO_RESET)
309307
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_onscreen_display_settings_list,MENU_ENUM_SUBLABEL_ONSCREEN_DISPLAY_SETTINGS)
310308
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_core_settings_list, MENU_ENUM_SUBLABEL_CORE_SETTINGS)
311309
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_information_list_list, MENU_ENUM_SUBLABEL_INFORMATION_LIST_LIST)
@@ -2921,14 +2919,8 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
29212919
case MENU_ENUM_LABEL_SETTINGS_SHOW_FRAME_THROTTLE:
29222920
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_settings_show_frame_throttle);
29232921
break;
2924-
case MENU_ENUM_LABEL_FRAME_TIME_COUNTER_RESET_AFTER_FASTFORWARDING:
2925-
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_frame_time_counter_reset_after_fastforwarding);
2926-
break;
2927-
case MENU_ENUM_LABEL_FRAME_TIME_COUNTER_RESET_AFTER_LOAD_STATE:
2928-
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_frame_time_counter_reset_after_load_state);
2929-
break;
2930-
case MENU_ENUM_LABEL_FRAME_TIME_COUNTER_RESET_AFTER_SAVE_STATE:
2931-
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_frame_time_counter_reset_after_save_state);
2922+
case MENU_ENUM_LABEL_FRAME_TIME_COUNTER_AUTO_RESET:
2923+
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_frame_time_counter_auto_reset);
29322924
break;
29332925
case MENU_ENUM_LABEL_SETTINGS_SHOW_RECORDING:
29342926
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_settings_show_recording);

menu/menu_displaylist.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11935,9 +11935,6 @@ unsigned menu_displaylist_build_list(
1193511935
static menu_displaylist_build_info_selective_t build_list[] = {
1193611936
{MENU_ENUM_LABEL_VIDEO_REFRESH_RATE_AUTO, PARSE_ONLY_FLOAT, true},
1193711937
{MENU_ENUM_LABEL_VIDEO_FRAME_TIME_SAMPLE_GATED, PARSE_ONLY_BOOL, true},
11938-
{MENU_ENUM_LABEL_FRAME_TIME_COUNTER_RESET_AFTER_FASTFORWARDING, PARSE_ONLY_BOOL, true},
11939-
{MENU_ENUM_LABEL_FRAME_TIME_COUNTER_RESET_AFTER_LOAD_STATE, PARSE_ONLY_BOOL, true},
11940-
{MENU_ENUM_LABEL_FRAME_TIME_COUNTER_RESET_AFTER_SAVE_STATE, PARSE_ONLY_BOOL, true},
1194111938
};
1194211939

1194311940
for (i = 0; i < ARRAY_SIZE(build_list); i++)
@@ -11947,6 +11944,18 @@ unsigned menu_displaylist_build_list(
1194711944
false) == 0)
1194811945
count++;
1194911946
}
11947+
11948+
/* Auto-reset toggle is redundant when gated sampling
11949+
* is active (no contamination enters the buffer to
11950+
* begin with), so hide it in that case to keep the
11951+
* menu focused. */
11952+
if (!settings->bools.video_frame_time_sample_gated)
11953+
{
11954+
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
11955+
MENU_ENUM_LABEL_FRAME_TIME_COUNTER_AUTO_RESET,
11956+
PARSE_ONLY_BOOL, false) == 0)
11957+
count++;
11958+
}
1195011959
}
1195111960
break;
1195211961
case DISPLAYLIST_REWIND_SETTINGS_LIST:

menu/menu_setting.c

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12478,40 +12478,10 @@ static bool setting_append_list(
1247812478

1247912479
CONFIG_BOOL(
1248012480
list, list_info,
12481-
&settings->bools.frame_time_counter_reset_after_fastforwarding,
12482-
MENU_ENUM_LABEL_FRAME_TIME_COUNTER_RESET_AFTER_FASTFORWARDING,
12483-
MENU_ENUM_LABEL_VALUE_FRAME_TIME_COUNTER_RESET_AFTER_FASTFORWARDING,
12484-
false,
12485-
MENU_ENUM_LABEL_VALUE_OFF,
12486-
MENU_ENUM_LABEL_VALUE_ON,
12487-
&group_info,
12488-
&subgroup_info,
12489-
parent_group,
12490-
general_write_handler,
12491-
general_read_handler,
12492-
SD_FLAG_NONE);
12493-
12494-
CONFIG_BOOL(
12495-
list, list_info,
12496-
&settings->bools.frame_time_counter_reset_after_load_state,
12497-
MENU_ENUM_LABEL_FRAME_TIME_COUNTER_RESET_AFTER_LOAD_STATE,
12498-
MENU_ENUM_LABEL_VALUE_FRAME_TIME_COUNTER_RESET_AFTER_LOAD_STATE,
12499-
false,
12500-
MENU_ENUM_LABEL_VALUE_OFF,
12501-
MENU_ENUM_LABEL_VALUE_ON,
12502-
&group_info,
12503-
&subgroup_info,
12504-
parent_group,
12505-
general_write_handler,
12506-
general_read_handler,
12507-
SD_FLAG_NONE);
12508-
12509-
CONFIG_BOOL(
12510-
list, list_info,
12511-
&settings->bools.frame_time_counter_reset_after_save_state,
12512-
MENU_ENUM_LABEL_FRAME_TIME_COUNTER_RESET_AFTER_SAVE_STATE,
12513-
MENU_ENUM_LABEL_VALUE_FRAME_TIME_COUNTER_RESET_AFTER_SAVE_STATE,
12514-
false,
12481+
&settings->bools.frame_time_counter_auto_reset,
12482+
MENU_ENUM_LABEL_FRAME_TIME_COUNTER_AUTO_RESET,
12483+
MENU_ENUM_LABEL_VALUE_FRAME_TIME_COUNTER_AUTO_RESET,
12484+
DEFAULT_FRAME_TIME_COUNTER_AUTO_RESET,
1251512485
MENU_ENUM_LABEL_VALUE_OFF,
1251612486
MENU_ENUM_LABEL_VALUE_ON,
1251712487
&group_info,

msg_hash.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3233,9 +3233,7 @@ enum msg_hash_enums
32333233
MENU_LABEL(OVERLAY_SETTINGS),
32343234
MENU_LABEL(REWIND_SETTINGS),
32353235
MENU_LABEL(FRAME_TIME_COUNTER_SETTINGS),
3236-
MENU_LABEL(FRAME_TIME_COUNTER_RESET_AFTER_FASTFORWARDING),
3237-
MENU_LABEL(FRAME_TIME_COUNTER_RESET_AFTER_LOAD_STATE),
3238-
MENU_LABEL(FRAME_TIME_COUNTER_RESET_AFTER_SAVE_STATE),
3236+
MENU_LABEL(FRAME_TIME_COUNTER_AUTO_RESET),
32393237
MENU_LABEL(CHEAT_SETTINGS),
32403238
MENU_LABEL(CHEAT_DETAILS_SETTINGS),
32413239
MENU_LABEL(CHEAT_SEARCH_SETTINGS),

msg_hash_lbl_str.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1560,9 +1560,7 @@
15601560
#define MENU_ENUM_LABEL_SETTINGS_SHOW_USER_STR "settings_show_user"
15611561
#define MENU_ENUM_LABEL_SETTINGS_SHOW_DIRECTORY_STR "settings_show_directory"
15621562
#define MENU_ENUM_LABEL_SETTINGS_SHOW_STEAM_STR "settings_show_steam"
1563-
#define MENU_ENUM_LABEL_FRAME_TIME_COUNTER_RESET_AFTER_FASTFORWARDING_STR "frame_time_counter_reset_after_fastforwarding"
1564-
#define MENU_ENUM_LABEL_FRAME_TIME_COUNTER_RESET_AFTER_LOAD_STATE_STR "frame_time_counter_reset_after_load_state"
1565-
#define MENU_ENUM_LABEL_FRAME_TIME_COUNTER_RESET_AFTER_SAVE_STATE_STR "frame_time_counter_reset_after_save_state"
1563+
#define MENU_ENUM_LABEL_FRAME_TIME_COUNTER_AUTO_RESET_STR "frame_time_counter_auto_reset"
15661564
#define MENU_ENUM_LABEL_DELETE_PLAYLIST_STR "delete_playlist"
15671565
#define MENU_ENUM_LABEL_LOCALAP_ENABLE_STR "localap_enable"
15681566
#define MENU_ENUM_LABEL_DRIVER_SWITCH_ENABLE_STR "driver_switch_enable"

0 commit comments

Comments
 (0)