mirror of
https://github.com/libretro/RetroArch
synced 2025-01-27 21:35:25 +00:00
Revert "(RJSON) Combine multiple consecutive rjsonwriter_raw calls into one"
This reverts commit 82efa5a3d6dd786d718ce1bcf38f6192454c5280.
This commit is contained in:
parent
82efa5a3d6
commit
7507e20703
202
core_info.c
202
core_info.c
@ -862,15 +862,21 @@ static bool core_info_cache_write(core_info_cache_list_t *list, const char *info
|
||||
rjsonwriter_set_options(writer, RJSONWRITER_OPTION_SKIP_WHITESPACE);
|
||||
#endif
|
||||
|
||||
rjsonwriter_raw(writer, "{\n", 2);
|
||||
rjsonwriter_raw(writer, "{", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
rjsonwriter_add_spaces(writer, 2);
|
||||
rjsonwriter_add_string(writer, "version");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, CORE_INFO_CACHE_VERSION);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
rjsonwriter_add_spaces(writer, 2);
|
||||
rjsonwriter_add_string(writer, "items");
|
||||
rjsonwriter_raw(writer, ": [\n", 4);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_raw(writer, "[", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
for (i = 0; i < list->length; i++)
|
||||
{
|
||||
@ -880,124 +886,167 @@ static bool core_info_cache_write(core_info_cache_list_t *list, const char *info
|
||||
continue;
|
||||
|
||||
if (i > 0)
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
{
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
}
|
||||
|
||||
rjsonwriter_add_spaces(writer, 4);
|
||||
rjsonwriter_raw(writer, "{\n", 2);
|
||||
rjsonwriter_raw(writer, "{", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "display_name");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, info->display_name);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "display_version");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, info->display_version);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "core_name");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, info->core_name);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "system_manufacturer");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, info->system_manufacturer);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "systemname");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, info->systemname);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "system_id");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, info->system_id);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "supported_extensions");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, info->supported_extensions);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "authors");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, info->authors);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "permissions");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, info->permissions);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "licenses");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, info->licenses);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "categories");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, info->categories);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "databases");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, info->databases);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "notes");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, info->notes);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "required_hw_api");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, info->required_hw_api);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "description");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, info->description);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
if (info->firmware_count > 0)
|
||||
{
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "firmware");
|
||||
rjsonwriter_raw(writer, ": [\n", 4);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_raw(writer, "[", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
for (j = 0; j < info->firmware_count; j++)
|
||||
{
|
||||
rjsonwriter_add_spaces(writer, 8);
|
||||
rjsonwriter_raw(writer, "{\n", 2);
|
||||
rjsonwriter_raw(writer, "{", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
rjsonwriter_add_spaces(writer, 10);
|
||||
rjsonwriter_add_string(writer, "path");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, info->firmware[j].path);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
rjsonwriter_add_spaces(writer, 10);
|
||||
rjsonwriter_add_string(writer, "desc");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, info->firmware[j].desc);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
rjsonwriter_add_spaces(writer, 10);
|
||||
rjsonwriter_add_string(writer, "optional");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
{
|
||||
bool value = info->firmware[j].optional;
|
||||
rjsonwriter_raw(writer, (value ? "true" : "false"), (value ? 4 : 5));
|
||||
@ -1013,78 +1062,100 @@ static bool core_info_cache_write(core_info_cache_list_t *list, const char *info
|
||||
}
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_raw(writer, "],\n", 3);
|
||||
rjsonwriter_raw(writer, "]", 1);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
}
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "core_file_id");
|
||||
rjsonwriter_raw(writer, ":\n", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_raw(writer, "{\n", 2);
|
||||
rjsonwriter_raw(writer, "{", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
rjsonwriter_add_spaces(writer, 8);
|
||||
rjsonwriter_add_string(writer, "str");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, info->core_file_id.str);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
rjsonwriter_add_spaces(writer, 8);
|
||||
rjsonwriter_add_string(writer, "hash");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_rawf(writer, "%u", info->core_file_id.hash);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_raw(writer, "},\n", 3);
|
||||
rjsonwriter_raw(writer, "}", 1);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "firmware_count");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_rawf(writer, "%u", info->firmware_count);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "savestate_support_level");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_rawf(writer, "%u", info->savestate_support_level);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "has_info");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
{
|
||||
bool value = info->has_info;
|
||||
rjsonwriter_raw(writer, (value ? "true" : "false"), (value ? 4 : 5));
|
||||
}
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "supports_no_game");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
{
|
||||
bool value = info->supports_no_game;
|
||||
rjsonwriter_raw(writer, (value ? "true" : "false"), (value ? 4 : 5));
|
||||
}
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "single_purpose");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
{
|
||||
bool value = info->single_purpose;
|
||||
rjsonwriter_raw(writer, (value ? "true" : "false"), (value ? 4 : 5));
|
||||
}
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "database_match_archive_member");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
{
|
||||
bool value = info->database_match_archive_member;
|
||||
rjsonwriter_raw(writer, (value ? "true" : "false"), (value ? 4 : 5));
|
||||
}
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "is_experimental");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
{
|
||||
bool value = info->is_experimental;
|
||||
rjsonwriter_raw(writer, (value ? "true" : "false"), (value ? 4 : 5));
|
||||
@ -1097,7 +1168,10 @@ static bool core_info_cache_write(core_info_cache_list_t *list, const char *info
|
||||
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
rjsonwriter_add_spaces(writer, 2);
|
||||
rjsonwriter_raw(writer, "]\n}\n", 4);
|
||||
rjsonwriter_raw(writer, "]", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
rjsonwriter_raw(writer, "}", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
rjsonwriter_free(writer);
|
||||
|
||||
RARCH_LOG("[Core Info] Wrote to cache file: %s\n", file_path);
|
||||
|
@ -392,29 +392,38 @@ bool disk_index_file_save(disk_index_file_t *disk_index_file)
|
||||
}
|
||||
|
||||
/* Write output file */
|
||||
rjsonwriter_raw(writer, "{\n", 2);
|
||||
rjsonwriter_raw(writer, "{", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
/* > Version entry */
|
||||
rjsonwriter_add_spaces(writer, 2);
|
||||
rjsonwriter_add_string(writer, "version");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, "1.0");
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
/* > image index entry */
|
||||
rjsonwriter_add_spaces(writer, 2);
|
||||
rjsonwriter_add_string(writer, "image_index");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_rawf(writer, "%u", disk_index_file->image_index);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
/* > image path entry */
|
||||
rjsonwriter_add_spaces(writer, 2);
|
||||
rjsonwriter_add_string(writer, "image_path");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, disk_index_file->image_path);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
/* > Finalise */
|
||||
rjsonwriter_raw(writer, "\n}\n", 3);
|
||||
rjsonwriter_raw(writer, "}", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
/* Free JSON writer */
|
||||
if (!rjsonwriter_free(writer))
|
||||
|
250
playlist.c
250
playlist.c
@ -1505,82 +1505,112 @@ void playlist_write_runtime_file(playlist_t *playlist)
|
||||
goto end;
|
||||
}
|
||||
|
||||
rjsonwriter_raw(writer, "{\n", 2);
|
||||
rjsonwriter_raw(writer, "{", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
rjsonwriter_add_spaces(writer, 2);
|
||||
rjsonwriter_add_string(writer, "version");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, "1.0");
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
rjsonwriter_add_spaces(writer, 2);
|
||||
rjsonwriter_add_string(writer, "items");
|
||||
rjsonwriter_raw(writer, ": [\n", 4);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_raw(writer, "[", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
for (i = 0, len = RBUF_LEN(playlist->entries); i < len; i++)
|
||||
{
|
||||
rjsonwriter_add_spaces(writer, 4);
|
||||
rjsonwriter_raw(writer, "{\n", 2);
|
||||
rjsonwriter_raw(writer, "{", 1);
|
||||
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "path");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, playlist->entries[i].path);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "core_path");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, playlist->entries[i].core_path);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "runtime_hours");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_rawf(writer, "%u", playlist->entries[i].runtime_hours);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "runtime_minutes");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_rawf(writer, "%u", playlist->entries[i].runtime_minutes);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "runtime_seconds");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_rawf(writer, "%u", playlist->entries[i].runtime_seconds);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "last_played_year");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_rawf(writer, "%u", playlist->entries[i].last_played_year);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "last_played_month");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_rawf(writer, "%u", playlist->entries[i].last_played_month);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "last_played_day");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_rawf(writer, "%u", playlist->entries[i].last_played_day);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "last_played_hour");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_rawf(writer, "%u", playlist->entries[i].last_played_hour);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "last_played_minute");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_rawf(writer, "%u", playlist->entries[i].last_played_minute);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "last_played_second");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_rawf(writer, "%u", playlist->entries[i].last_played_second);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
@ -1594,7 +1624,10 @@ void playlist_write_runtime_file(playlist_t *playlist)
|
||||
}
|
||||
|
||||
rjsonwriter_add_spaces(writer, 2);
|
||||
rjsonwriter_raw(writer, "]\n}\n", 4);
|
||||
rjsonwriter_raw(writer, "]", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
rjsonwriter_raw(writer, "}", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
rjsonwriter_free(writer);
|
||||
|
||||
playlist->modified = false;
|
||||
@ -1694,118 +1727,153 @@ void playlist_write_file(playlist_t *playlist)
|
||||
if (compressed)
|
||||
rjsonwriter_set_options(writer, RJSONWRITER_OPTION_SKIP_WHITESPACE);
|
||||
|
||||
rjsonwriter_raw(writer, "{\n", 2);
|
||||
rjsonwriter_raw(writer, "{", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 2);
|
||||
rjsonwriter_add_string(writer, "version");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, "1.5");
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 2);
|
||||
rjsonwriter_add_string(writer, "default_core_path");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, playlist->default_core_path);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 2);
|
||||
rjsonwriter_add_string(writer, "default_core_name");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, playlist->default_core_name);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
if (!string_is_empty(playlist->base_content_directory))
|
||||
{
|
||||
rjsonwriter_add_spaces(writer, 2);
|
||||
rjsonwriter_add_string(writer, "base_content_directory");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, playlist->base_content_directory);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
}
|
||||
|
||||
rjsonwriter_add_spaces(writer, 2);
|
||||
rjsonwriter_add_string(writer, "label_display_mode");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_rawf(writer, "%d", (int)playlist->label_display_mode);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 2);
|
||||
rjsonwriter_add_string(writer, "right_thumbnail_mode");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_rawf(writer, "%d", (int)playlist->right_thumbnail_mode);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 2);
|
||||
rjsonwriter_add_string(writer, "left_thumbnail_mode");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_rawf(writer, "%d", (int)playlist->left_thumbnail_mode);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 2);
|
||||
rjsonwriter_add_string(writer, "sort_mode");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_rawf(writer, "%d", (int)playlist->sort_mode);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
if (!string_is_empty(playlist->scan_record.content_dir))
|
||||
{
|
||||
rjsonwriter_add_spaces(writer, 2);
|
||||
rjsonwriter_add_string(writer, "scan_content_dir");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, playlist->scan_record.content_dir);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 2);
|
||||
rjsonwriter_add_string(writer, "scan_file_exts");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, playlist->scan_record.file_exts);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 2);
|
||||
rjsonwriter_add_string(writer, "scan_dat_file_path");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, playlist->scan_record.dat_file_path);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 2);
|
||||
rjsonwriter_add_string(writer, "scan_search_recursively");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
{
|
||||
bool value = playlist->scan_record.search_recursively;
|
||||
rjsonwriter_raw(writer, (value ? "true" : "false"), (value ? 4 : 5));
|
||||
}
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 2);
|
||||
rjsonwriter_add_string(writer, "scan_search_archives");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
{
|
||||
bool value = playlist->scan_record.search_archives;
|
||||
rjsonwriter_raw(writer, (value ? "true" : "false"), (value ? 4 : 5));
|
||||
}
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
rjsonwriter_add_spaces(writer, 2);
|
||||
rjsonwriter_add_string(writer, "scan_filter_dat_content");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
{
|
||||
bool value = playlist->scan_record.filter_dat_content;
|
||||
rjsonwriter_raw(writer, (value ? "true" : "false"), (value ? 4 : 5));
|
||||
}
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
}
|
||||
|
||||
rjsonwriter_add_spaces(writer, 2);
|
||||
rjsonwriter_add_string(writer, "items");
|
||||
rjsonwriter_raw(writer, ": [\n", 4);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_raw(writer, "[", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
for (i = 0, len = RBUF_LEN(playlist->entries); i < len; i++)
|
||||
{
|
||||
rjsonwriter_add_spaces(writer, 4);
|
||||
rjsonwriter_raw(writer, "{\n", 2);
|
||||
rjsonwriter_raw(writer, "{", 1);
|
||||
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "path");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, playlist->entries[i].path);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
|
||||
@ -1814,7 +1882,8 @@ void playlist_write_file(playlist_t *playlist)
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "entry_slot");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_rawf(writer, "%d", (int)playlist->entries[i].entry_slot);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
}
|
||||
@ -1822,44 +1891,61 @@ void playlist_write_file(playlist_t *playlist)
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "label");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, playlist->entries[i].label);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "core_path");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, playlist->entries[i].core_path);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "core_name");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, playlist->entries[i].core_name);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "crc32");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, playlist->entries[i].crc32);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "db_name");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, playlist->entries[i].db_name);
|
||||
|
||||
if (!string_is_empty(playlist->entries[i].subsystem_ident))
|
||||
{
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "subsystem_ident");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, playlist->entries[i].subsystem_ident);
|
||||
}
|
||||
|
||||
if (!string_is_empty(playlist->entries[i].subsystem_name))
|
||||
{
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "subsystem_name");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, playlist->entries[i].subsystem_name);
|
||||
}
|
||||
|
||||
@ -1868,10 +1954,14 @@ void playlist_write_file(playlist_t *playlist)
|
||||
{
|
||||
unsigned j;
|
||||
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
rjsonwriter_add_spaces(writer, 6);
|
||||
rjsonwriter_add_string(writer, "subsystem_roms");
|
||||
rjsonwriter_raw(writer, ": [\n", 4);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_raw(writer, "[", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
for (j = 0; j < playlist->entries[i].subsystem_roms->size; j++)
|
||||
{
|
||||
@ -1883,7 +1973,10 @@ void playlist_write_file(playlist_t *playlist)
|
||||
: "");
|
||||
|
||||
if (j < playlist->entries[i].subsystem_roms->size - 1)
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
{
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
}
|
||||
}
|
||||
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
@ -1903,7 +1996,10 @@ void playlist_write_file(playlist_t *playlist)
|
||||
}
|
||||
|
||||
rjsonwriter_add_spaces(writer, 2);
|
||||
rjsonwriter_raw(writer, "]\n}\n", 4);
|
||||
rjsonwriter_raw(writer, "]", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
rjsonwriter_raw(writer, "}", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
if (!rjsonwriter_free(writer))
|
||||
{
|
||||
|
@ -1256,14 +1256,17 @@ void runtime_log_save(runtime_log_t *runtime_log)
|
||||
}
|
||||
|
||||
/* Write output file */
|
||||
rjsonwriter_raw(writer, "{\n", 2);
|
||||
rjsonwriter_raw(writer, "{", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
/* > Version entry */
|
||||
rjsonwriter_add_spaces(writer, 2);
|
||||
rjsonwriter_add_string(writer, "version");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, "1.0");
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
/* > Runtime entry */
|
||||
snprintf(value_string,
|
||||
@ -1274,9 +1277,11 @@ void runtime_log_save(runtime_log_t *runtime_log)
|
||||
|
||||
rjsonwriter_add_spaces(writer, 2);
|
||||
rjsonwriter_add_string(writer, "runtime");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, value_string);
|
||||
rjsonwriter_raw(writer, ",\n", 2);
|
||||
rjsonwriter_raw(writer, ",", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
/* > Last played entry */
|
||||
value_string[0] = '\0';
|
||||
@ -1289,12 +1294,14 @@ void runtime_log_save(runtime_log_t *runtime_log)
|
||||
|
||||
rjsonwriter_add_spaces(writer, 2);
|
||||
rjsonwriter_add_string(writer, "last_played");
|
||||
rjsonwriter_raw(writer, ": ", 2);
|
||||
rjsonwriter_raw(writer, ":", 1);
|
||||
rjsonwriter_raw(writer, " ", 1);
|
||||
rjsonwriter_add_string(writer, value_string);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
/* > Finalise */
|
||||
rjsonwriter_raw(writer, "}\n", 2);
|
||||
rjsonwriter_raw(writer, "}", 1);
|
||||
rjsonwriter_raw(writer, "\n", 1);
|
||||
|
||||
/* Free JSON writer */
|
||||
if (!rjsonwriter_free(writer))
|
||||
|
@ -968,34 +968,45 @@ bool run_translation_service(settings_t *settings, bool paused)
|
||||
if (!(jsonwriter = rjsonwriter_open_memory()))
|
||||
goto finish;
|
||||
|
||||
rjsonwriter_raw(jsonwriter, "{ ", 2);
|
||||
rjsonwriter_raw(jsonwriter, "{", 1);
|
||||
rjsonwriter_raw(jsonwriter, " ", 1);
|
||||
rjsonwriter_add_string(jsonwriter, "image");
|
||||
rjsonwriter_raw(jsonwriter, ": ", 2);
|
||||
rjsonwriter_raw(jsonwriter, ":", 1);
|
||||
rjsonwriter_raw(jsonwriter, " ", 1);
|
||||
rjsonwriter_add_string_len(jsonwriter, bmp64_buffer, bmp64_length);
|
||||
|
||||
/* Form request... */
|
||||
if (system_label)
|
||||
{
|
||||
rjsonwriter_raw(jsonwriter, ", ", 2);
|
||||
rjsonwriter_raw(jsonwriter, ",", 1);
|
||||
rjsonwriter_raw(jsonwriter, " ", 1);
|
||||
rjsonwriter_add_string(jsonwriter, "label");
|
||||
rjsonwriter_raw(jsonwriter, ": ", 2);
|
||||
rjsonwriter_raw(jsonwriter, ":", 1);
|
||||
rjsonwriter_raw(jsonwriter, " ", 1);
|
||||
rjsonwriter_add_string(jsonwriter, system_label);
|
||||
}
|
||||
|
||||
rjsonwriter_raw(jsonwriter, ", ", 2);
|
||||
rjsonwriter_raw(jsonwriter, ",", 1);
|
||||
rjsonwriter_raw(jsonwriter, " ", 1);
|
||||
rjsonwriter_add_string(jsonwriter, "state");
|
||||
rjsonwriter_raw(jsonwriter, ": { ", 4);
|
||||
rjsonwriter_raw(jsonwriter, ":", 1);
|
||||
rjsonwriter_raw(jsonwriter, " ", 1);
|
||||
rjsonwriter_raw(jsonwriter, "{", 1);
|
||||
rjsonwriter_raw(jsonwriter, " ", 1);
|
||||
rjsonwriter_add_string(jsonwriter, "paused");
|
||||
rjsonwriter_raw(jsonwriter, ": ", 2);
|
||||
rjsonwriter_raw(jsonwriter, ":", 1);
|
||||
rjsonwriter_raw(jsonwriter, " ", 1);
|
||||
rjsonwriter_rawf(jsonwriter, "%u", (paused ? 1 : 0));
|
||||
{
|
||||
static const char* state_labels[] = { "b", "y", "select", "start", "up", "down", "left", "right", "a", "x", "l", "r", "l2", "r2", "l3", "r3" };
|
||||
int i;
|
||||
for (i = 0; i < ARRAY_SIZE(state_labels); i++)
|
||||
{
|
||||
rjsonwriter_raw(jsonwriter, ", ", 2);
|
||||
rjsonwriter_raw(jsonwriter, ",", 1);
|
||||
rjsonwriter_raw(jsonwriter, " ", 1);
|
||||
rjsonwriter_add_string(jsonwriter, state_labels[i]);
|
||||
rjsonwriter_raw(jsonwriter, ": ", 2);
|
||||
rjsonwriter_raw(jsonwriter, ":", 1);
|
||||
rjsonwriter_raw(jsonwriter, " ", 1);
|
||||
#ifdef HAVE_ACCESSIBILITY
|
||||
rjsonwriter_rawf(jsonwriter, "%u",
|
||||
(input_st->ai_gamepad_state[i] ? 1 : 0));
|
||||
@ -1004,7 +1015,10 @@ bool run_translation_service(settings_t *settings, bool paused)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
rjsonwriter_raw(jsonwriter, " } }", 4);
|
||||
rjsonwriter_raw(jsonwriter, " ", 1);
|
||||
rjsonwriter_raw(jsonwriter, "}", 1);
|
||||
rjsonwriter_raw(jsonwriter, " ", 1);
|
||||
rjsonwriter_raw(jsonwriter, "}", 1);
|
||||
|
||||
if (!(json_buffer = rjsonwriter_get_memory_buffer(jsonwriter, NULL)))
|
||||
goto finish; /* ran out of memory */
|
||||
|
Loading…
x
Reference in New Issue
Block a user