mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
add subsystem support for playlists, only missing the content load portion
This commit is contained in:
parent
2bfb073b3e
commit
230c64ba4b
@ -2415,7 +2415,8 @@ TODO: Add a setting for these tweaks */
|
||||
str_list->elems[2].data, /* core_path */
|
||||
str_list->elems[3].data, /* core_name */
|
||||
str_list->elems[4].data, /* crc32 */
|
||||
str_list->elems[5].data /* db_name */
|
||||
str_list->elems[5].data, /* db_name */
|
||||
NULL, NULL
|
||||
);
|
||||
runloop_msg_queue_push(msg_hash_to_str(MSG_ADDED_TO_FAVORITES), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
}
|
||||
|
@ -349,7 +349,7 @@ void discord_update(enum discord_presence presence)
|
||||
|
||||
if (current_playlist)
|
||||
playlist_get_index_by_path(
|
||||
current_playlist, path_get(RARCH_PATH_CONTENT), NULL, &label, NULL, NULL, NULL, NULL);
|
||||
current_playlist, path_get(RARCH_PATH_CONTENT), NULL, &label, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
if (!label)
|
||||
label = (char *)path_basename(path_get(RARCH_PATH_BASENAME));
|
||||
|
@ -967,7 +967,7 @@ static bool menu_content_playlist_load(playlist_t *playlist, size_t idx)
|
||||
const char *path = NULL;
|
||||
|
||||
playlist_get_index(playlist,
|
||||
idx, &path, NULL, NULL, NULL, NULL, NULL);
|
||||
idx, &path, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
if (!string_is_empty(path))
|
||||
{
|
||||
@ -1735,7 +1735,7 @@ static int action_ok_playlist_entry_collection(const char *path,
|
||||
selection_ptr = entry_idx;
|
||||
|
||||
playlist_get_index(playlist, selection_ptr,
|
||||
&entry_path, &entry_label, &core_path, &core_name, NULL, NULL);
|
||||
&entry_path, &entry_label, &core_path, &core_name, NULL, NULL, NULL, NULL);
|
||||
|
||||
/* Is the core path / name of the playlist entry not yet filled in? */
|
||||
if ( string_is_equal(core_path, file_path_str(FILE_PATH_DETECT))
|
||||
@ -1794,7 +1794,7 @@ static int action_ok_playlist_entry_collection(const char *path,
|
||||
}
|
||||
|
||||
playlist_get_index(playlist,
|
||||
selection_ptr, &path, NULL, NULL, NULL, NULL, NULL);
|
||||
selection_ptr, &path, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
return default_action_ok_load_content_from_playlist_from_menu(
|
||||
new_core_path, path, entry_label);
|
||||
@ -1820,7 +1820,7 @@ static int action_ok_playlist_entry(const char *path,
|
||||
selection_ptr = entry_idx;
|
||||
|
||||
playlist_get_index(playlist, selection_ptr,
|
||||
&entry_path, &entry_label, &core_path, &core_name, NULL, NULL);
|
||||
&entry_path, &entry_label, &core_path, &core_name, NULL, NULL, NULL, NULL);
|
||||
|
||||
if ( string_is_equal(core_path, file_path_str(FILE_PATH_DETECT))
|
||||
&& string_is_equal(core_name, file_path_str(FILE_PATH_DETECT)))
|
||||
@ -1869,7 +1869,7 @@ static int action_ok_playlist_entry(const char *path,
|
||||
|
||||
playlist_get_index(playlist,
|
||||
selection_ptr, &path, NULL, NULL, NULL,
|
||||
NULL, NULL);
|
||||
NULL, NULL, NULL, NULL);
|
||||
|
||||
return default_action_ok_load_content_from_playlist_from_menu(
|
||||
new_core_path, path, entry_label);
|
||||
@ -1893,7 +1893,7 @@ static int action_ok_playlist_entry_start_content(const char *path,
|
||||
selection_ptr = menu->scratchpad.unsigned_var;
|
||||
|
||||
playlist_get_index(playlist, selection_ptr,
|
||||
&entry_path, &entry_label, &core_path, &core_name, NULL, NULL);
|
||||
&entry_path, &entry_label, &core_path, &core_name, NULL, NULL, NULL, NULL);
|
||||
|
||||
if ( string_is_equal(core_path, file_path_str(FILE_PATH_DETECT))
|
||||
&& string_is_equal(core_name, file_path_str(FILE_PATH_DETECT)))
|
||||
@ -1943,7 +1943,7 @@ static int action_ok_playlist_entry_start_content(const char *path,
|
||||
}
|
||||
|
||||
playlist_get_index(playlist,
|
||||
selection_ptr, &path, NULL, NULL, NULL, NULL, NULL);
|
||||
selection_ptr, &path, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
return default_action_ok_load_content_from_playlist_from_menu(core_path, path, entry_label);
|
||||
|
||||
@ -2067,7 +2067,7 @@ static int action_ok_audio_add_to_mixer(const char *path,
|
||||
return -1;
|
||||
|
||||
playlist_get_index(tmp_playlist, entry_idx,
|
||||
&entry_path, NULL, NULL, NULL, NULL, NULL);
|
||||
&entry_path, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
if (filestream_exists(entry_path))
|
||||
task_push_audio_mixer_load(entry_path,
|
||||
@ -2089,7 +2089,7 @@ static int action_ok_audio_add_to_mixer_and_play(const char *path,
|
||||
return -1;
|
||||
|
||||
playlist_get_index(tmp_playlist, entry_idx,
|
||||
&entry_path, NULL, NULL, NULL, NULL, NULL);
|
||||
&entry_path, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
if (filestream_exists(entry_path))
|
||||
task_push_audio_mixer_load_and_play(entry_path,
|
||||
@ -2120,8 +2120,8 @@ static int action_ok_audio_add_to_mixer_and_collection(const char *path,
|
||||
NULL,
|
||||
"builtin",
|
||||
"musicplayer",
|
||||
NULL,
|
||||
NULL);
|
||||
NULL, NULL,
|
||||
NULL, NULL);
|
||||
|
||||
if (filestream_exists(combined_path))
|
||||
task_push_audio_mixer_load(combined_path,
|
||||
@ -2152,8 +2152,8 @@ static int action_ok_audio_add_to_mixer_and_collection_and_play(const char *path
|
||||
NULL,
|
||||
"builtin",
|
||||
"musicplayer",
|
||||
NULL,
|
||||
NULL);
|
||||
NULL, NULL,
|
||||
NULL, NULL);
|
||||
|
||||
if (filestream_exists(combined_path))
|
||||
task_push_audio_mixer_load_and_play(combined_path,
|
||||
@ -3803,7 +3803,7 @@ static int action_ok_reset_core_association(const char *path,
|
||||
|
||||
playlist_get_index(tmp_playlist,
|
||||
menu->rpl_entry_selection_ptr,
|
||||
&tmp_path, NULL, NULL, NULL, NULL, NULL);
|
||||
&tmp_path, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
if (!command_event(CMD_EVENT_RESET_CORE_ASSOCIATION,
|
||||
(void *)&menu->rpl_entry_selection_ptr))
|
||||
@ -3947,7 +3947,7 @@ static int action_ok_add_to_favorites_playlist(const char *path,
|
||||
/* Read current playlist parameters */
|
||||
playlist_get_index(playlist_curr, menu->rpl_entry_selection_ptr,
|
||||
&content_path, &content_label, &core_path, &core_name,
|
||||
&crc32, NULL);
|
||||
&crc32, NULL, NULL, NULL);
|
||||
|
||||
/* Error checking
|
||||
* > If content path is empty, cannot do anything... */
|
||||
|
@ -859,7 +859,7 @@ static int action_bind_sublabel_playlist_entry(
|
||||
return 0;
|
||||
|
||||
/* Read playlist entry */
|
||||
playlist_get_index(playlist, i, NULL, NULL, NULL, &core_name, NULL, NULL);
|
||||
playlist_get_index(playlist, i, NULL, NULL, NULL, &core_name, NULL, NULL, NULL, NULL);
|
||||
|
||||
/* Only add sublabel if a core is currently assigned */
|
||||
if (string_is_empty(core_name) || string_is_equal(core_name, file_path_str(FILE_PATH_DETECT)))
|
||||
|
@ -1141,7 +1141,7 @@ void ozone_update_content_metadata(ozone_handle_t *ozone)
|
||||
{
|
||||
const char *core_label = NULL;
|
||||
playlist_get_index(playlist, selection,
|
||||
NULL, NULL, NULL, &core_name, NULL, NULL);
|
||||
NULL, NULL, NULL, &core_name, NULL, NULL, NULL, NULL);
|
||||
|
||||
/* Fill core name */
|
||||
if (!core_name || string_is_equal(core_name, "DETECT"))
|
||||
|
@ -905,7 +905,7 @@ static void stripes_update_thumbnail_path(void *data, unsigned i, char pos)
|
||||
{
|
||||
const char *core_name = NULL;
|
||||
playlist_get_index(playlist, i,
|
||||
NULL, NULL, NULL, &core_name, NULL, NULL);
|
||||
NULL, NULL, NULL, &core_name, NULL, NULL, NULL, NULL);
|
||||
|
||||
if (string_is_equal(core_name, "imageviewer"))
|
||||
{
|
||||
|
@ -1354,7 +1354,7 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info,
|
||||
|
||||
/* Read playlist entry */
|
||||
playlist_get_index(playlist, i,
|
||||
&path, &label, &core_path, &core_name, NULL, NULL);
|
||||
&path, &label, &core_path, &core_name, NULL, NULL, NULL, NULL);
|
||||
|
||||
/* Extract any available runtime values, if required */
|
||||
if (get_runtime)
|
||||
@ -1741,7 +1741,7 @@ static int menu_displaylist_parse_database_entry(menu_handle_t *menu,
|
||||
|
||||
playlist_get_index(playlist, j,
|
||||
NULL, NULL, NULL, NULL,
|
||||
&crc32, NULL);
|
||||
&crc32, NULL, NULL, NULL);
|
||||
|
||||
if (crc32)
|
||||
tmp_str_list = string_split(crc32, "|");
|
||||
@ -2890,7 +2890,7 @@ static int menu_displaylist_parse_horizontal_content_actions(
|
||||
|
||||
if (playlist)
|
||||
playlist_get_index(playlist, idx,
|
||||
&entry_path, &label, &core_path, &core_name, NULL, &db_name);
|
||||
&entry_path, &label, &core_path, &core_name, NULL, &db_name, NULL, NULL);
|
||||
|
||||
content_loaded = !rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)
|
||||
&& string_is_equal(menu->deferred_path, fullpath);
|
||||
|
@ -340,7 +340,7 @@ bool menu_thumbnail_set_content_playlist(menu_thumbnail_path_data_t *path_data,
|
||||
|
||||
/* Read playlist values */
|
||||
playlist_get_index(playlist, idx,
|
||||
&content_path, &content_label, NULL, &core_name, NULL, &db_name);
|
||||
&content_path, &content_label, NULL, &core_name, NULL, &db_name, NULL, NULL);
|
||||
|
||||
/* Content without a path is invalid by definition */
|
||||
if (string_is_empty(content_path))
|
||||
|
182
playlist.c
182
playlist.c
@ -27,6 +27,7 @@
|
||||
#include <streams/interface_stream.h>
|
||||
#include <streams/file_stream.h>
|
||||
#include <file/file_path.h>
|
||||
#include <lists/string_list.h>
|
||||
#include <formats/jsonsax_full.h>
|
||||
|
||||
#include "playlist.h"
|
||||
@ -46,6 +47,8 @@ struct playlist_entry
|
||||
char *core_name;
|
||||
char *db_name;
|
||||
char *crc32;
|
||||
char *subsystem_ident;
|
||||
struct string_list *subsystem_roms;
|
||||
unsigned runtime_hours;
|
||||
unsigned runtime_minutes;
|
||||
unsigned runtime_seconds;
|
||||
@ -82,8 +85,11 @@ typedef struct
|
||||
char **current_entry_val;
|
||||
int *current_entry_int_val;
|
||||
unsigned *current_entry_uint_val;
|
||||
struct string_list **current_entry_string_list_val;
|
||||
char *current_meta_string;
|
||||
char *current_items_string;
|
||||
bool in_items;
|
||||
bool in_subsystem_roms;
|
||||
} JSONContext;
|
||||
|
||||
static playlist_t *playlist_cached = NULL;
|
||||
@ -121,7 +127,9 @@ void playlist_get_index(playlist_t *playlist,
|
||||
const char **path, const char **label,
|
||||
const char **core_path, const char **core_name,
|
||||
const char **crc32,
|
||||
const char **db_name)
|
||||
const char **db_name,
|
||||
const char **subsystem_ident,
|
||||
const struct string_list **subsystem_roms)
|
||||
{
|
||||
if (!playlist)
|
||||
return;
|
||||
@ -138,6 +146,10 @@ void playlist_get_index(playlist_t *playlist,
|
||||
*db_name = playlist->entries[idx].db_name;
|
||||
if (crc32)
|
||||
*crc32 = playlist->entries[idx].crc32;
|
||||
if (subsystem_ident)
|
||||
*subsystem_ident = playlist->entries[idx].subsystem_ident;
|
||||
if (subsystem_roms)
|
||||
*subsystem_roms = playlist->entries[idx].subsystem_roms;
|
||||
}
|
||||
|
||||
void playlist_get_runtime_index(playlist_t *playlist,
|
||||
@ -200,7 +212,9 @@ void playlist_get_index_by_path(playlist_t *playlist,
|
||||
char **path, char **label,
|
||||
char **core_path, char **core_name,
|
||||
char **crc32,
|
||||
char **db_name)
|
||||
char **db_name,
|
||||
char **subsystem_ident,
|
||||
struct string_list **subsystem_roms)
|
||||
{
|
||||
size_t i;
|
||||
if (!playlist)
|
||||
@ -223,6 +237,10 @@ void playlist_get_index_by_path(playlist_t *playlist,
|
||||
*db_name = playlist->entries[i].db_name;
|
||||
if (crc32)
|
||||
*crc32 = playlist->entries[i].crc32;
|
||||
if (subsystem_ident)
|
||||
*subsystem_ident = playlist->entries[i].subsystem_ident;
|
||||
if (subsystem_roms)
|
||||
*subsystem_roms = playlist->entries[i].subsystem_roms;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -265,6 +283,10 @@ static void playlist_free_entry(struct playlist_entry *entry)
|
||||
free(entry->db_name);
|
||||
if (entry->crc32 != NULL)
|
||||
free(entry->crc32);
|
||||
if (entry->subsystem_ident != NULL)
|
||||
free(entry->subsystem_ident);
|
||||
if (entry->subsystem_roms != NULL)
|
||||
string_list_free(entry->subsystem_roms);
|
||||
|
||||
entry->path = NULL;
|
||||
entry->label = NULL;
|
||||
@ -272,6 +294,8 @@ static void playlist_free_entry(struct playlist_entry *entry)
|
||||
entry->core_name = NULL;
|
||||
entry->db_name = NULL;
|
||||
entry->crc32 = NULL;
|
||||
entry->subsystem_ident = NULL;
|
||||
entry->subsystem_roms = NULL;
|
||||
entry->runtime_hours = 0;
|
||||
entry->runtime_minutes = 0;
|
||||
entry->runtime_seconds = 0;
|
||||
@ -544,7 +568,9 @@ bool playlist_push(playlist_t *playlist,
|
||||
const char *path, const char *label,
|
||||
const char *core_path, const char *core_name,
|
||||
const char *crc32,
|
||||
const char *db_name)
|
||||
const char *db_name,
|
||||
const char *subsystem_ident,
|
||||
const struct string_list *subsystem_roms)
|
||||
{
|
||||
size_t i;
|
||||
bool core_path_empty = string_is_empty(core_path);
|
||||
@ -595,6 +621,37 @@ bool playlist_push(playlist_t *playlist,
|
||||
if (!string_is_equal(playlist->entries[i].core_path, core_path))
|
||||
continue;
|
||||
|
||||
if (!string_is_empty(subsystem_ident) && !string_is_empty(playlist->entries[i].subsystem_ident) && !string_is_equal(playlist->entries[i].subsystem_ident, subsystem_ident))
|
||||
continue;
|
||||
|
||||
if (string_is_empty(subsystem_ident) && !string_is_empty(playlist->entries[i].subsystem_ident))
|
||||
continue;
|
||||
|
||||
if (!string_is_empty(subsystem_ident) && string_is_empty(playlist->entries[i].subsystem_ident))
|
||||
continue;
|
||||
|
||||
if (subsystem_roms)
|
||||
{
|
||||
int j;
|
||||
const struct string_list *roms = playlist->entries[i].subsystem_roms;
|
||||
bool unequal = false;
|
||||
|
||||
if (subsystem_roms->size != roms->size)
|
||||
continue;
|
||||
|
||||
for (j = 0; j < subsystem_roms->size; j++)
|
||||
{
|
||||
if (!string_is_equal(subsystem_roms->elems[j].data, roms->elems[j].data))
|
||||
{
|
||||
unequal = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (unequal)
|
||||
continue;
|
||||
}
|
||||
|
||||
/* If top entry, we don't want to push a new entry since
|
||||
* the top and the entry to be pushed are the same. */
|
||||
if (i == 0)
|
||||
@ -629,6 +686,8 @@ bool playlist_push(playlist_t *playlist,
|
||||
playlist->entries[0].core_name = NULL;
|
||||
playlist->entries[0].db_name = NULL;
|
||||
playlist->entries[0].crc32 = NULL;
|
||||
playlist->entries[0].subsystem_ident = NULL;
|
||||
playlist->entries[0].subsystem_roms = NULL;
|
||||
playlist->entries[0].runtime_hours = 0;
|
||||
playlist->entries[0].runtime_minutes = 0;
|
||||
playlist->entries[0].runtime_seconds = 0;
|
||||
@ -650,6 +709,19 @@ bool playlist_push(playlist_t *playlist,
|
||||
playlist->entries[0].db_name = strdup(db_name);
|
||||
if (!string_is_empty(crc32))
|
||||
playlist->entries[0].crc32 = strdup(crc32);
|
||||
if (!string_is_empty(subsystem_ident))
|
||||
playlist->entries[0].subsystem_ident = strdup(subsystem_ident);
|
||||
if (subsystem_roms)
|
||||
{
|
||||
union string_list_elem_attr attributes = {0};
|
||||
|
||||
playlist->entries[0].subsystem_roms = string_list_new();
|
||||
|
||||
for (i = 0; i < subsystem_roms->size; i++)
|
||||
{
|
||||
string_list_append(playlist->entries[0].subsystem_roms, subsystem_roms->elems[i].data, attributes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
playlist->size++;
|
||||
@ -1001,6 +1073,49 @@ void playlist_write_file(playlist_t *playlist)
|
||||
JSON_Writer_WriteColon(context.writer);
|
||||
JSON_Writer_WriteSpace(context.writer, 1);
|
||||
JSON_Writer_WriteString(context.writer, playlist->entries[i].db_name ? playlist->entries[i].db_name : "", playlist->entries[i].db_name ? strlen(playlist->entries[i].db_name) : 0, JSON_UTF8);
|
||||
|
||||
if (!string_is_empty(playlist->entries[i].subsystem_ident))
|
||||
{
|
||||
JSON_Writer_WriteComma(context.writer);
|
||||
JSON_Writer_WriteNewLine(context.writer);
|
||||
JSON_Writer_WriteSpace(context.writer, 6);
|
||||
JSON_Writer_WriteString(context.writer, "subsystem_ident", strlen("subsystem_ident"), JSON_UTF8);
|
||||
JSON_Writer_WriteColon(context.writer);
|
||||
JSON_Writer_WriteSpace(context.writer, 1);
|
||||
JSON_Writer_WriteString(context.writer, playlist->entries[i].subsystem_ident ? playlist->entries[i].subsystem_ident : "", playlist->entries[i].subsystem_ident ? strlen(playlist->entries[i].subsystem_ident) : 0, JSON_UTF8);
|
||||
}
|
||||
|
||||
if (playlist->entries[i].subsystem_roms && playlist->entries[i].subsystem_roms->size > 0)
|
||||
{
|
||||
int j;
|
||||
|
||||
JSON_Writer_WriteComma(context.writer);
|
||||
JSON_Writer_WriteNewLine(context.writer);
|
||||
JSON_Writer_WriteSpace(context.writer, 6);
|
||||
JSON_Writer_WriteString(context.writer, "subsystem_roms", strlen("subsystem_roms"), JSON_UTF8);
|
||||
JSON_Writer_WriteColon(context.writer);
|
||||
JSON_Writer_WriteSpace(context.writer, 1);
|
||||
JSON_Writer_WriteStartArray(context.writer);
|
||||
JSON_Writer_WriteNewLine(context.writer);
|
||||
|
||||
for (j = 0; j < playlist->entries[i].subsystem_roms->size; j++)
|
||||
{
|
||||
const struct string_list *roms = playlist->entries[i].subsystem_roms;
|
||||
JSON_Writer_WriteSpace(context.writer, 8);
|
||||
JSON_Writer_WriteString(context.writer, !string_is_empty(roms->elems[j].data) ? roms->elems[j].data : "", !string_is_empty(roms->elems[j].data) ? strlen(roms->elems[j].data) : 0, JSON_UTF8);
|
||||
|
||||
if (j < playlist->entries[i].subsystem_roms->size - 1)
|
||||
{
|
||||
JSON_Writer_WriteComma(context.writer);
|
||||
JSON_Writer_WriteNewLine(context.writer);
|
||||
}
|
||||
}
|
||||
|
||||
JSON_Writer_WriteNewLine(context.writer);
|
||||
JSON_Writer_WriteSpace(context.writer, 6);
|
||||
JSON_Writer_WriteEndArray(context.writer);
|
||||
}
|
||||
|
||||
JSON_Writer_WriteNewLine(context.writer);
|
||||
|
||||
JSON_Writer_WriteSpace(context.writer, 4);
|
||||
@ -1106,6 +1221,12 @@ static JSON_Parser_HandlerResult JSONStartArrayHandler(JSON_Parser parser)
|
||||
if (string_is_equal(pCtx->current_meta_string, "items") && pCtx->array_depth == 1)
|
||||
pCtx->in_items = true;
|
||||
}
|
||||
else if (pCtx->object_depth == 2)
|
||||
{
|
||||
if (pCtx->array_depth == 2)
|
||||
if (string_is_equal(pCtx->current_items_string, "subsystem_roms"))
|
||||
pCtx->in_subsystem_roms = true;
|
||||
}
|
||||
|
||||
return JSON_Parser_Continue;
|
||||
}
|
||||
@ -1125,6 +1246,19 @@ static JSON_Parser_HandlerResult JSONEndArrayHandler(JSON_Parser parser)
|
||||
free(pCtx->current_meta_string);
|
||||
pCtx->current_meta_string = NULL;
|
||||
pCtx->in_items = false;
|
||||
|
||||
if (pCtx->current_items_string)
|
||||
{
|
||||
free(pCtx->current_items_string);
|
||||
pCtx->current_items_string = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (pCtx->object_depth == 2)
|
||||
{
|
||||
if (pCtx->in_subsystem_roms && string_is_equal(pCtx->current_items_string, "subsystem_roms") && pCtx->array_depth == 1)
|
||||
{
|
||||
pCtx->in_subsystem_roms = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1174,7 +1308,19 @@ static JSON_Parser_HandlerResult JSONStringHandler(JSON_Parser parser, char *pVa
|
||||
JSONContext *pCtx = (JSONContext*)JSON_Parser_GetUserData(parser);
|
||||
(void)attributes; /* unused */
|
||||
|
||||
if (pCtx->in_items && pCtx->object_depth == 2)
|
||||
if (pCtx->in_items && pCtx->in_subsystem_roms && pCtx->object_depth == 2 && pCtx->array_depth == 2)
|
||||
{
|
||||
if (pCtx->current_entry_string_list_val && length && !string_is_empty(pValue))
|
||||
{
|
||||
union string_list_elem_attr attr = {0};
|
||||
|
||||
if (!*pCtx->current_entry_string_list_val)
|
||||
*pCtx->current_entry_string_list_val = string_list_new();
|
||||
|
||||
string_list_append(*pCtx->current_entry_string_list_val, pValue, attr);
|
||||
}
|
||||
}
|
||||
else if (pCtx->in_items && pCtx->object_depth == 2)
|
||||
{
|
||||
if (pCtx->array_depth == 1)
|
||||
{
|
||||
@ -1269,6 +1415,13 @@ static JSON_Parser_HandlerResult JSONObjectMemberHandler(JSON_Parser parser, cha
|
||||
|
||||
if (length)
|
||||
{
|
||||
if (!string_is_empty(pValue))
|
||||
{
|
||||
if (!string_is_empty(pCtx->current_items_string))
|
||||
free(pCtx->current_items_string);
|
||||
pCtx->current_items_string = strdup(pValue);
|
||||
}
|
||||
|
||||
if (string_is_equal(pValue, "path"))
|
||||
pCtx->current_entry_val = &pCtx->current_entry->path;
|
||||
else if (string_is_equal(pValue, "label"))
|
||||
@ -1281,6 +1434,10 @@ static JSON_Parser_HandlerResult JSONObjectMemberHandler(JSON_Parser parser, cha
|
||||
pCtx->current_entry_val = &pCtx->current_entry->crc32;
|
||||
else if (string_is_equal(pValue, "db_name"))
|
||||
pCtx->current_entry_val = &pCtx->current_entry->db_name;
|
||||
else if (string_is_equal(pValue, "subsystem_ident"))
|
||||
pCtx->current_entry_val = &pCtx->current_entry->subsystem_ident;
|
||||
else if (string_is_equal(pValue, "subsystem_roms"))
|
||||
pCtx->current_entry_string_list_val = &pCtx->current_entry->subsystem_roms;
|
||||
else if (string_is_equal(pValue, "runtime_hours"))
|
||||
pCtx->current_entry_uint_val = &pCtx->current_entry->runtime_hours;
|
||||
else if (string_is_equal(pValue, "runtime_minutes"))
|
||||
@ -1441,6 +1598,9 @@ static bool playlist_read_file(
|
||||
|
||||
if (context.current_meta_string)
|
||||
free(context.current_meta_string);
|
||||
|
||||
if (context.current_items_string)
|
||||
free(context.current_items_string);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1464,9 +1624,9 @@ static bool playlist_read_file(
|
||||
/* Read playlist entry and terminate string with NUL character
|
||||
* regardless of Windows or Unix line endings
|
||||
*/
|
||||
if((last = strrchr(buf[i], '\r')))
|
||||
if ((last = strrchr(buf[i], '\r')))
|
||||
*last = '\0';
|
||||
else if((last = strrchr(buf[i], '\n')))
|
||||
else if ((last = strrchr(buf[i], '\n')))
|
||||
*last = '\0';
|
||||
}
|
||||
|
||||
@ -1577,6 +1737,7 @@ static int playlist_qsort_func(const struct playlist_entry *a,
|
||||
goto end;
|
||||
|
||||
a_fallback_label = (char*)calloc(PATH_MAX_LENGTH, sizeof(char));
|
||||
|
||||
if (!a_fallback_label)
|
||||
goto end;
|
||||
|
||||
@ -1594,6 +1755,7 @@ static int playlist_qsort_func(const struct playlist_entry *a,
|
||||
goto end;
|
||||
|
||||
b_fallback_label = (char*)calloc(PATH_MAX_LENGTH, sizeof(char));
|
||||
|
||||
if (!b_fallback_label)
|
||||
goto end;
|
||||
|
||||
@ -1641,7 +1803,9 @@ void command_playlist_push_write(
|
||||
const char *core_path,
|
||||
const char *core_name,
|
||||
const char *crc32,
|
||||
const char *db_name)
|
||||
const char *db_name,
|
||||
const char *subsystem_ident,
|
||||
const struct string_list *subsystem_roms)
|
||||
{
|
||||
if (!playlist)
|
||||
return;
|
||||
@ -1653,7 +1817,9 @@ void command_playlist_push_write(
|
||||
core_path,
|
||||
core_name,
|
||||
crc32,
|
||||
db_name
|
||||
db_name,
|
||||
subsystem_ident,
|
||||
subsystem_roms
|
||||
))
|
||||
playlist_write_file(playlist);
|
||||
}
|
||||
|
17
playlist.h
17
playlist.h
@ -21,6 +21,7 @@
|
||||
|
||||
#include <retro_common_api.h>
|
||||
#include <boolean.h>
|
||||
#include <lists/string_list.h>
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
@ -77,7 +78,9 @@ void playlist_get_index(playlist_t *playlist,
|
||||
const char **path, const char **label,
|
||||
const char **core_path, const char **core_name,
|
||||
const char **crc32,
|
||||
const char **db_name);
|
||||
const char **db_name,
|
||||
const char **subsystem_ident,
|
||||
const struct string_list **subsystem_roms);
|
||||
|
||||
void playlist_get_runtime_index(playlist_t *playlist,
|
||||
size_t idx,
|
||||
@ -109,7 +112,9 @@ bool playlist_push(playlist_t *playlist,
|
||||
const char *path, const char *label,
|
||||
const char *core_path, const char *core_name,
|
||||
const char *crc32,
|
||||
const char *db_name);
|
||||
const char *db_name,
|
||||
const char *subsystem_ident,
|
||||
const struct string_list *subsystem_roms);
|
||||
|
||||
bool playlist_push_runtime(playlist_t *playlist,
|
||||
const char *path, const char *core_path,
|
||||
@ -140,7 +145,9 @@ void playlist_get_index_by_path(playlist_t *playlist,
|
||||
char **path, char **label,
|
||||
char **core_path, char **core_name,
|
||||
char **crc32,
|
||||
char **db_name);
|
||||
char **db_name,
|
||||
char **subsystem_ident,
|
||||
struct string_list **subsystem_roms);
|
||||
|
||||
bool playlist_entry_exists(playlist_t *playlist,
|
||||
const char *path,
|
||||
@ -169,7 +176,9 @@ void command_playlist_push_write(
|
||||
const char *core_path,
|
||||
const char *core_name,
|
||||
const char *crc32,
|
||||
const char *db_name);
|
||||
const char *db_name,
|
||||
const char *subsystem_ident,
|
||||
const struct string_list *subsystem_roms);
|
||||
|
||||
void command_playlist_update_write(
|
||||
playlist_t *playlist,
|
||||
|
@ -1094,7 +1094,9 @@ static bool task_load_content(content_ctx_info_t *content_info,
|
||||
core_path,
|
||||
core_name,
|
||||
crc32,
|
||||
db_name);
|
||||
db_name,
|
||||
path_get(RARCH_PATH_SUBSYSTEM),
|
||||
path_get_subsystem_list());
|
||||
}
|
||||
|
||||
free(tmp);
|
||||
|
@ -843,13 +843,14 @@ static int database_info_list_iterate_found_match(
|
||||
fprintf(stderr, "entry path str: %s\n", entry_path_str);
|
||||
#endif
|
||||
|
||||
if(!playlist_entry_exists(playlist, entry_path_str, db_crc))
|
||||
if (!playlist_entry_exists(playlist, entry_path_str, db_crc))
|
||||
{
|
||||
playlist_push(playlist, entry_path_str,
|
||||
db_info_entry->name,
|
||||
file_path_str(FILE_PATH_DETECT),
|
||||
file_path_str(FILE_PATH_DETECT),
|
||||
db_crc, db_playlist_base_str);
|
||||
db_crc, db_playlist_base_str,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
playlist_write_file(playlist);
|
||||
@ -1010,7 +1011,7 @@ static int task_database_iterate_playlist_lutro(
|
||||
|
||||
free(db_playlist_path);
|
||||
|
||||
if(!playlist_entry_exists(playlist,
|
||||
if (!playlist_entry_exists(playlist,
|
||||
path, file_path_str(FILE_PATH_DETECT)))
|
||||
{
|
||||
char *game_title = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
@ -1025,7 +1026,8 @@ static int task_database_iterate_playlist_lutro(
|
||||
file_path_str(FILE_PATH_DETECT),
|
||||
file_path_str(FILE_PATH_DETECT),
|
||||
file_path_str(FILE_PATH_DETECT),
|
||||
file_path_str(FILE_PATH_LUTRO_PLAYLIST));
|
||||
file_path_str(FILE_PATH_LUTRO_PLAYLIST),
|
||||
NULL, NULL);
|
||||
|
||||
free(game_title);
|
||||
}
|
||||
|
@ -277,7 +277,7 @@ static void task_netplay_crc_scan_handler(retro_task_t *task)
|
||||
const char *playlist_crc32 = NULL;
|
||||
const char *playlist_path = NULL;
|
||||
|
||||
playlist_get_index(playlist, j, &playlist_path, NULL, NULL, NULL, &playlist_crc32, NULL);
|
||||
playlist_get_index(playlist, j, &playlist_path, NULL, NULL, NULL, &playlist_crc32, NULL, NULL, NULL);
|
||||
|
||||
if(have_crc && string_is_equal(playlist_crc32, state->content_crc))
|
||||
{
|
||||
@ -345,7 +345,7 @@ static void task_netplay_crc_scan_handler(retro_task_t *task)
|
||||
const char *playlist_crc32 = NULL;
|
||||
const char *playlist_path = NULL;
|
||||
|
||||
playlist_get_index(playlist, k, &playlist_path, NULL, NULL, NULL, &playlist_crc32, NULL);
|
||||
playlist_get_index(playlist, k, &playlist_path, NULL, NULL, NULL, &playlist_crc32, NULL, NULL, NULL);
|
||||
get_entry(entry, sizeof(entry), playlist_path);
|
||||
|
||||
if(!string_is_empty(entry) &&
|
||||
|
@ -176,8 +176,8 @@ static void task_screenshot_handler(retro_task_t *task)
|
||||
NULL,
|
||||
"builtin",
|
||||
"imageviewer",
|
||||
NULL,
|
||||
NULL);
|
||||
NULL, NULL,
|
||||
NULL, NULL);
|
||||
#endif
|
||||
|
||||
task_set_progress(task, 100);
|
||||
|
@ -602,7 +602,7 @@ void MainWindow::addFilesToPlaylist(QStringList files)
|
||||
}
|
||||
|
||||
playlist_push(playlist, pathData, fileNameNoExten,
|
||||
corePathData, coreNameData, "00000000|crc", databaseData);
|
||||
corePathData, coreNameData, "00000000|crc", databaseData, NULL, NULL);
|
||||
}
|
||||
|
||||
playlist_write_file(playlist);
|
||||
@ -1368,7 +1368,7 @@ void PlaylistModel::getPlaylistItems(QString path)
|
||||
|
||||
playlist_get_index(playlist, i,
|
||||
&path, &label, &core_path,
|
||||
&core_name, &crc32, &db_name);
|
||||
&core_name, &crc32, &db_name, NULL, NULL);
|
||||
|
||||
if (string_is_empty(path))
|
||||
continue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user