diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index e079c8b7b3..d0f8acb043 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -701,14 +701,15 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) return 0; } -static int menu_displaylist_parse_historylist(menu_displaylist_info_t *info) +static int menu_displaylist_parse_historylist(menu_displaylist_info_t *info, + content_playlist_t *playlist) { unsigned i; - size_t list_size = content_playlist_size(g_defaults.history); + size_t list_size = content_playlist_size(playlist); if (list_size <= 0) { - menu_list_push(info->list, "No history available.", "", + menu_list_push(info->list, "No playlist available.", "", MENU_SETTINGS_CORE_OPTION_NONE, 0); return 0; } @@ -724,7 +725,7 @@ static int menu_displaylist_parse_historylist(menu_displaylist_info_t *info) path = path_copy; - content_playlist_get_index(g_defaults.history, i, + content_playlist_get_index(playlist, i, &path, NULL, &core_name); strlcpy(fill_buf, core_name, sizeof(fill_buf)); @@ -907,9 +908,9 @@ static int menu_displaylist_parse_database_entry(menu_displaylist_info_t *info) strlcpy(path_base, path_basename(info->path), sizeof(path_base)); path_remove_extension(path_base); - strlcat(path_base, ".rdl", sizeof(path_base)); + strlcat(path_base, ".cfg", sizeof(path_base)); - fill_pathname_join(path_rdl, settings->content_database, path_base, + fill_pathname_join(path_rdl, settings->playlist_directory, path_base, sizeof(path_rdl)); menu_database_realloc(path_rdl, false); @@ -1616,6 +1617,7 @@ static int menu_displaylist_parse_generic(menu_displaylist_info_t *info, bool *n { bool is_dir; const char *path = NULL; + char label[PATH_MAX_LENGTH]; menu_file_type_t file_type = MENU_FILE_NONE; switch (str_list->elems[i].attr.i) @@ -1678,7 +1680,7 @@ static int menu_displaylist_parse_generic(menu_displaylist_info_t *info, bool *n file_type = is_dir ? MENU_FILE_DIRECTORY : MENU_FILE_CORE; } - menu_list_push(info->list, path, "", + menu_list_push(info->list, path, label, file_type, 0); } @@ -1894,11 +1896,27 @@ static int menu_displaylist_parse(menu_displaylist_info_t *info, *need_push = true; break; + case DISPLAYLIST_PLAYLIST_COLLECTION: case DISPLAYLIST_HISTORY: - if (menu_displaylist_parse_historylist(info) == 0) { - *need_refresh = true; - *need_push = true; + RARCH_LOG("Gets here.\n"); + content_playlist_t *playlist = NULL; + + switch (type) + { + case DISPLAYLIST_HISTORY: + case DISPLAYLIST_PLAYLIST_COLLECTION: + playlist = g_defaults.history; + break; + default: + break; + } + + if (menu_displaylist_parse_historylist(info, playlist) == 0) + { + *need_refresh = true; + *need_push = true; + } } break; case DISPLAYLIST_OPTIONS_DISK: diff --git a/menu/menu_displaylist.h b/menu/menu_displaylist.h index 9af1084f2e..48dbce6d5d 100644 --- a/menu/menu_displaylist.h +++ b/menu/menu_displaylist.h @@ -40,6 +40,7 @@ enum DISPLAYLIST_HORIZONTAL, DISPLAYLIST_HORIZONTAL_CONTENT_ACTIONS, DISPLAYLIST_HISTORY, + DISPLAYLIST_PLAYLIST_COLLECTION, DISPLAYLIST_DEFAULT, DISPLAYLIST_CORES, DISPLAYLIST_CORES_ALL, diff --git a/menu/menu_entries_cbs_deferred_push.c b/menu/menu_entries_cbs_deferred_push.c index 2f42713e38..48da207aa3 100644 --- a/menu/menu_entries_cbs_deferred_push.c +++ b/menu/menu_entries_cbs_deferred_push.c @@ -34,6 +34,12 @@ static int deferred_push_system_information(menu_displaylist_info_t *info) return menu_displaylist_push_list(info, DISPLAYLIST_SYSTEM_INFO); } +static int deferred_push_rdb_collection(menu_displaylist_info_t *info) +{ + /* TODO/FIXME - add path? */ + return menu_displaylist_push_list(info, DISPLAYLIST_PLAYLIST_COLLECTION); +} + static int deferred_push_rdb_entry_detail(menu_displaylist_info_t *info) { int ret; @@ -291,7 +297,7 @@ static int deferred_push_cursor_manager_list(menu_displaylist_info_t *info) static int deferred_push_content_collection_list(menu_displaylist_info_t *info) { info->type_default = MENU_FILE_PLAIN; - strlcpy(info->exts, "rdl", sizeof(info->exts)); + strlcpy(info->exts, "cfg", sizeof(info->exts)); return menu_displaylist_push_list(info, DISPLAYLIST_DATABASE_PLAYLISTS); } @@ -493,6 +499,8 @@ void menu_entries_cbs_init_bind_deferred_push(menu_file_list_cbs_t *cbs, cbs->action_deferred_push = deferred_push_management_options; else if (type == MENU_SETTING_GROUP) cbs->action_deferred_push = deferred_push_category; + else if (type == MENU_FILE_PLAYLIST_COLLECTION) + cbs->action_deferred_push = deferred_push_rdb_collection; else if (!strcmp(label, "deferred_core_list")) cbs->action_deferred_push = deferred_push_core_list_deferred; else if (!strcmp(label, "deferred_video_filter")) diff --git a/menu/menu_entries_cbs_ok.c b/menu/menu_entries_cbs_ok.c index 1adf164c77..ed8f37e219 100644 --- a/menu/menu_entries_cbs_ok.c +++ b/menu/menu_entries_cbs_ok.c @@ -392,6 +392,24 @@ static int action_ok_record_configfile(const char *path, return menu_displaylist_push_list(&info, DISPLAYLIST_GENERIC); } +static int action_ok_playlist_collection(const char *path, + const char *label, unsigned type, size_t idx) +{ + menu_handle_t *menu = menu_driver_get_ptr(); + menu_displaylist_info_t info = {0}; + + if (!menu) + return -1; + + info.list = menu->menu_list->menu_stack; + info.type = type; + info.directory_ptr = idx; + strlcpy(info.path, path, sizeof(info.path)); + strlcpy(info.label, label, sizeof(info.label)); + + return menu_displaylist_push_list(&info, DISPLAYLIST_PLAYLIST_COLLECTION); +} + static int action_ok_content_collection_list(const char *path, const char *label, unsigned type, size_t idx) { @@ -1289,13 +1307,6 @@ static int action_ok_help(const char *path, return menu_displaylist_push_list(&info, DISPLAYLIST_HELP); } -static int action_ok_playlist_collection(const char *path, - const char *label, unsigned type, size_t idx) -{ - RARCH_LOG("Gets here.\n"); - return 0; -} - static int action_ok_video_resolution(const char *path, const char *label, unsigned type, size_t idx) { @@ -1486,15 +1497,15 @@ void menu_entries_cbs_init_bind_ok(menu_file_list_cbs_t *cbs, case MENU_SETTINGS_VIDEO_RESOLUTION: cbs->action_ok = action_ok_video_resolution; break; - case MENU_FILE_PLAYLIST_COLLECTION: - cbs->action_ok = action_ok_playlist_collection; - break; case MENU_FILE_PLAYLIST_ENTRY: if (!strcmp(label, "rdb_entry_start_game")) cbs->action_ok = action_ok_rdb_playlist_entry; else cbs->action_ok = action_ok_playlist_entry; break; + case MENU_FILE_PLAYLIST_COLLECTION: + cbs->action_ok = action_ok_playlist_collection; + break; case MENU_FILE_CONTENTLIST_ENTRY: cbs->action_ok = action_ok_push_generic_list; break;