Add 'Reset Input Mapping' option to 'Manage Remap Files' menu

This commit is contained in:
jdgleaver 2022-03-21 10:04:44 +00:00 committed by Autechre
parent 780fdf721e
commit 05b7ac47c3
11 changed files with 47 additions and 9 deletions

View File

@ -5164,13 +5164,7 @@ bool input_remapping_load_file(void *data, const char *path)
key_ident[0] = '\0';
fill_pathname_join_delim(stk_ident, s3,
key_string, '$', sizeof(stk_ident));
snprintf(stk_ident,
sizeof(stk_ident),
"%s_%s",
s3,
key_string);
key_string, '_', sizeof(stk_ident));
if (config_get_int(conf, stk_ident, &stk_remap))
{

View File

@ -2824,8 +2824,10 @@ MSG_HASH(
MENU_ENUM_LABEL_REMAP_FILE_REMOVE_GAME,
"remap_file_remove_game"
)
MSG_HASH(
MENU_ENUM_LABEL_REMAP_FILE_RESET,
"remap_file_reset"
)
MSG_HASH(
MENU_ENUM_LABEL_RESTART_CONTENT,
"restart_content"

View File

@ -7094,6 +7094,14 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_REMAP_FILE_REMOVE_GAME,
"Delete Game Remap File"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_REMAP_FILE_RESET,
"Reset Input Mapping"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_REMAP_FILE_RESET,
"Set all input remapping options to default values."
)
/* Quick Menu > Controls > Manage Remap Files > Load Remap File */
@ -12107,6 +12115,10 @@ MSG_HASH(
MSG_REMAP_FILE_REMOVED_SUCCESSFULLY,
"Remap file removed successfully."
)
MSG_HASH(
MSG_REMAP_FILE_RESET,
"All input remapping options reset to default."
)
MSG_HASH(
MSG_REMOVED_DISK_FROM_TRAY,
"Removed disk from tray."

View File

@ -3601,6 +3601,17 @@ static int action_ok_remap_file_remove_game(const char *path,
idx, entry_idx, ACTION_OK_REMAP_FILE_REMOVE_GAME);
}
static int action_ok_remap_file_reset(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
input_remapping_set_defaults(false);
runloop_msg_queue_push(
msg_hash_to_str(MSG_REMAP_FILE_RESET),
1, 100, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return 0;
}
int action_ok_path_use_directory(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
@ -8194,6 +8205,7 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
{MENU_ENUM_LABEL_REMAP_FILE_REMOVE_CORE, action_ok_remap_file_remove_core},
{MENU_ENUM_LABEL_REMAP_FILE_REMOVE_CONTENT_DIR, action_ok_remap_file_remove_content_dir},
{MENU_ENUM_LABEL_REMAP_FILE_REMOVE_GAME, action_ok_remap_file_remove_game},
{MENU_ENUM_LABEL_REMAP_FILE_RESET, action_ok_remap_file_reset},
{MENU_ENUM_LABEL_PLAYLISTS_TAB, action_ok_content_collection_list},
{MENU_ENUM_LABEL_BROWSE_URL_LIST, action_ok_browse_url_list},
{MENU_ENUM_LABEL_CORE_LIST, action_ok_core_list},

View File

@ -834,6 +834,7 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_save_current_config_override_game,
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_shader_options, MENU_ENUM_SUBLABEL_SHADER_OPTIONS)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_core_input_remapping_options, MENU_ENUM_SUBLABEL_CORE_INPUT_REMAPPING_OPTIONS)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_remap_file_manager_list, MENU_ENUM_SUBLABEL_REMAP_FILE_MANAGER_LIST)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_remap_file_reset, MENU_ENUM_SUBLABEL_REMAP_FILE_RESET)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_core_option_override_list, MENU_ENUM_SUBLABEL_CORE_OPTION_OVERRIDE_LIST)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_core_options_reset, MENU_ENUM_SUBLABEL_CORE_OPTIONS_RESET)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_core_options_flush, MENU_ENUM_SUBLABEL_CORE_OPTIONS_FLUSH)
@ -2897,6 +2898,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_REMAP_FILE_MANAGER_LIST:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_remap_file_manager_list);
break;
case MENU_ENUM_LABEL_REMAP_FILE_RESET:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_remap_file_reset);
break;
case MENU_ENUM_LABEL_CORE_CHEAT_OPTIONS:
#ifdef HAVE_CHEATS
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_core_cheat_options);

