diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index e376065c8c..6902a51f58 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -756,12 +756,6 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info, } } - if (!strcmp(path_playlist, "collection")) - { - menu_list_set_alt_at_offset(info->list, i, path); - menu_list_set_alt2_at_offset(info->list, i, info->path); - } - menu_list_push(info->list, fill_buf, path_playlist, MENU_FILE_PLAYLIST_ENTRY, i); } @@ -1915,6 +1909,7 @@ static int menu_displaylist_parse(menu_displaylist_info_t *info, sizeof(path_playlist)); menu->playlist = content_playlist_init(path_playlist, 999); + strlcpy(menu->db_playlist_file, path_playlist, sizeof(menu->db_playlist_file)); strlcpy(path_playlist, "collection", sizeof(path_playlist)); playlist = menu->playlist; break; diff --git a/menu/menu_entries_cbs_ok.c b/menu/menu_entries_cbs_ok.c index c4de840de7..8516a4fc25 100644 --- a/menu/menu_entries_cbs_ok.c +++ b/menu/menu_entries_cbs_ok.c @@ -74,7 +74,10 @@ static int action_ok_file_load_with_detect_core(const char *path, info.directory_ptr = idx; strlcpy(info.path, settings->libretro_directory, sizeof(info.path)); if (!strcmp(label, "collection")) + { + rdb_entry_start_game_selection_ptr = idx; strlcpy(info.label, "deferred_core_list_set", sizeof(info.label)); + } else strlcpy(info.label, "deferred_core_list", sizeof(info.label)); @@ -793,18 +796,24 @@ static int action_ok_core_deferred_set(const char *path, { char core_display_name[PATH_MAX_LENGTH]; menu_handle_t *menu = menu_driver_get_ptr(); - content_playlist_t *playlist = menu ? menu->playlist : NULL; if (!menu) return -1; + if (menu->playlist) + content_playlist_free(menu->playlist); + + menu->playlist = content_playlist_init(menu->db_playlist_file, 1000); + core_info_get_name(path, core_display_name, sizeof(core_display_name)); - content_playlist_update(playlist, idx, - NULL, NULL, - path , core_display_name, - NULL); + idx = rdb_entry_start_game_selection_ptr; - content_playlist_free(playlist); + content_playlist_update(menu->playlist, idx, + menu->playlist->entries[idx].path, menu->playlist->entries[idx].label, + path , core_display_name, + menu->playlist->entries[idx].crc32); + + content_playlist_free(menu->playlist); menu->playlist = NULL; menu_list_flush_stack(menu->menu_list, NULL, MENU_SETTINGS); diff --git a/playlist.c b/playlist.c index 8a25d2cf47..93deec9ed9 100644 --- a/playlist.c +++ b/playlist.c @@ -127,22 +127,19 @@ void content_playlist_update(content_playlist_t *playlist, size_t idx, content_playlist_entry_t *entry = NULL; if (!playlist) return; - idx = idx - 1; if (idx > playlist->size) return; entry = &playlist->entries[idx]; + + if (!entry) + return; - if (path != NULL) - entry->path = strdup(path); - if (label != NULL) - entry->label = strdup(label); - if (core_path != NULL) - entry->core_path = strdup(core_path); - if (core_name != NULL) - entry->core_name = strdup(core_name); - if (crc32 != NULL) - entry->crc32 = strdup(crc32); + entry->path = path ? strdup(path) : entry->path; + entry->label = label ? strdup(label) : entry->label; + entry->core_path = core_path ? strdup(core_path) : entry->core_path; + entry->core_name = core_name ? strdup(core_name) : entry->core_name; + entry->crc32 = crc32 ? strdup(crc32) : entry->crc32; } /**