Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions config.def.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
26 changes: 25 additions & 1 deletion configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);

Expand Down
4 changes: 3 additions & 1 deletion configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
25 changes: 21 additions & 4 deletions intl/msg_hash_us.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down
14 changes: 11 additions & 3 deletions menu/cbs/menu_cbs_sublabel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion menu/menu_displaylist.c
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
40 changes: 36 additions & 4 deletions menu/menu_setting.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 4 additions & 1 deletion msg_hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
36 changes: 18 additions & 18 deletions runloop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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,
&current_bits)))
trig_quit_key = true;
if ( !trig_quit_key
&& quit_gamepad_combo != INPUT_COMBO_NONE
&& input_driver_button_combo(
quit_gamepad_combo,
current_time,
&current_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;
Expand Down
Loading