diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index eda91a1fc6..4444ac9ec3 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -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") diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index ebb8adfbc4..c14eb00878 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -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.") diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 398701dba0..b7ba381edb 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -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; } diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index 674dd07783..cde6bd4a4c 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -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; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index fa3124660b..c5c3121493 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -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; } diff --git a/menu/menu_driver.h b/menu/menu_driver.h index ed9574e5d7..51b10df75a 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -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, diff --git a/msg_hash.h b/msg_hash.h index 802833c220..bf983e7824 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -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),