Skip to content

Commit c6490eb

Browse files
sonninnosLibretroAdmin
authored andcommitted
Separate quit/close/reset confirmation options
1 parent 70816e8 commit c6490eb

File tree

9 files changed

+124
-35
lines changed

9 files changed

+124
-35
lines changed

config.def.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -978,10 +978,11 @@
978978
#define DEFAULT_ALL_USERS_CONTROL_MENU false
979979
#endif
980980

981-
#define DEFAULT_QUIT_PRESS_TWICE true
981+
#define DEFAULT_CONFIRM_QUIT true
982+
#define DEFAULT_CONFIRM_CLOSE true
983+
#define DEFAULT_CONFIRM_RESET true
982984

983985
#define DEFAULT_LOG_TO_FILE false
984-
985986
#define DEFAULT_LOG_TO_FILE_TIMESTAMP false
986987

987988
/* Crop overscanned frames. */

configuration.c

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1816,7 +1816,9 @@ static struct config_bool_setting *populate_settings_bool(
18161816
SETTING_BOOL("savefiles_in_content_dir", &settings->bools.savefiles_in_content_dir, true, DEFAULT_SAVEFILES_IN_CONTENT_DIR, false);
18171817
SETTING_BOOL("systemfiles_in_content_dir", &settings->bools.systemfiles_in_content_dir, true, DEFAULT_SYSTEMFILES_IN_CONTENT_DIR, false);
18181818
SETTING_BOOL("screenshots_in_content_dir", &settings->bools.screenshots_in_content_dir, true, DEFAULT_SCREENSHOTS_IN_CONTENT_DIR, false);
1819-
SETTING_BOOL("quit_press_twice", &settings->bools.quit_press_twice, true, DEFAULT_QUIT_PRESS_TWICE, false);
1819+
SETTING_BOOL("confirm_quit", &settings->bools.confirm_quit, true, DEFAULT_CONFIRM_QUIT, false);
1820+
SETTING_BOOL("confirm_close", &settings->bools.confirm_close, true, DEFAULT_CONFIRM_CLOSE, false);
1821+
SETTING_BOOL("confirm_reset", &settings->bools.confirm_reset, true, DEFAULT_CONFIRM_RESET, false);
18201822
SETTING_BOOL("config_save_on_exit", &settings->bools.config_save_on_exit, true, DEFAULT_CONFIG_SAVE_ON_EXIT, false);
18211823
SETTING_BOOL("remap_save_on_exit", &settings->bools.remap_save_on_exit, true, DEFAULT_REMAP_SAVE_ON_EXIT, false);
18221824
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,
45514553
settings->ints.content_favorites_size = (int)settings->uints.content_history_size;
45524554
}
45534555

4556+
/* Migrate "quit_press_twice" to "confirm_quit" */
4557+
{
4558+
const char *tmp_key = "quit_press_twice";
4559+
struct config_entry_list *tmp = config_get_entry(conf, tmp_key);
4560+
if (tmp)
4561+
{
4562+
configuration_set_bool(settings,
4563+
settings->bools.confirm_quit,
4564+
string_is_equal(tmp->value, "true") ? true : false);
4565+
RARCH_LOG("[Config] Migrated \"%s\" to \"confirm_quit\" = \"%s\".\n",
4566+
tmp->key, tmp->value);
4567+
}
4568+
}
4569+
45544570
if (conf)
45554571
config_file_free(conf);
45564572
if (bool_settings)
@@ -5681,6 +5697,14 @@ bool config_save_file(const char *path)
56815697
for (i = 0; i < MAX_USERS; i++)
56825698
input_config_save_keybinds_user(conf, i);
56835699

5700+
/* Remove unused "quit_press_twice" after migrating to "confirm_quit" */
5701+
{
5702+
const char *tmp_key = "quit_press_twice";
5703+
struct config_entry_list *tmp = config_get_entry(conf, tmp_key);
5704+
if (tmp)
5705+
config_unset(conf, tmp->key);
5706+
}
5707+
56845708
ret = config_file_write(conf, path, true);
56855709
config_file_free(conf);
56865710

