From 822adbdba0e38842efbf71b14b2708ffa1bc8141 Mon Sep 17 00:00:00 2001 From: sonninnos Date: Sat, 24 Jan 2026 04:53:42 +0200 Subject: [PATCH] Separate quit/close/reset confirmation options --- config.def.h | 5 +++-- configuration.c | 26 ++++++++++++++++++++++- configuration.h | 4 +++- intl/msg_hash_us.h | 25 ++++++++++++++++++---- menu/cbs/menu_cbs_sublabel.c | 14 ++++++++++--- menu/menu_displaylist.c | 4 +++- menu/menu_setting.c | 40 ++++++++++++++++++++++++++++++++---- msg_hash.h | 5 ++++- runloop.c | 36 ++++++++++++++++---------------- 9 files changed, 124 insertions(+), 35 deletions(-) diff --git a/config.def.h b/config.def.h index a151bf8790c2..6860b13a1bdd 100644 --- a/config.def.h +++ b/config.def.h @@ -978,10 +978,11 @@ #define DEFAULT_ALL_USERS_CONTROL_MENU false #endif -#define DEFAULT_QUIT_PRESS_TWICE true +#define DEFAULT_CONFIRM_QUIT true +#define DEFAULT_CONFIRM_CLOSE true +#define DEFAULT_CONFIRM_RESET true #define DEFAULT_LOG_TO_FILE false - #define DEFAULT_LOG_TO_FILE_TIMESTAMP false /* Crop overscanned frames. */ diff --git a/configuration.c b/configuration.c index a4299f50b664..7ff06177d323 100644 --- a/configuration.c +++ b/configuration.c @@ -1816,7 +1816,9 @@ static struct config_bool_setting *populate_settings_bool( SETTING_BOOL("savefiles_in_content_dir", &settings->bools.savefiles_in_content_dir, true, DEFAULT_SAVEFILES_IN_CONTENT_DIR, false); SETTING_BOOL("systemfiles_in_content_dir", &settings->bools.systemfiles_in_content_dir, true, DEFAULT_SYSTEMFILES_IN_CONTENT_DIR, false); SETTING_BOOL("screenshots_in_content_dir", &settings->bools.screenshots_in_content_dir, true, DEFAULT_SCREENSHOTS_IN_CONTENT_DIR, false); - SETTING_BOOL("quit_press_twice", &settings->bools.quit_press_twice, true, DEFAULT_QUIT_PRESS_TWICE, false); + SETTING_BOOL("confirm_quit", &settings->bools.confirm_quit, true, DEFAULT_CONFIRM_QUIT, false); + SETTING_BOOL("confirm_close", &settings->bools.confirm_close, true, DEFAULT_CONFIRM_CLOSE, false); + SETTING_BOOL("confirm_reset", &settings->bools.confirm_reset, true, DEFAULT_CONFIRM_RESET, false); SETTING_BOOL("config_save_on_exit", &settings->bools.config_save_on_exit, true, DEFAULT_CONFIG_SAVE_ON_EXIT, false); SETTING_BOOL("remap_save_on_exit", &settings->bools.remap_save_on_exit, true, DEFAULT_REMAP_SAVE_ON_EXIT, false); SETTING_BOOL("show_hidden_files", &settings->bools.show_hidden_files, true, DEFAULT_SHOW_HIDDEN_FILES, false); @@ -4551,6 +4553,20 @@ static bool config_load_file(global_t *global, settings->ints.content_favorites_size = (int)settings->uints.content_history_size; } + /* Migrate "quit_press_twice" to "confirm_quit" */ + { + const char *tmp_key = "quit_press_twice"; + struct config_entry_list *tmp = config_get_entry(conf, tmp_key); + if (tmp) + { + configuration_set_bool(settings, + settings->bools.confirm_quit, + string_is_equal(tmp->value, "true") ? true : false); + RARCH_LOG("[Config] Migrated \"%s\" to \"confirm_quit\" = \"%s\".\n", + tmp->key, tmp->value); + } + } + if (conf) config_file_free(conf); if (bool_settings) @@ -5681,6 +5697,14 @@ bool config_save_file(const char *path) for (i = 0; i < MAX_USERS; i++) input_config_save_keybinds_user(conf, i); + /* Remove unused "quit_press_twice" after migrating to "confirm_quit" */ + { + const char *tmp_key = "quit_press_twice"; + struct config_entry_list *tmp = config_get_entry(conf, tmp_key); + if (tmp) + config_unset(conf, tmp->key); + } + ret = config_file_write(conf, path, true); config_file_free(conf); diff --git a/configuration.h b/configuration.h index 6e97ae0c02dd..85c6045f6049 100644 --- a/configuration.h +++ b/configuration.h @@ -1123,7 +1123,9 @@ typedef struct settings bool playlist_use_filename; bool playlist_allow_non_png; - bool quit_press_twice; + bool confirm_quit; + bool confirm_close; + bool confirm_reset; bool vibrate_on_keypress; bool enable_device_vibration; bool ozone_collapse_sidebar; diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index ddb4b5988bc4..45422bd5bf29 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -3730,13 +3730,30 @@ MSG_HASH( "Workaround for controllers disconnecting and reconnecting. Impedes 2 players with the identical controllers." ) MSG_HASH( - MENU_ENUM_LABEL_VALUE_QUIT_PRESS_TWICE, - "Confirm Quit/Close/Reset" + MENU_ENUM_LABEL_VALUE_CONFIRM_QUIT, + "Confirm Quit" ) MSG_HASH( - MENU_ENUM_SUBLABEL_QUIT_PRESS_TWICE, - "Require the Quit/Close/Reset hotkey to be pressed twice." + MENU_ENUM_SUBLABEL_CONFIRM_QUIT, + "Require the Quit hotkey to be pressed twice." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONFIRM_CLOSE, + "Confirm Close Content" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONFIRM_CLOSE, + "Require the Close Content hotkey to be pressed twice." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONFIRM_RESET, + "Confirm Reset Content" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONFIRM_RESET, + "Require the Reset Content hotkey to be pressed twice." + ) + /* Settings > Input > Haptic Feedback/Vibration */ diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index 93a9bb69656d..9d821b72b9d7 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -622,7 +622,9 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_input_disable_info_button, DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_input_disable_search_button, MENU_ENUM_SUBLABEL_INPUT_DISABLE_SEARCH_BUTTON) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_input_disable_left_analog_in_menu, MENU_ENUM_SUBLABEL_INPUT_DISABLE_LEFT_ANALOG_IN_MENU) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_input_disable_right_analog_in_menu, MENU_ENUM_SUBLABEL_INPUT_DISABLE_RIGHT_ANALOG_IN_MENU) -DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_quit_press_twice, MENU_ENUM_SUBLABEL_QUIT_PRESS_TWICE) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_confirm_quit, MENU_ENUM_SUBLABEL_CONFIRM_QUIT) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_confirm_close, MENU_ENUM_SUBLABEL_CONFIRM_CLOSE) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_confirm_reset, MENU_ENUM_SUBLABEL_CONFIRM_RESET) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_onscreen_notifications_enable, MENU_ENUM_SUBLABEL_VIDEO_FONT_ENABLE) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_crop_overscan, MENU_ENUM_SUBLABEL_VIDEO_CROP_OVERSCAN) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_filter, MENU_ENUM_SUBLABEL_VIDEO_FILTER) @@ -4735,8 +4737,14 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_INPUT_DISABLE_RIGHT_ANALOG_IN_MENU: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_input_disable_right_analog_in_menu); break; - case MENU_ENUM_LABEL_QUIT_PRESS_TWICE: - BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_quit_press_twice); + case MENU_ENUM_LABEL_CONFIRM_QUIT: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_confirm_quit); + break; + case MENU_ENUM_LABEL_CONFIRM_CLOSE: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_confirm_close); + break; + case MENU_ENUM_LABEL_CONFIRM_RESET: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_confirm_reset); break; case MENU_ENUM_LABEL_AUDIO_MAX_TIMING_SKEW: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_audio_max_timing_skew); diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index da0b8a23b113..4a8320d83299 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -8389,7 +8389,9 @@ unsigned menu_displaylist_build_list( {MENU_ENUM_LABEL_INPUT_AUTO_MOUSE_GRAB, PARSE_ONLY_BOOL, true}, {MENU_ENUM_LABEL_INPUT_AUTO_GAME_FOCUS, PARSE_ONLY_UINT, true}, {MENU_ENUM_LABEL_PAUSE_ON_DISCONNECT, PARSE_ONLY_BOOL, true}, - {MENU_ENUM_LABEL_QUIT_PRESS_TWICE, PARSE_ONLY_BOOL, true}, + {MENU_ENUM_LABEL_CONFIRM_QUIT, PARSE_ONLY_BOOL, true}, + {MENU_ENUM_LABEL_CONFIRM_CLOSE, PARSE_ONLY_BOOL, true}, + {MENU_ENUM_LABEL_CONFIRM_RESET, PARSE_ONLY_BOOL, true}, {MENU_ENUM_LABEL_INPUT_BIND_TIMEOUT, PARSE_ONLY_UINT, true}, {MENU_ENUM_LABEL_INPUT_BIND_HOLD, PARSE_ONLY_UINT, true}, {MENU_ENUM_LABEL_INPUT_AUTODETECT_ENABLE, PARSE_ONLY_BOOL, true}, diff --git a/menu/menu_setting.c b/menu/menu_setting.c index bf1ece60038b..f6c02b28b508 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -15503,10 +15503,42 @@ static bool setting_append_list( CONFIG_BOOL( list, list_info, - &settings->bools.quit_press_twice, - MENU_ENUM_LABEL_QUIT_PRESS_TWICE, - MENU_ENUM_LABEL_VALUE_QUIT_PRESS_TWICE, - DEFAULT_QUIT_PRESS_TWICE, + &settings->bools.confirm_quit, + MENU_ENUM_LABEL_CONFIRM_QUIT, + MENU_ENUM_LABEL_VALUE_CONFIRM_QUIT, + DEFAULT_CONFIRM_QUIT, + MENU_ENUM_LABEL_VALUE_OFF, + MENU_ENUM_LABEL_VALUE_ON, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler, + SD_FLAG_NONE + ); + + CONFIG_BOOL( + list, list_info, + &settings->bools.confirm_close, + MENU_ENUM_LABEL_CONFIRM_CLOSE, + MENU_ENUM_LABEL_VALUE_CONFIRM_CLOSE, + DEFAULT_CONFIRM_CLOSE, + MENU_ENUM_LABEL_VALUE_OFF, + MENU_ENUM_LABEL_VALUE_ON, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler, + SD_FLAG_NONE + ); + + CONFIG_BOOL( + list, list_info, + &settings->bools.confirm_reset, + MENU_ENUM_LABEL_CONFIRM_RESET, + MENU_ENUM_LABEL_VALUE_CONFIRM_RESET, + DEFAULT_CONFIRM_RESET, MENU_ENUM_LABEL_VALUE_OFF, MENU_ENUM_LABEL_VALUE_ON, &group_info, diff --git a/msg_hash.h b/msg_hash.h index ec4e51b6fdfe..c23842bc7f75 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -1419,7 +1419,10 @@ enum msg_hash_enums MENU_LABEL(INPUT_DISABLE_RIGHT_ANALOG_IN_MENU), MENU_LABEL(INPUT_RUMBLE_GAIN), - MENU_LABEL(QUIT_PRESS_TWICE), + MENU_LABEL(CONFIRM_QUIT), + MENU_LABEL(CONFIRM_CLOSE), + MENU_LABEL(CONFIRM_RESET), + MENU_LABEL(QUIT_PRESS_TWICE), /* deprecated */ MENU_LABEL(QUIT_ON_CLOSE_CONTENT), MENU_LABEL(ANDROID_INPUT_DISCONNECT_WORKAROUND), diff --git a/runloop.c b/runloop.c index d49291a1e32b..251c15312781 100644 --- a/runloop.c +++ b/runloop.c @@ -5800,18 +5800,17 @@ static enum runloop_state_enum runloop_check_state( /* Check reset hotkey */ if (runloop_st->flags & RUNLOOP_FLAG_CORE_RUNNING) { - bool trig_reset_key, reset_press_twice; static bool reset_key = false; static bool old_reset_key = false; + bool trig_reset_key; + reset_key = BIT256_GET(current_bits, RARCH_RESET); trig_reset_key = reset_key && !old_reset_key; - old_reset_key = reset_key; - reset_press_twice = settings->bools.quit_press_twice; /* Check double press if enabled */ if ( trig_reset_key - && reset_press_twice) + && settings->bools.confirm_reset) { static retro_time_t reset_key_time = 0; retro_time_t cur_time = current_time; @@ -5838,18 +5837,17 @@ static enum runloop_state_enum runloop_check_state( /* Check close content hotkey */ if (runloop_st->flags & RUNLOOP_FLAG_CORE_RUNNING) { - bool trig_close_key, close_press_twice; static bool close_key = false; static bool old_close_key = false; + bool trig_close_key; + close_key = BIT256_GET(current_bits, RARCH_CLOSE_CONTENT_KEY); trig_close_key = close_key && !old_close_key; - old_close_key = close_key; - close_press_twice = settings->bools.quit_press_twice; /* Check double press if enabled */ if ( trig_close_key - && close_press_twice) + && settings->bools.confirm_close) { static retro_time_t close_key_time = 0; retro_time_t cur_time = current_time; @@ -5875,26 +5873,28 @@ static enum runloop_state_enum runloop_check_state( /* Check quit hotkey */ { - bool trig_quit_key, quit_press_twice; static bool quit_key = false; static bool old_quit_key = false; static bool runloop_exec = false; + bool trig_quit_key; + quit_key = BIT256_GET(current_bits, RARCH_QUIT_KEY); trig_quit_key = quit_key && !old_quit_key; + /* Check for quit gamepad combo */ - if ( !trig_quit_key - && ((quit_gamepad_combo != INPUT_COMBO_NONE) - && input_driver_button_combo( - quit_gamepad_combo, - current_time, - ¤t_bits))) - trig_quit_key = true; + if ( !trig_quit_key + && quit_gamepad_combo != INPUT_COMBO_NONE + && input_driver_button_combo( + quit_gamepad_combo, + current_time, + ¤t_bits)) + trig_quit_key = true; + old_quit_key = quit_key; - quit_press_twice = settings->bools.quit_press_twice; /* Check double press if enabled */ if ( trig_quit_key - && quit_press_twice) + && settings->bools.confirm_quit) { static retro_time_t quit_key_time = 0; retro_time_t cur_time = current_time;