Don't reference menu->playlist outside menu_driver.c anymore

This commit is contained in:
twinaphex 2015-12-11 13:06:24 +01:00
parent 7b49964d39
commit 22b06f2d38
3 changed files with 22 additions and 8 deletions

View File

@ -1688,13 +1688,15 @@ static int menu_displaylist_parse_horizontal_list(menu_displaylist_info_t *info)
fill_pathname_join(path_playlist,
settings->playlist_directory, item->path,
sizeof(path_playlist));
menu->playlist = content_playlist_init(path_playlist,
COLLECTION_SIZE);
menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_INIT, (void*)path_playlist);
strlcpy(menu->db_playlist_file, path_playlist, sizeof(menu->db_playlist_file));
strlcpy(path_playlist,
menu_hash_to_str(MENU_LABEL_COLLECTION),
sizeof(path_playlist));
playlist = menu->playlist;
menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_GET, &playlist);
content_playlist_qsort(playlist, menu_displaylist_sort_playlist);
@ -2920,12 +2922,14 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
fill_pathname_join(path_playlist,
settings->playlist_directory, info->path,
sizeof(path_playlist));
menu->playlist = content_playlist_init(path_playlist,
COLLECTION_SIZE);
menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_INIT, (void*)path_playlist);
strlcpy(menu->db_playlist_file, path_playlist, sizeof(menu->db_playlist_file));
strlcpy(path_playlist,
menu_hash_to_str(MENU_LABEL_COLLECTION), sizeof(path_playlist));
playlist = menu->playlist;
menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_GET, &playlist);
content_playlist_qsort(playlist, menu_displaylist_sort_playlist);
@ -2953,8 +2957,8 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
strlcpy(menu->db_playlist_file, settings->content_history_path,
sizeof(menu->db_playlist_file));
menu->playlist = content_playlist_init(menu->db_playlist_file,
COLLECTION_SIZE);
menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_INIT, (void*)menu->db_playlist_file);
if (ret == 0)
{

View File

@ -667,6 +667,15 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
content_playlist_free(menu_driver_data->playlist);
menu_driver_data->playlist = NULL;
break;
case RARCH_MENU_CTL_PLAYLIST_INIT:
{
const char *path = (const char*)data;
if (!path || path[0] == '\0' || !menu_driver_data)
return false;
menu_driver_data->playlist = content_playlist_init(path,
COLLECTION_SIZE);
}
return true;
case RARCH_MENU_CTL_PLAYLIST_GET:
{
content_playlist_t **playlist = (content_playlist_t**)data;

View File

@ -117,6 +117,7 @@ enum rarch_menu_ctl_state
RARCH_MENU_CTL_SYSTEM_INFO_DEINIT,
RARCH_MENU_CTL_SYSTEM_INFO_GET,
RARCH_MENU_CTL_PLAYLIST_FREE,
RARCH_MENU_CTL_PLAYLIST_INIT,
RARCH_MENU_CTL_PLAYLIST_GET
};