configuration.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1123,7 +1123,9 @@ typedef struct settings
11231123
bool playlist_use_filename;
11241124
bool playlist_allow_non_png;
11251125

1126-
bool quit_press_twice;
1126+
bool confirm_quit;
1127+
bool confirm_close;
1128+
bool confirm_reset;
11271129
bool vibrate_on_keypress;
11281130
bool enable_device_vibration;
11291131
bool ozone_collapse_sidebar;

intl/msg_hash_us.h

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3730,13 +3730,30 @@ MSG_HASH(
37303730
"Workaround for controllers disconnecting and reconnecting. Impedes 2 players with the identical controllers."
37313731
)
37323732
MSG_HASH(
3733-
MENU_ENUM_LABEL_VALUE_QUIT_PRESS_TWICE,
3734-
"Confirm Quit/Close/Reset"
3733+
MENU_ENUM_LABEL_VALUE_CONFIRM_QUIT,
3734+
"Confirm Quit"
37353735
)
37363736
MSG_HASH(
3737-
MENU_ENUM_SUBLABEL_QUIT_PRESS_TWICE,
3738-
"Require the Quit/Close/Reset hotkey to be pressed twice."
3737+
MENU_ENUM_SUBLABEL_CONFIRM_QUIT,
3738+
"Require the Quit hotkey to be pressed twice."
37393739
)
3740+
MSG_HASH(
3741+
MENU_ENUM_LABEL_VALUE_CONFIRM_CLOSE,
3742+
"Confirm Close Content"
3743+
)
3744+
MSG_HASH(
3745+
MENU_ENUM_SUBLABEL_CONFIRM_CLOSE,
3746+
"Require the Close Content hotkey to be pressed twice."
3747+
)
3748+
MSG_HASH(
3749+
MENU_ENUM_LABEL_VALUE_CONFIRM_RESET,
3750+
"Confirm Reset Content"
3751+
)
3752+
MSG_HASH(
3753+
MENU_ENUM_SUBLABEL_CONFIRM_RESET,
3754+
"Require the Reset Content hotkey to be pressed twice."
3755+
)
3756+
37403757

37413758
/* Settings > Input > Haptic Feedback/Vibration */
37423759

menu/cbs/menu_cbs_sublabel.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,9 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_input_disable_info_button,
622622
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_input_disable_search_button, MENU_ENUM_SUBLABEL_INPUT_DISABLE_SEARCH_BUTTON)
623623
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_input_disable_left_analog_in_menu, MENU_ENUM_SUBLABEL_INPUT_DISABLE_LEFT_ANALOG_IN_MENU)
624624
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_input_disable_right_analog_in_menu, MENU_ENUM_SUBLABEL_INPUT_DISABLE_RIGHT_ANALOG_IN_MENU)
625-
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_quit_press_twice, MENU_ENUM_SUBLABEL_QUIT_PRESS_TWICE)
625+
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_confirm_quit, MENU_ENUM_SUBLABEL_CONFIRM_QUIT)
626+
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_confirm_close, MENU_ENUM_SUBLABEL_CONFIRM_CLOSE)
627+
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_confirm_reset, MENU_ENUM_SUBLABEL_CONFIRM_RESET)
626628
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_onscreen_notifications_enable, MENU_ENUM_SUBLABEL_VIDEO_FONT_ENABLE)
627629
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_crop_overscan, MENU_ENUM_SUBLABEL_VIDEO_CROP_OVERSCAN)
628630
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,
47354737
case MENU_ENUM_LABEL_INPUT_DISABLE_RIGHT_ANALOG_IN_MENU:
47364738
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_input_disable_right_analog_in_menu);
47374739
break;
4738-
case MENU_ENUM_LABEL_QUIT_PRESS_TWICE:
4739-
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_quit_press_twice);
4740+
case MENU_ENUM_LABEL_CONFIRM_QUIT:
4741+
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_confirm_quit);
4742+
break;
4743+
case MENU_ENUM_LABEL_CONFIRM_CLOSE:
4744+
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_confirm_close);
4745+
break;
4746+
case MENU_ENUM_LABEL_CONFIRM_RESET:
4747+
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_confirm_reset);
47404748
break;
47414749
case MENU_ENUM_LABEL_AUDIO_MAX_TIMING_SKEW:
47424750
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_audio_max_timing_skew);

