Add "Delete Core" option to Core Information menu (#5132)

This commit is contained in:
Justin Jacobs 2017-08-03 18:38:30 -04:00
parent 2c092a882e
commit 150bc81ee1
7 changed files with 41 additions and 0 deletions

View File

@ -1249,3 +1249,5 @@ MSG_HASH(MENU_ENUM_LABEL_MENU_SHOW_ONLINE_UPDATER,
"menu_show_online_updater")
MSG_HASH(MENU_ENUM_LABEL_MENU_SHOW_CORE_UPDATER,
"menu_show_core_updater")
MSG_HASH(MENU_ENUM_LABEL_CORE_DELETE,
"core_delete")

View File

@ -3059,3 +3059,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_CORE_UPDATER,
"Show/hide the ability to update cores (and core info files).")
MSG_HASH(MSG_PREPARING_FOR_CONTENT_SCAN,
"Preparing for content scan...")
MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_DELETE,
"Delete core")
MSG_HASH(MENU_ENUM_SUBLABEL_CORE_DELETE,
"Remove this core from disk.")

View File

@ -4421,6 +4421,21 @@ static int action_ok_netplay_disconnect(const char *path,
#endif
}
static int action_ok_core_delete(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
char* core_path = strdup(path_get(RARCH_PATH_CORE));
generic_action_ok_command(CMD_EVENT_UNLOAD_CORE);
menu_entries_flush_stack(0, 0);
remove(core_path);
free(core_path);
return 0;
}
static int is_rdb_entry(enum msg_hash_enums enum_idx)
{
switch (enum_idx)
@ -4868,6 +4883,9 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_NETPLAY_DISCONNECT:
BIND_ACTION_OK(cbs, action_ok_netplay_disconnect);
break;
case MENU_ENUM_LABEL_CORE_DELETE:
BIND_ACTION_OK(cbs, action_ok_core_delete);
break;
default:
return -1;
}

View File

@ -333,6 +333,7 @@ default_sublabel_macro(action_bind_sublabel_video_viewport_custom_width,
default_sublabel_macro(action_bind_sublabel_video_viewport_custom_x, MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_X)
default_sublabel_macro(action_bind_sublabel_video_viewport_custom_y, MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_Y)
default_sublabel_macro(action_bind_sublabel_netplay_use_mitm_server, MENU_ENUM_SUBLABEL_NETPLAY_USE_MITM_SERVER)
default_sublabel_macro(action_bind_sublabel_core_delete, MENU_ENUM_SUBLABEL_CORE_DELETE)
static int action_bind_sublabel_cheevos_entry(
file_list_t *list,
@ -1290,6 +1291,8 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_NETPLAY_USE_MITM_SERVER:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_netplay_use_mitm_server);
break;
case MENU_ENUM_LABEL_CORE_DELETE:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_core_delete);
default:
case MSG_UNKNOWN:
return -1;

View File

@ -397,6 +397,12 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info)
msg_hash_to_str(MENU_ENUM_LABEL_NO_CORE_INFORMATION_AVAILABLE),
MENU_ENUM_LABEL_NO_CORE_INFORMATION_AVAILABLE,
0, 0, 0);
menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_DELETE),
msg_hash_to_str(MENU_ENUM_LABEL_CORE_DELETE),
MENU_ENUM_LABEL_CORE_DELETE,
MENU_SETTING_ACTION_CORE_DELETE, 0, 0);
return 0;
}
@ -558,6 +564,12 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info)
}
}
menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_DELETE),
msg_hash_to_str(MENU_ENUM_LABEL_CORE_DELETE),
MENU_ENUM_LABEL_CORE_DELETE,
MENU_SETTING_ACTION_CORE_DELETE, 0, 0);
return 0;
}

View File

@ -161,6 +161,7 @@ enum menu_settings_type
MENU_SETTING_ACTION_SCREENSHOT,
MENU_SETTING_ACTION_DELETE_ENTRY,
MENU_SETTING_ACTION_RESET,
MENU_SETTING_ACTION_CORE_DELETE,
MENU_SETTING_STRING_OPTIONS,
MENU_SETTING_GROUP,
MENU_SETTING_SUBGROUP,

View File

@ -1266,6 +1266,7 @@ enum msg_hash_enums
MENU_LABEL(ACHIEVEMENT_LIST),
MENU_LABEL(ACHIEVEMENT_LIST_HARDCORE),
MENU_LABEL(CORE_INFORMATION),
MENU_LABEL(CORE_DELETE),
MENU_LABEL(VIDEO_SHADER_PARAMETERS),
MENU_LABEL(VIDEO_SHADER_PRESET_PARAMETERS),