View File

@ -10208,6 +10208,7 @@ static void materialui_list_insert(
node->icon_type = MUI_ICON_TYPE_INTERNAL;
break;
case MENU_SETTING_ACTION_CORE_OPTIONS_RESET:
case MENU_SETTING_ACTION_REMAP_FILE_RESET:
node->icon_texture_index = MUI_TEXTURE_UNDO_SAVE_STATE;
node->icon_type = MUI_ICON_TYPE_INTERNAL;
break;

View File

@ -1832,6 +1832,7 @@ static uintptr_t ozone_entries_icon_get_texture(ozone_handle_t *ozone,
case MENU_ENUM_LABEL_REMAP_FILE_REMOVE_GAME:
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_CLOSE];
case MENU_ENUM_LABEL_CORE_OPTIONS_RESET:
case MENU_ENUM_LABEL_REMAP_FILE_RESET:
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_UNDO];
case MENU_ENUM_LABEL_CORE_OPTIONS_FLUSH:
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_FILE];

View File

@ -2805,6 +2805,7 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb,
case MENU_ENUM_LABEL_REMAP_FILE_REMOVE_GAME:
return xmb->textures.list[XMB_TEXTURE_CLOSE];
case MENU_ENUM_LABEL_CORE_OPTIONS_RESET:
case MENU_ENUM_LABEL_REMAP_FILE_RESET:
return xmb->textures.list[XMB_TEXTURE_UNDO];
case MENU_ENUM_LABEL_CORE_OPTIONS_FLUSH:
return xmb->textures.list[XMB_TEXTURE_FILE];

View File

@ -1381,6 +1381,14 @@ static unsigned menu_displaylist_parse_remap_file_manager_list(
MENU_ENUM_LABEL_REMAP_FILE_REMOVE_CORE,
MENU_SETTING_ACTION_REMAP_FILE_REMOVE_CORE, 0, 0))
count++;
/* Reset input remaps */
if (menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_REMAP_FILE_RESET),
msg_hash_to_str(MENU_ENUM_LABEL_REMAP_FILE_RESET),
MENU_ENUM_LABEL_REMAP_FILE_RESET,
MENU_SETTING_ACTION_REMAP_FILE_RESET, 0, 0))
count++;
end:
/* Fallback */
if (count == 0)

View File

@ -283,6 +283,7 @@ enum menu_settings_type
MENU_SETTING_ACTION_REMAP_FILE_REMOVE_CORE,
MENU_SETTING_ACTION_REMAP_FILE_REMOVE_CONTENT_DIR,
MENU_SETTING_ACTION_REMAP_FILE_REMOVE_GAME,
MENU_SETTING_ACTION_REMAP_FILE_RESET,
MENU_SETTING_ACTION_CONTENTLESS_CORE_RUN,

View File

@ -356,6 +356,7 @@ enum msg_hash_enums
MSG_INPUT_KIOSK_MODE_PASSWORD_NOK,
MSG_REMAP_FILE_SAVED_SUCCESSFULLY,
MSG_REMAP_FILE_REMOVED_SUCCESSFULLY,
MSG_REMAP_FILE_RESET,
MSG_SHADER_PRESET_SAVED_SUCCESSFULLY,
MSG_SHADER_PRESET_REMOVED_SUCCESSFULLY,
MSG_ERROR_SAVING_REMAP_FILE,
@ -2598,6 +2599,7 @@ enum msg_hash_enums
MENU_LABEL(REMAP_FILE_REMOVE_CORE),
MENU_LABEL(REMAP_FILE_REMOVE_CONTENT_DIR),
MENU_LABEL(REMAP_FILE_REMOVE_GAME),
MENU_LABEL(REMAP_FILE_RESET),
MENU_LABEL(RESTART_CONTENT),
MENU_LABEL(RESUME),