menu/menu_displaylist.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8389,7 +8389,9 @@ unsigned menu_displaylist_build_list(
83898389
{MENU_ENUM_LABEL_INPUT_AUTO_MOUSE_GRAB, PARSE_ONLY_BOOL, true},
83908390
{MENU_ENUM_LABEL_INPUT_AUTO_GAME_FOCUS, PARSE_ONLY_UINT, true},
83918391
{MENU_ENUM_LABEL_PAUSE_ON_DISCONNECT, PARSE_ONLY_BOOL, true},
8392-
{MENU_ENUM_LABEL_QUIT_PRESS_TWICE, PARSE_ONLY_BOOL, true},
8392+
{MENU_ENUM_LABEL_CONFIRM_QUIT, PARSE_ONLY_BOOL, true},
8393+
{MENU_ENUM_LABEL_CONFIRM_CLOSE, PARSE_ONLY_BOOL, true},
8394+
{MENU_ENUM_LABEL_CONFIRM_RESET, PARSE_ONLY_BOOL, true},
83938395
{MENU_ENUM_LABEL_INPUT_BIND_TIMEOUT, PARSE_ONLY_UINT, true},
83948396
{MENU_ENUM_LABEL_INPUT_BIND_HOLD, PARSE_ONLY_UINT, true},
83958397
{MENU_ENUM_LABEL_INPUT_AUTODETECT_ENABLE, PARSE_ONLY_BOOL, true},

menu/menu_setting.c

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15503,10 +15503,42 @@ static bool setting_append_list(
1550315503

1550415504
CONFIG_BOOL(
1550515505
list, list_info,
15506-
&settings->bools.quit_press_twice,
15507-
MENU_ENUM_LABEL_QUIT_PRESS_TWICE,
15508-
MENU_ENUM_LABEL_VALUE_QUIT_PRESS_TWICE,
15509-
DEFAULT_QUIT_PRESS_TWICE,
15506+
&settings->bools.confirm_quit,
15507+
MENU_ENUM_LABEL_CONFIRM_QUIT,
15508+
MENU_ENUM_LABEL_VALUE_CONFIRM_QUIT,
15509+
DEFAULT_CONFIRM_QUIT,
15510+
MENU_ENUM_LABEL_VALUE_OFF,
15511+
MENU_ENUM_LABEL_VALUE_ON,
15512+
&group_info,
15513+
&subgroup_info,
15514+
parent_group,
15515+
general_write_handler,
15516+
general_read_handler,
15517+
SD_FLAG_NONE
15518+
);
15519+
15520+
CONFIG_BOOL(
15521+
list, list_info,
15522+
&settings->bools.confirm_close,
15523+
MENU_ENUM_LABEL_CONFIRM_CLOSE,
15524+
MENU_ENUM_LABEL_VALUE_CONFIRM_CLOSE,
15525+
DEFAULT_CONFIRM_CLOSE,
15526+
MENU_ENUM_LABEL_VALUE_OFF,
15527+
MENU_ENUM_LABEL_VALUE_ON,
15528+
&group_info,
15529+
&subgroup_info,
15530+
parent_group,
15531+
general_write_handler,
15532+
general_read_handler,
15533+
SD_FLAG_NONE
15534+
);
15535+
15536+
CONFIG_BOOL(
15537+
list, list_info,
15538+
&settings->bools.confirm_reset,
15539+
MENU_ENUM_LABEL_CONFIRM_RESET,
15540+
MENU_ENUM_LABEL_VALUE_CONFIRM_RESET,
15541+
DEFAULT_CONFIRM_RESET,
1551015542
MENU_ENUM_LABEL_VALUE_OFF,
1551115543
MENU_ENUM_LABEL_VALUE_ON,
1551215544
&group_info,

msg_hash.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1419,7 +1419,10 @@ enum msg_hash_enums
14191419
MENU_LABEL(INPUT_DISABLE_RIGHT_ANALOG_IN_MENU),
14201420
MENU_LABEL(INPUT_RUMBLE_GAIN),
14211421

1422-
MENU_LABEL(QUIT_PRESS_TWICE),
1422+
MENU_LABEL(CONFIRM_QUIT),
1423+
MENU_LABEL(CONFIRM_CLOSE),
1424+
MENU_LABEL(CONFIRM_RESET),
1425+
MENU_LABEL(QUIT_PRESS_TWICE), /* deprecated */
14231426
MENU_LABEL(QUIT_ON_CLOSE_CONTENT),
14241427

14251428
MENU_LABEL(ANDROID_INPUT_DISCONNECT_WORKAROUND),

runloop.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5800,18 +5800,17 @@ static enum runloop_state_enum runloop_check_state(
58005800
/* Check reset hotkey */
58015801
if (runloop_st->flags & RUNLOOP_FLAG_CORE_RUNNING)
58025802
{
5803-
bool trig_reset_key, reset_press_twice;
58045803
static bool reset_key = false;
58055804
static bool old_reset_key = false;
5805+
bool trig_reset_key;
5806+
58065807
reset_key = BIT256_GET(current_bits, RARCH_RESET);
58075808
trig_reset_key = reset_key && !old_reset_key;
5808-
58095809
old_reset_key = reset_key;
5810-
reset_press_twice = settings->bools.quit_press_twice;
58115810

58125811
/* Check double press if enabled */
58135812
if ( trig_reset_key
5814-
&& reset_press_twice)
5813+
&& settings->bools.confirm_reset)
58155814
{
58165815
static retro_time_t reset_key_time = 0;
58175816
retro_time_t cur_time = current_time;
@@ -5838,18 +5837,17 @@ static enum runloop_state_enum runloop_check_state(
58385837
/* Check close content hotkey */
58395838
if (runloop_st->flags & RUNLOOP_FLAG_CORE_RUNNING)
58405839
{
5841-
bool trig_close_key, close_press_twice;
58425840
static bool close_key = false;
58435841
static bool old_close_key = false;
5842+
bool trig_close_key;
5843+
58445844
close_key = BIT256_GET(current_bits, RARCH_CLOSE_CONTENT_KEY);
58455845
trig_close_key = close_key && !old_close_key;
5846-
58475846
old_close_key = close_key;
5848-
close_press_twice = settings->bools.quit_press_twice;
58495847

58505848
/* Check double press if enabled */
58515849
if ( trig_close_key
5852-
&& close_press_twice)
5850+
&& settings->bools.confirm_close)
58535851
{
58545852
static retro_time_t close_key_time = 0;
58555853
retro_time_t cur_time = current_time;
@@ -5875,26 +5873,28 @@ static enum runloop_state_enum runloop_check_state(
58755873

58765874
/* Check quit hotkey */
58775875
{
5878-
bool trig_quit_key, quit_press_twice;
58795876
static bool quit_key = false;
58805877
static bool old_quit_key = false;
58815878
static bool runloop_exec = false;
5879+
bool trig_quit_key;
5880+
58825881
quit_key = BIT256_GET(current_bits, RARCH_QUIT_KEY);
58835882
trig_quit_key = quit_key && !old_quit_key;
5883+
58845884
/* Check for quit gamepad combo */
5885-
if ( !trig_quit_key
5886-
&& ((quit_gamepad_combo != INPUT_COMBO_NONE)
5887-
&& input_driver_button_combo(
5888-
quit_gamepad_combo,
5889-
current_time,
5890-
&current_bits)))
5891-
trig_quit_key = true;
5885+
if ( !trig_quit_key
5886+
&& quit_gamepad_combo != INPUT_COMBO_NONE
5887+
&& input_driver_button_combo(
5888+
quit_gamepad_combo,
5889+
current_time,
5890+
&current_bits))
5891+
trig_quit_key = true;
5892+
58925893
old_quit_key = quit_key;
5893-
quit_press_twice = settings->bools.quit_press_twice;
58945894

58955895
/* Check double press if enabled */
58965896
if ( trig_quit_key
5897-
&& quit_press_twice)
5897+
&& settings->bools.confirm_quit)
58985898
{
58995899
static retro_time_t quit_key_time = 0;
59005900
retro_time_t cur_time = current_time;

0 commit comments

Comments
 (0)