diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 33c49a5676..199c3b8f89 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -2537,6 +2537,18 @@ static int action_ok_screenshot(const char *path, return generic_action_ok_command(CMD_EVENT_TAKE_SCREENSHOT); } +static int action_ok_delete_entry(const char *path, + const char *label, unsigned type, size_t idx, size_t entry_idx) +{ + playlist_t *playlist = NULL; + + menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_GET, &playlist); + + playlist_delete_index(playlist, rpl_entry_selection_ptr); + + return 0; +} + static int action_ok_shader_apply_changes(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { @@ -3312,6 +3324,9 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_TAKE_SCREENSHOT: BIND_ACTION_OK(cbs, action_ok_screenshot); break; + case MENU_ENUM_LABEL_DELETE_ENTRY: + BIND_ACTION_OK(cbs, action_ok_delete_entry); + break; case MENU_ENUM_LABEL_QUIT_RETROARCH: BIND_ACTION_OK(cbs, action_ok_quit); break; diff --git a/playlist.c b/playlist.c index 15d9f5a8a6..0451591594 100644 --- a/playlist.c +++ b/playlist.c @@ -90,6 +90,26 @@ void playlist_get_index(playlist_t *playlist, *crc32 = playlist->entries[idx].crc32; } +/** + * playlist_delete_index: + * @playlist : Playlist handle. + * @idx : Index of playlist entry. + * + * Delete the entry at the index: + **/ +void playlist_delete_index(playlist_t *playlist, + size_t idx) +{ + if (!playlist) + return; + + const char *label = NULL; + + playlist_get_index(playlist, idx, NULL, &label, NULL, NULL, NULL, NULL); + + printf("%s %zu\n", label, idx); +} + void playlist_get_index_by_path(playlist_t *playlist, const char *search_path, char **path, char **label, diff --git a/playlist.h b/playlist.h index 2cdc970f33..eee10c7ba2 100644 --- a/playlist.h +++ b/playlist.h @@ -65,7 +65,7 @@ size_t playlist_size(playlist_t *playlist); /** * playlist_get_index: - * @playlist : Playlist handle. + * @playlist : Playlist handle. * @idx : Index of playlist entry. * @path : Path of playlist entry. * @core_path : Core path of playlist entry. @@ -80,6 +80,16 @@ void playlist_get_index(playlist_t *playlist, const char **db_name, const char **crc32); +/** + * playlist_delete_index: + * @playlist : Playlist handle. + * @idx : Index of playlist entry. + * + * Deletes the entry at index: + **/ +void playlist_delete_index(playlist_t *playlist, + size_t idx); + /** * playlist_push: * @playlist : Playlist handle.