mirror of
https://github.com/libretro/RetroArch
synced 2025-04-15 23:42:30 +00:00
(playlist.c) Don't expose struct details to outside
This commit is contained in:
parent
95f4910a94
commit
e9f9702a2d
@ -3093,20 +3093,29 @@ static int action_ok_delete_entry(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
size_t new_selection_ptr;
|
||||
playlist_t *playlist = NULL;
|
||||
playlist_t *playlist = NULL;
|
||||
char *conf_path = playlist_get_conf_path(playlist);
|
||||
char *def_conf_path = playlist_get_conf_path(g_defaults.content_history);
|
||||
char *def_conf_music_path= playlist_get_conf_path(g_defaults.music_history);
|
||||
#ifdef HAVE_FFMPEG
|
||||
char *def_conf_video_path= playlist_get_conf_path(g_defaults.video_history);
|
||||
#endif
|
||||
#ifdef HAVE_IMAGEVIEWER
|
||||
char *def_conf_img_path = playlist_get_conf_path(g_defaults.image_history);
|
||||
#endif
|
||||
|
||||
menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_GET, &playlist);
|
||||
|
||||
if (string_is_equal(playlist->conf_path, g_defaults.content_history->conf_path))
|
||||
if (string_is_equal(conf_path, def_conf_path))
|
||||
playlist = g_defaults.content_history;
|
||||
else if (string_is_equal(playlist->conf_path, g_defaults.music_history->conf_path))
|
||||
else if (string_is_equal(conf_path, def_conf_music_path))
|
||||
playlist = g_defaults.music_history;
|
||||
#ifdef HAVE_FFMPEG
|
||||
else if (string_is_equal(playlist->conf_path, g_defaults.video_history->conf_path))
|
||||
else if (string_is_equal(conf_path, def_conf_video_path))
|
||||
playlist = g_defaults.video_history;
|
||||
#endif
|
||||
#ifdef HAVE_IMAGEVIEWER
|
||||
else if (string_is_equal(playlist->conf_path, g_defaults.image_history->conf_path))
|
||||
else if (string_is_equal(conf_path, def_conf_img_path))
|
||||
playlist = g_defaults.image_history;
|
||||
#endif
|
||||
|
||||
|
34
playlist.c
34
playlist.c
@ -31,10 +31,44 @@
|
||||
#define PLAYLIST_ENTRIES 6
|
||||
#endif
|
||||
|
||||
struct playlist_entry
|
||||
{
|
||||
char *path;
|
||||
char *label;
|
||||
char *core_path;
|
||||
char *core_name;
|
||||
char *db_name;
|
||||
char *crc32;
|
||||
};
|
||||
|
||||
struct content_playlist
|
||||
{
|
||||
struct playlist_entry *entries;
|
||||
size_t size;
|
||||
size_t cap;
|
||||
bool modified;
|
||||
|
||||
char *conf_path;
|
||||
};
|
||||
|
||||
typedef int (playlist_sort_fun_t)(
|
||||
const struct playlist_entry *a,
|
||||
const struct playlist_entry *b);
|
||||
|
||||
uint32_t playlist_get_size(playlist_t *playlist)
|
||||
{
|
||||
if (!playlist)
|
||||
return 0;
|
||||
return (uint32_t)playlist->size;
|
||||
}
|
||||
|
||||
char *playlist_get_conf_path(playlist_t *playlist)
|
||||
{
|
||||
if (!playlist)
|
||||
return NULL;
|
||||
return playlist->conf_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* playlist_get_index:
|
||||
* @playlist : Playlist handle.
|
||||
|
24
playlist.h
24
playlist.h
@ -26,26 +26,6 @@ RETRO_BEGIN_DECLS
|
||||
|
||||
typedef struct content_playlist playlist_t;
|
||||
|
||||
struct playlist_entry
|
||||
{
|
||||
char *path;
|
||||
char *label;
|
||||
char *core_path;
|
||||
char *core_name;
|
||||
char *db_name;
|
||||
char *crc32;
|
||||
};
|
||||
|
||||
struct content_playlist
|
||||
{
|
||||
struct playlist_entry *entries;
|
||||
size_t size;
|
||||
size_t cap;
|
||||
bool modified;
|
||||
|
||||
char *conf_path;
|
||||
};
|
||||
|
||||
/**
|
||||
* playlist_init:
|
||||
* @path : Path to playlist contents file.
|
||||
@ -141,6 +121,10 @@ bool playlist_entry_exists(playlist_t *playlist,
|
||||
const char *path,
|
||||
const char *crc32);
|
||||
|
||||
char *playlist_get_conf_path(playlist_t *playlist);
|
||||
|
||||
uint32_t playlist_get_size(playlist_t *playlist);
|
||||
|
||||
void playlist_write_file(playlist_t *playlist);
|
||||
|
||||
void playlist_qsort(playlist_t *playlist);
|
||||
|
@ -174,23 +174,26 @@ static void task_netplay_crc_scan_handler(retro_task_t *task)
|
||||
for (i = 0; i < state->lpl_list->size; i++)
|
||||
{
|
||||
playlist_t *playlist = NULL;
|
||||
unsigned playlist_size = 0;
|
||||
const char *lpl_path = state->lpl_list->elems[i].data;
|
||||
|
||||
if (!strstr(lpl_path, file_path_str(FILE_PATH_LPL_EXTENSION)))
|
||||
continue;
|
||||
|
||||
playlist = playlist_init(lpl_path, 99999);
|
||||
playlist = playlist_init(lpl_path, 99999);
|
||||
playlist_size = playlist_get_size(playlist);
|
||||
|
||||
for (j = 0; j < playlist->size; j++)
|
||||
for (j = 0; j < playlist_size; j++)
|
||||
{
|
||||
#if 0
|
||||
RARCH_LOG("[lobby] playlist CRC: %s\n",
|
||||
playlist->entries[j].crc32);
|
||||
#endif
|
||||
if (string_is_equal(playlist->entries[j].crc32, state->content_crc))
|
||||
const char *playlist_crc32 = NULL;
|
||||
const char *playlist_path = NULL;
|
||||
playlist_get_index(playlist,
|
||||
j, &playlist_path, NULL, NULL, NULL, NULL, &playlist_crc32);
|
||||
|
||||
if (string_is_equal(playlist_crc32, state->content_crc))
|
||||
{
|
||||
RARCH_LOG("[lobby] CRC match %s\n", playlist->entries[j].crc32);
|
||||
strlcpy(state->content_path, playlist->entries[j].path, sizeof(state->content_path));
|
||||
RARCH_LOG("[lobby] CRC match %s\n", playlist_crc32);
|
||||
strlcpy(state->content_path, playlist_path, sizeof(state->content_path));
|
||||
state->found = true;
|
||||
task_set_data(task, state);
|
||||
task_set_progress(task, 100);
|
||||
@ -202,7 +205,7 @@ static void task_netplay_crc_scan_handler(retro_task_t *task)
|
||||
return;
|
||||
}
|
||||
|
||||
task_set_progress(task, (int)(j/playlist->size*100.0));
|
||||
task_set_progress(task, (int)(j / playlist_size * 100.0));
|
||||
}
|
||||
|
||||
free(playlist);
|
||||
@ -222,17 +225,22 @@ filename_matching:
|
||||
for (i = 0; i < state->lpl_list->size; i++)
|
||||
{
|
||||
playlist_t *playlist = NULL;
|
||||
unsigned playlist_size = 0;
|
||||
const char *lpl_path = state->lpl_list->elems[i].data;
|
||||
|
||||
if (!strstr(lpl_path, file_path_str(FILE_PATH_LPL_EXTENSION)))
|
||||
continue;
|
||||
|
||||
playlist = playlist_init(lpl_path, 99999);
|
||||
playlist = playlist_init(lpl_path, 99999);
|
||||
playlist_size = playlist_get_size(playlist);
|
||||
|
||||
for (j = 0; j < playlist->size; j++)
|
||||
for (j = 0; j < playlist_size; j++)
|
||||
{
|
||||
const char *playlist_path = NULL;
|
||||
playlist_get_index(playlist,
|
||||
j, &playlist_path, NULL, NULL, NULL, NULL, NULL);
|
||||
char entry[PATH_MAX_LENGTH];
|
||||
const char* buf = path_basename(playlist->entries[j].path);
|
||||
const char* buf = path_basename(playlist_path);
|
||||
|
||||
entry[0] = '\0';
|
||||
|
||||
@ -240,18 +248,13 @@ filename_matching:
|
||||
|
||||
path_remove_extension(entry);
|
||||
|
||||
#if 0
|
||||
RARCH_LOG("[lobby] playlist filename: %s\n",
|
||||
playlist->entries[j].path);
|
||||
#endif
|
||||
|
||||
if ( !string_is_empty(entry) &&
|
||||
string_is_equal(entry, state->content_path) &&
|
||||
strstr(state->core_extensions, path_get_extension(playlist->entries[j].path)))
|
||||
strstr(state->core_extensions, path_get_extension(playlist_path)))
|
||||
{
|
||||
RARCH_LOG("[lobby] filename match %s\n", playlist->entries[j].path);
|
||||
RARCH_LOG("[lobby] filename match %s\n", playlist_path);
|
||||
|
||||
strlcpy(state->content_path, playlist->entries[j].path, sizeof(state->content_path));
|
||||
strlcpy(state->content_path, playlist_path, sizeof(state->content_path));
|
||||
state->found = true;
|
||||
task_set_data(task, state);
|
||||
task_set_progress(task, 100);
|
||||
@ -263,7 +266,7 @@ filename_matching:
|
||||
return;
|
||||
}
|
||||
|
||||
task_set_progress(task, (int)(j/playlist->size*100.0));
|
||||
task_set_progress(task, (int)(j / playlist_size * 100.0));
|
||||
}
|
||||
free(playlist);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user