Merge pull request #10487 from jdgleaver/playlist-compression

Add optional playlist compression
This commit is contained in:
Autechre 2020-04-23 13:30:58 +02:00 committed by GitHub
commit 89c405b196
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 653 additions and 372 deletions

View File

@ -963,6 +963,9 @@ static const int default_content_favorites_size = 200;
/* File format to use when writing playlists to disk */
#define DEFAULT_PLAYLIST_USE_OLD_FORMAT false
/* When creating/updating playlists, compress written data */
#define DEFAULT_PLAYLIST_COMPRESSION false
#ifdef HAVE_MENU
/* Specify when to display 'core name' inline on playlist entries */
#define DEFAULT_PLAYLIST_SHOW_INLINE_CORE_NAME PLAYLIST_INLINE_CORE_DISPLAY_HIST_FAV

View File

@ -1651,6 +1651,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
#endif
SETTING_BOOL("playlist_use_old_format", &settings->bools.playlist_use_old_format, true, DEFAULT_PLAYLIST_USE_OLD_FORMAT, false);
SETTING_BOOL("playlist_compression", &settings->bools.playlist_compression, true, DEFAULT_PLAYLIST_COMPRESSION, false);
SETTING_BOOL("content_runtime_log", &settings->bools.content_runtime_log, true, DEFAULT_CONTENT_RUNTIME_LOG, false);
SETTING_BOOL("content_runtime_log_aggregate", &settings->bools.content_runtime_log_aggregate, true, DEFAULT_CONTENT_RUNTIME_LOG_AGGREGATE, false);
SETTING_BOOL("playlist_show_sublabels", &settings->bools.playlist_show_sublabels, true, DEFAULT_PLAYLIST_SHOW_SUBLABELS, false);

View File

@ -379,6 +379,7 @@ typedef struct settings
bool sustained_performance_mode;
bool playlist_use_old_format;
bool playlist_compression;
bool content_runtime_log;
bool content_runtime_log_aggregate;

View File

@ -2058,6 +2058,8 @@ MSG_HASH(MENU_ENUM_LABEL_VIDEO_3DS_DISPLAY_MODE,
#endif
MSG_HASH(MENU_ENUM_LABEL_PLAYLIST_USE_OLD_FORMAT,
"playlist_use_old_format")
MSG_HASH(MENU_ENUM_LABEL_PLAYLIST_COMPRESSION,
"playlist_compression")
MSG_HASH(MENU_ENUM_LABEL_MENU_SOUND_OK,
"menu_sound_ok")
MSG_HASH(MENU_ENUM_LABEL_MENU_SOUND_CANCEL,

View File

@ -4408,6 +4408,18 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_PLAYLIST_USE_OLD_FORMAT,
"Save playlists using old format"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_PLAYLIST_USE_OLD_FORMAT,
"Write playlists using depreciated plain text format. When disabled, playlists are formatted using JSON."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_PLAYLIST_COMPRESSION,
"Compress playlists"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_PLAYLIST_COMPRESSION,
"Archive playlist data when writing to disk. Reduces file size and loading times at the expense of (negligibly) increased CPU usage. May be used with either old or new format playlists."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_PLAYLIST_SHOW_INLINE_CORE_NAME,
"Show associated cores in playlists"

View File

@ -92,6 +92,8 @@ void intfstream_rewind(intfstream_internal_t *intf);
int64_t intfstream_tell(intfstream_internal_t *intf);
int intfstream_eof(intfstream_internal_t *intf);
void intfstream_putc(intfstream_internal_t *intf, int c);
int intfstream_close(intfstream_internal_t *intf);
@ -106,7 +108,7 @@ uint32_t intfstream_get_frame_size(intfstream_internal_t *intf);
bool intfstream_is_compressed(intfstream_internal_t *intf);
intfstream_t* intfstream_open_file(const char *path,
intfstream_t *intfstream_open_file(const char *path,
unsigned mode, unsigned hints);
intfstream_t *intfstream_open_memory(void *data,
@ -118,7 +120,7 @@ intfstream_t *intfstream_open_writable_memory(void *data,
intfstream_t *intfstream_open_chd_track(const char *path,
unsigned mode, unsigned hints, int32_t track);
intfstream_t* intfstream_open_rzip_file(const char *path,
intfstream_t *intfstream_open_rzip_file(const char *path,
unsigned mode);
RETRO_END_DECLS

View File

@ -490,6 +490,34 @@ int64_t intfstream_tell(intfstream_internal_t *intf)
return -1;
}
int intfstream_eof(intfstream_internal_t *intf)
{
if (!intf)
return -1;
switch (intf->type)
{
case INTFSTREAM_FILE:
return filestream_eof(intf->file.fp);
case INTFSTREAM_MEMORY:
/* TODO: Add this functionality to
* memory_stream interface */
break;
case INTFSTREAM_CHD:
/* TODO: Add this functionality to
* chd_stream interface */
break;
case INTFSTREAM_RZIP:
#if defined(HAVE_ZLIB)
return rzipstream_eof(intf->rzip.fp);
#else
break;
#endif
}
return -1;
}
void intfstream_rewind(intfstream_internal_t *intf)
{
switch (intf->type)

View File

@ -390,6 +390,7 @@ static int playlist_association_left(unsigned type, const char *label,
size_t i, next, current = 0;
settings_t *settings = config_get_ptr();
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
playlist_t *playlist = playlist_get_cached();
core_info_list_t *core_info_list = NULL;
core_info_t *core_info = NULL;
@ -448,7 +449,8 @@ static int playlist_association_left(unsigned type, const char *label,
/* Update playlist */
playlist_set_default_core_path(playlist, core_info->path);
playlist_set_default_core_name(playlist, core_info->display_name);
playlist_write_file(playlist, playlist_use_old_format);
playlist_write_file(
playlist, playlist_use_old_format, playlist_compression);
return 0;
}
@ -459,6 +461,7 @@ static int playlist_label_display_mode_left(unsigned type, const char *label,
enum playlist_label_display_mode label_display_mode;
settings_t *settings = config_get_ptr();
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
playlist_t *playlist = playlist_get_cached();
if (!playlist)
@ -472,7 +475,8 @@ static int playlist_label_display_mode_left(unsigned type, const char *label,
label_display_mode = LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX;
playlist_set_label_display_mode(playlist, label_display_mode);
playlist_write_file(playlist, playlist_use_old_format);
playlist_write_file(
playlist, playlist_use_old_format, playlist_compression);
return 0;
}
@ -482,6 +486,7 @@ static void playlist_thumbnail_mode_left(playlist_t *playlist, enum playlist_thu
{
settings_t *settings = config_get_ptr();
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
enum playlist_thumbnail_mode thumbnail_mode =
playlist_get_thumbnail_mode(playlist, thumbnail_id);
@ -491,7 +496,8 @@ static void playlist_thumbnail_mode_left(playlist_t *playlist, enum playlist_thu
thumbnail_mode = PLAYLIST_THUMBNAIL_MODE_BOXARTS;
playlist_set_thumbnail_mode(playlist, thumbnail_id, thumbnail_mode);
playlist_write_file(playlist, playlist_use_old_format);
playlist_write_file(
playlist, playlist_use_old_format, playlist_compression);
}
static int playlist_right_thumbnail_mode_left(unsigned type, const char *label,
@ -526,6 +532,7 @@ static int playlist_sort_mode_left(unsigned type, const char *label,
enum playlist_sort_mode sort_mode;
settings_t *settings = config_get_ptr();
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
playlist_t *playlist = playlist_get_cached();
if (!playlist)
@ -539,7 +546,8 @@ static int playlist_sort_mode_left(unsigned type, const char *label,
sort_mode = PLAYLIST_SORT_MODE_OFF;
playlist_set_sort_mode(playlist, sort_mode);
playlist_write_file(playlist, playlist_use_old_format);
playlist_write_file(
playlist, playlist_use_old_format, playlist_compression);
return 0;
}

View File

@ -2038,6 +2038,7 @@ static int action_ok_playlist_entry_collection(const char *path,
menu_handle_t *menu = menu_driver_get_ptr();
settings_t *settings = config_get_ptr();
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
bool playlist_sort_alphabetical = settings->bools.playlist_sort_alphabetical;
const char *path_content_history = settings->paths.path_content_history;
const char *path_content_music_history = settings->paths.path_content_music_history;
@ -2163,7 +2164,8 @@ static int action_ok_playlist_entry_collection(const char *path,
playlist,
selection_ptr,
&update_entry,
playlist_use_old_format);
playlist_use_old_format,
playlist_compression);
}
else
{
@ -2205,6 +2207,7 @@ static int action_ok_playlist_entry(const char *path,
playlist_t *playlist = playlist_get_cached();
menu_handle_t *menu = menu_driver_get_ptr();
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
new_core_path[0] = '\0';
@ -2258,7 +2261,8 @@ static int action_ok_playlist_entry(const char *path,
command_playlist_update_write(NULL,
selection_ptr,
&entry,
playlist_use_old_format);
playlist_use_old_format,
playlist_compression);
}
}
else
@ -2292,6 +2296,7 @@ static int action_ok_playlist_entry_start_content(const char *path,
playlist_t *playlist = playlist_get_cached();
menu_handle_t *menu = menu_driver_get_ptr();
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
if (!playlist || !menu)
return menu_cbs_exit();
@ -2347,7 +2352,8 @@ static int action_ok_playlist_entry_start_content(const char *path,
playlist,
selection_ptr,
&entry,
playlist_use_old_format);
playlist_use_old_format,
playlist_compression);
}
}
@ -2611,6 +2617,7 @@ static int action_ok_audio_add_to_mixer_and_collection(const char *path,
menu_handle_t *menu = menu_driver_get_ptr();
bool playlist_fuzzy_archive_match = settings->bools.playlist_fuzzy_archive_match;
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
combined_path[0] = '\0';
@ -2627,7 +2634,8 @@ static int action_ok_audio_add_to_mixer_and_collection(const char *path,
command_playlist_push_write(g_defaults.music_history, &entry,
playlist_fuzzy_archive_match,
playlist_use_old_format);
playlist_use_old_format,
playlist_compression);
if (filestream_exists(combined_path))
task_push_audio_mixer_load(combined_path,
@ -2647,6 +2655,7 @@ static int action_ok_audio_add_to_mixer_and_collection_and_play(const char *path
settings_t *settings = config_get_ptr();
bool playlist_fuzzy_archive_match = settings->bools.playlist_fuzzy_archive_match;
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
combined_path[0] = '\0';
@ -2663,8 +2672,8 @@ static int action_ok_audio_add_to_mixer_and_collection_and_play(const char *path
command_playlist_push_write(g_defaults.music_history, &entry,
playlist_fuzzy_archive_match,
playlist_use_old_format
);
playlist_use_old_format,
playlist_compression);
if (filestream_exists(combined_path))
task_push_audio_mixer_load_and_play(combined_path,
@ -2726,6 +2735,7 @@ static void menu_input_st_string_cb_rename_entry(void *userdata,
{
settings_t *settings = config_get_ptr();
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
if (str && *str)
{
const char *label = menu_input_dialog_get_buffer();
@ -2741,7 +2751,8 @@ static void menu_input_st_string_cb_rename_entry(void *userdata,
command_playlist_update_write(NULL,
menu_input_dialog_get_kb_idx(),
&entry,
playlist_use_old_format);
playlist_use_old_format,
playlist_compression);
}
}
@ -3332,6 +3343,7 @@ static int action_ok_core_deferred_set(const char *new_core_path,
const char *path_dir_libretro = settings->paths.directory_libretro;
bool show_hidden_files = settings->bools.show_hidden_files;
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
ext_name[0] = '\0';
core_display_name[0] = '\0';
@ -3364,7 +3376,8 @@ static int action_ok_core_deferred_set(const char *new_core_path,
NULL,
menu->scratchpad.unsigned_var,
&entry,
playlist_use_old_format);
playlist_use_old_format,
playlist_compression);
/* Provide visual feedback */
strlcpy(msg, msg_hash_to_str(MSG_SET_CORE_ASSOCIATION), sizeof(msg));
@ -4952,6 +4965,7 @@ static int action_ok_delete_entry(const char *path,
char *def_conf_fav_path = NULL;
settings_t *settings = config_get_ptr();
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
playlist_t *playlist = playlist_get_cached();
menu_handle_t *menu = menu_driver_get_ptr();
@ -4987,7 +5001,8 @@ static int action_ok_delete_entry(const char *path,
if (playlist)
{
playlist_delete_index(playlist, menu->rpl_entry_selection_ptr);
playlist_write_file(playlist, playlist_use_old_format);
playlist_write_file(
playlist, playlist_use_old_format, playlist_compression);
}
new_selection_ptr = menu_navigation_get_selection();
@ -5858,6 +5873,7 @@ static int action_ok_push_dropdown_item_playlist_default_core(const char *path,
const char* core_name = path;
settings_t *settings = config_get_ptr();
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
/* Get core list */
core_info_get_list(&core_info_list);
@ -5907,7 +5923,8 @@ static int action_ok_push_dropdown_item_playlist_default_core(const char *path,
}
/* In all cases, update file on disk */
playlist_write_file(playlist, playlist_use_old_format);
playlist_write_file(
playlist, playlist_use_old_format, playlist_compression);
return action_cancel_pop_default(NULL, NULL, 0, 0);
}
@ -5920,11 +5937,13 @@ static int action_ok_push_dropdown_item_playlist_label_display_mode(
settings_t *settings = config_get_ptr();
playlist_t *playlist = playlist_get_cached();
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
playlist_set_label_display_mode(playlist, (enum playlist_label_display_mode)idx);
/* In all cases, update file on disk */
playlist_write_file(playlist, playlist_use_old_format);
playlist_write_file(
playlist, playlist_use_old_format, playlist_compression);
return action_cancel_pop_default(NULL, NULL, 0, 0);
}
@ -5934,13 +5953,15 @@ static int generic_set_thumbnail_mode(enum playlist_thumbnail_id thumbnail_id, s
settings_t *settings = config_get_ptr();
playlist_t *playlist = playlist_get_cached();
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
if (!playlist)
return -1;
playlist_set_thumbnail_mode(playlist, thumbnail_id,
(enum playlist_thumbnail_mode)idx);
playlist_write_file(playlist, playlist_use_old_format);
playlist_write_file(
playlist, playlist_use_old_format, playlist_compression);
return action_cancel_pop_default(NULL, NULL, 0, 0);
}
@ -5964,9 +5985,11 @@ static int action_ok_push_dropdown_item_playlist_sort_mode(
settings_t *settings = config_get_ptr();
playlist_t *playlist = playlist_get_cached();
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
playlist_set_sort_mode(playlist, (enum playlist_sort_mode)idx);
playlist_write_file(playlist, playlist_use_old_format);
playlist_write_file(
playlist, playlist_use_old_format, playlist_compression);
return action_cancel_pop_default(NULL, NULL, 0, 0);
}

View File

@ -483,6 +483,7 @@ static int playlist_association_right(unsigned type, const char *label,
settings_t *settings = config_get_ptr();
playlist_t *playlist = playlist_get_cached();
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
core_path[0] = '\0';
@ -545,7 +546,8 @@ static int playlist_association_right(unsigned type, const char *label,
/* Update playlist */
playlist_set_default_core_path(playlist, core_info->path);
playlist_set_default_core_name(playlist, core_info->display_name);
playlist_write_file(playlist, playlist_use_old_format);
playlist_write_file(
playlist, playlist_use_old_format, playlist_compression);
return 0;
}
@ -557,6 +559,7 @@ static int playlist_label_display_mode_right(unsigned type, const char *label,
settings_t *settings = config_get_ptr();
playlist_t *playlist = playlist_get_cached();
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
if (!playlist)
return -1;
@ -569,7 +572,8 @@ static int playlist_label_display_mode_right(unsigned type, const char *label,
label_display_mode = LABEL_DISPLAY_MODE_DEFAULT;
playlist_set_label_display_mode(playlist, label_display_mode);
playlist_write_file(playlist, playlist_use_old_format);
playlist_write_file(
playlist, playlist_use_old_format, playlist_compression);
return 0;
}
@ -579,6 +583,7 @@ static void playlist_thumbnail_mode_right(playlist_t *playlist, enum playlist_th
{
settings_t *settings = config_get_ptr();
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
enum playlist_thumbnail_mode thumbnail_mode =
playlist_get_thumbnail_mode(playlist, thumbnail_id);
@ -588,7 +593,8 @@ static void playlist_thumbnail_mode_right(playlist_t *playlist, enum playlist_th
thumbnail_mode = PLAYLIST_THUMBNAIL_MODE_DEFAULT;
playlist_set_thumbnail_mode(playlist, thumbnail_id, thumbnail_mode);
playlist_write_file(playlist, playlist_use_old_format);
playlist_write_file(
playlist, playlist_use_old_format, playlist_compression);
}
static int playlist_right_thumbnail_mode_right(unsigned type, const char *label,
@ -624,6 +630,7 @@ static int playlist_sort_mode_right(unsigned type, const char *label,
settings_t *settings = config_get_ptr();
playlist_t *playlist = playlist_get_cached();
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
if (!playlist)
return -1;
@ -636,7 +643,8 @@ static int playlist_sort_mode_right(unsigned type, const char *label,
sort_mode = PLAYLIST_SORT_MODE_DEFAULT;
playlist_set_sort_mode(playlist, sort_mode);
playlist_write_file(playlist, playlist_use_old_format);
playlist_write_file(
playlist, playlist_use_old_format, playlist_compression);
return 0;
}

View File

@ -297,8 +297,10 @@ static int action_start_playlist_association(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
settings_t *settings = config_get_ptr();
playlist_t *playlist = playlist_get_cached();
settings_t *settings = config_get_ptr();
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
playlist_t *playlist = playlist_get_cached();
if (!playlist)
return -1;
@ -306,7 +308,8 @@ static int action_start_playlist_association(
/* Set default core path + name to DETECT */
playlist_set_default_core_path(playlist, file_path_str(FILE_PATH_DETECT));
playlist_set_default_core_name(playlist, file_path_str(FILE_PATH_DETECT));
playlist_write_file(playlist, settings->bools.playlist_use_old_format);
playlist_write_file(
playlist, playlist_use_old_format, playlist_compression);
return 0;
}
@ -315,15 +318,18 @@ static int action_start_playlist_label_display_mode(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
settings_t *settings = config_get_ptr();
playlist_t *playlist = playlist_get_cached();
settings_t *settings = config_get_ptr();
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
playlist_t *playlist = playlist_get_cached();
if (!playlist)
return -1;
/* Set label display mode to the default */
playlist_set_label_display_mode(playlist, LABEL_DISPLAY_MODE_DEFAULT);
playlist_write_file(playlist, settings->bools.playlist_use_old_format);
playlist_write_file(
playlist, playlist_use_old_format, playlist_compression);
return 0;
}
@ -332,15 +338,18 @@ static int action_start_playlist_right_thumbnail_mode(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
settings_t *settings = config_get_ptr();
playlist_t *playlist = playlist_get_cached();
settings_t *settings = config_get_ptr();
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
playlist_t *playlist = playlist_get_cached();
if (!playlist)
return -1;
/* Set thumbnail_mode to default value */
playlist_set_thumbnail_mode(playlist, PLAYLIST_THUMBNAIL_RIGHT, PLAYLIST_THUMBNAIL_MODE_DEFAULT);
playlist_write_file(playlist, settings->bools.playlist_use_old_format);
playlist_write_file(
playlist, playlist_use_old_format, playlist_compression);
return 0;
}
@ -349,15 +358,18 @@ static int action_start_playlist_left_thumbnail_mode(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
settings_t *settings = config_get_ptr();
playlist_t *playlist = playlist_get_cached();
settings_t *settings = config_get_ptr();
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
playlist_t *playlist = playlist_get_cached();
if (!playlist)
return -1;
/* Set thumbnail_mode to default value */
playlist_set_thumbnail_mode(playlist, PLAYLIST_THUMBNAIL_LEFT, PLAYLIST_THUMBNAIL_MODE_DEFAULT);
playlist_write_file(playlist, settings->bools.playlist_use_old_format);
playlist_write_file(
playlist, playlist_use_old_format, playlist_compression);
return 0;
}
@ -366,15 +378,18 @@ static int action_start_playlist_sort_mode(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
settings_t *settings = config_get_ptr();
playlist_t *playlist = playlist_get_cached();
settings_t *settings = config_get_ptr();
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
playlist_t *playlist = playlist_get_cached();
if (!playlist)
return -1;
/* Set sort mode to the default */
playlist_set_sort_mode(playlist, PLAYLIST_SORT_MODE_DEFAULT);
playlist_write_file(playlist, settings->bools.playlist_use_old_format);
playlist_write_file(
playlist, playlist_use_old_format, playlist_compression);
return 0;
}

View File

@ -759,6 +759,8 @@ default_sublabel_macro(action_bind_sublabel_menu_ticker_smooth,
default_sublabel_macro(action_bind_sublabel_playlist_show_inline_core_name, MENU_ENUM_SUBLABEL_PLAYLIST_SHOW_INLINE_CORE_NAME)
default_sublabel_macro(action_bind_sublabel_playlist_sort_alphabetical, MENU_ENUM_SUBLABEL_PLAYLIST_SORT_ALPHABETICAL)
default_sublabel_macro(action_bind_sublabel_playlist_fuzzy_archive_match, MENU_ENUM_SUBLABEL_PLAYLIST_FUZZY_ARCHIVE_MATCH)
default_sublabel_macro(action_bind_sublabel_playlist_use_old_format, MENU_ENUM_SUBLABEL_PLAYLIST_USE_OLD_FORMAT)
default_sublabel_macro(action_bind_sublabel_playlist_compression, MENU_ENUM_SUBLABEL_PLAYLIST_COMPRESSION)
default_sublabel_macro(action_bind_sublabel_menu_rgui_full_width_layout, MENU_ENUM_SUBLABEL_MENU_RGUI_FULL_WIDTH_LAYOUT)
default_sublabel_macro(action_bind_sublabel_menu_rgui_extended_ascii, MENU_ENUM_SUBLABEL_MENU_RGUI_EXTENDED_ASCII)
default_sublabel_macro(action_bind_sublabel_thumbnails_updater_list, MENU_ENUM_SUBLABEL_THUMBNAILS_UPDATER_LIST)
@ -3286,6 +3288,12 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_PLAYLIST_FUZZY_ARCHIVE_MATCH:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_playlist_fuzzy_archive_match);
break;
case MENU_ENUM_LABEL_PLAYLIST_USE_OLD_FORMAT:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_playlist_use_old_format);
break;
case MENU_ENUM_LABEL_PLAYLIST_COMPRESSION:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_playlist_compression);
break;
case MENU_ENUM_LABEL_MENU_RGUI_FULL_WIDTH_LAYOUT:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_rgui_full_width_layout);
break;

View File

@ -1737,6 +1737,8 @@ static void menu_displaylist_set_new_playlist(
int content_favorites_size = settings->ints.content_favorites_size;
unsigned content_history_size = settings->uints.content_history_size;
bool playlist_sort_alphabetical = settings->bools.playlist_sort_alphabetical;
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
menu->db_playlist_file[0] = '\0';
@ -1756,7 +1758,9 @@ static void menu_displaylist_set_new_playlist(
playlist_size = (unsigned)content_favorites_size;
}
if (playlist_init_cached(path, playlist_size))
if (playlist_init_cached(
path, playlist_size,
playlist_use_old_format, playlist_compression))
{
playlist_t *playlist = playlist_get_cached();
enum playlist_sort_mode current_sort_mode = playlist_get_sort_mode(playlist);
@ -2989,9 +2993,8 @@ static bool menu_displaylist_parse_playlist_manager_settings(
MENU_SETTING_PLAYLIST_MANAGER_LEFT_THUMBNAIL_MODE, 0, 0);
/* Sorting mode
* > Only enabled when using the new playlist format
* > Not relevant for history playlists */
if (!playlist_use_old_format && !is_content_history)
if (!is_content_history)
menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_SORT_MODE),
msg_hash_to_str(MENU_ENUM_LABEL_PLAYLIST_MANAGER_SORT_MODE),
@ -4263,6 +4266,7 @@ unsigned menu_displaylist_build_list(
{MENU_ENUM_LABEL_PLAYLIST_ENTRY_REMOVE, PARSE_ONLY_UINT, true},
{MENU_ENUM_LABEL_PLAYLIST_SORT_ALPHABETICAL, PARSE_ONLY_BOOL, true},
{MENU_ENUM_LABEL_PLAYLIST_USE_OLD_FORMAT, PARSE_ONLY_BOOL, true},
{MENU_ENUM_LABEL_PLAYLIST_COMPRESSION, PARSE_ONLY_BOOL, true},
{MENU_ENUM_LABEL_PLAYLIST_SHOW_INLINE_CORE_NAME, PARSE_ONLY_UINT, true},
{MENU_ENUM_LABEL_PLAYLIST_SHOW_SUBLABELS, PARSE_ONLY_BOOL, true},
{MENU_ENUM_LABEL_PLAYLIST_SUBLABEL_RUNTIME_TYPE, PARSE_ONLY_UINT, false},

View File

@ -15647,6 +15647,24 @@ static bool setting_append_list(
SD_FLAG_NONE
);
#if defined(HAVE_ZLIB)
CONFIG_BOOL(
list, list_info,
&settings->bools.playlist_compression,
MENU_ENUM_LABEL_PLAYLIST_COMPRESSION,
MENU_ENUM_LABEL_VALUE_PLAYLIST_COMPRESSION,
DEFAULT_PLAYLIST_COMPRESSION,
MENU_ENUM_LABEL_VALUE_OFF,
MENU_ENUM_LABEL_VALUE_ON,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler,
SD_FLAG_NONE
);
#endif
CONFIG_BOOL(
list, list_info,
&settings->bools.playlist_show_sublabels,

View File

@ -2696,6 +2696,7 @@ enum msg_hash_enums
MENU_ENUM_LABEL_VALUE_HOLD_START,
MENU_ENUM_LABEL_VALUE_DOWN_SELECT,
MENU_LABEL(PLAYLIST_USE_OLD_FORMAT),
MENU_LABEL(PLAYLIST_COMPRESSION),
MENU_LABEL(MENU_SOUNDS),
MENU_LABEL(MENU_SOUND_OK),
MENU_LABEL(MENU_SOUND_CANCEL),

File diff suppressed because it is too large Load Diff

View File

@ -246,7 +246,9 @@ char *playlist_get_conf_path(playlist_t *playlist);
uint32_t playlist_get_size(playlist_t *playlist);
void playlist_write_file(playlist_t *playlist, bool use_old_format);
void playlist_write_file(
playlist_t *playlist,
bool use_old_format, bool compress);
void playlist_write_runtime_file(playlist_t *playlist);
@ -256,19 +258,31 @@ void playlist_free_cached(void);
playlist_t *playlist_get_cached(void);
bool playlist_init_cached(const char *path, size_t size);
/* If current on-disk playlist file referenced
* by 'path' does not match requested 'old format'
* or 'compression' state, file will be updated
* automatically
* > Since this function is called whenever a
* playlist is browsed via the menu, this is
* a simple method for ensuring that files
* are always kept synced with user settings */
bool playlist_init_cached(
const char *path, size_t size,
bool use_old_format, bool compress);
void command_playlist_push_write(
playlist_t *playlist,
const struct playlist_entry *entry,
bool fuzzy_archive_match,
bool use_old_format);
bool use_old_format,
bool compress);
void command_playlist_update_write(
playlist_t *playlist,
size_t idx,
const struct playlist_entry *entry,
bool use_old_format);
bool use_old_format,
bool compress);
/* Returns true if specified playlist index matches
* specified content/core paths */

View File

@ -8945,8 +8945,9 @@ bool command_event(enum event_command cmd, void *data)
{
settings_t *settings = configuration_settings;
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
playlist_write_file(g_defaults.content_history,
playlist_use_old_format);
playlist_use_old_format, playlist_compression);
playlist_free(g_defaults.content_history);
}
g_defaults.content_history = NULL;
@ -8955,8 +8956,9 @@ bool command_event(enum event_command cmd, void *data)
{
settings_t *settings = configuration_settings;
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
playlist_write_file(g_defaults.music_history,
playlist_use_old_format);
playlist_use_old_format, playlist_compression);
playlist_free(g_defaults.music_history);
}
g_defaults.music_history = NULL;
@ -8966,12 +8968,12 @@ bool command_event(enum event_command cmd, void *data)
{
settings_t *settings = configuration_settings;
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
playlist_write_file(g_defaults.video_history,
playlist_use_old_format);
playlist_use_old_format, playlist_compression);
playlist_free(g_defaults.video_history);
}
g_defaults.video_history = NULL;
#endif
#ifdef HAVE_IMAGEVIEWER
@ -8979,8 +8981,9 @@ bool command_event(enum event_command cmd, void *data)
{
settings_t *settings = configuration_settings;
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
playlist_write_file(g_defaults.image_history,
playlist_use_old_format);
playlist_use_old_format, playlist_compression);
playlist_free(g_defaults.image_history);
}
g_defaults.image_history = NULL;
@ -9186,6 +9189,7 @@ bool command_event(enum event_command cmd, void *data)
{
struct playlist_entry entry = {0};
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
bool playlist_sort_alphabetical = settings->bools.playlist_sort_alphabetical;
bool playlist_fuzzy_archive_match = settings->bools.playlist_fuzzy_archive_match;
@ -9209,7 +9213,7 @@ bool command_event(enum event_command cmd, void *data)
playlist_qsort(g_defaults.content_favorites);
playlist_write_file(g_defaults.content_favorites,
playlist_use_old_format);
playlist_use_old_format, playlist_compression);
runloop_msg_queue_push(msg_hash_to_str(MSG_ADDED_TO_FAVORITES), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
}
@ -9225,6 +9229,7 @@ bool command_event(enum event_command cmd, void *data)
size_t *playlist_index = (size_t*)data;
struct playlist_entry entry = {0};
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
/* the update function reads our entry as const,
* so these casts are safe */
@ -9235,8 +9240,8 @@ bool command_event(enum event_command cmd, void *data)
NULL,
*playlist_index,
&entry,
playlist_use_old_format
);
playlist_use_old_format,
playlist_compression);
runloop_msg_queue_push(msg_hash_to_str(MSG_RESET_CORE_ASSOCIATION), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
break;
@ -30677,9 +30682,10 @@ void rarch_favorites_deinit(void)
{
settings_t *settings = configuration_settings;
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
playlist_write_file(g_defaults.content_favorites,
playlist_use_old_format);
playlist_use_old_format, playlist_compression);
playlist_free(g_defaults.content_favorites);
g_defaults.content_favorites = NULL;
}

View File

@ -1444,7 +1444,8 @@ static void task_push_to_history_list(
command_playlist_push_write(
playlist_hist, &entry,
settings->bools.playlist_fuzzy_archive_match,
settings->bools.playlist_use_old_format);
settings->bools.playlist_use_old_format,
settings->bools.playlist_compression);
}
}

View File

@ -60,6 +60,7 @@ typedef struct db_handle
{
bool pl_fuzzy_archive_match;
bool pl_use_old_format;
bool pl_compression;
bool is_directory;
bool scan_started;
bool scan_without_core_match;
@ -880,7 +881,8 @@ static int database_info_list_iterate_found_match(
playlist_push(playlist, &entry, _db->pl_fuzzy_archive_match);
}
playlist_write_file(playlist, _db->pl_use_old_format);
playlist_write_file(
playlist, _db->pl_use_old_format, _db->pl_compression);
playlist_free(playlist);
database_info_list_free(db_state->info);
@ -1091,7 +1093,8 @@ static int task_database_iterate_playlist_lutro(
free(game_title);
}
playlist_write_file(playlist, _db->pl_use_old_format);
playlist_write_file(
playlist, _db->pl_use_old_format, _db->pl_compression);
playlist_free(playlist);
return 0;
@ -1407,9 +1410,11 @@ bool task_push_dbscan(
db->scan_without_core_match = settings->bools.scan_without_core_match;
db->pl_fuzzy_archive_match = settings->bools.playlist_fuzzy_archive_match;
db->pl_use_old_format = settings->bools.playlist_use_old_format;
db->pl_compression = settings->bools.playlist_compression;
#else
db->pl_fuzzy_archive_match = false;
db->pl_use_old_format = false;
db->pl_compression = false;
#endif
db->show_hidden_files = db_dir_show_hidden_files;
db->is_directory = directory;

View File

@ -63,6 +63,7 @@ typedef struct manual_scan_handle
enum manual_scan_status status;
bool fuzzy_archive_match;
bool use_old_format;
bool compress;
} manual_scan_handle_t;
/* Frees task handle + all constituent objects */
@ -309,7 +310,10 @@ static void task_manual_content_scan_handler(retro_task_t *task)
playlist_qsort(manual_scan->playlist);
/* Save playlist changes to disk */
playlist_write_file(manual_scan->playlist, manual_scan->use_old_format);
playlist_write_file(
manual_scan->playlist,
manual_scan->use_old_format,
manual_scan->compress);
/* If this is the currently cached playlist, then
* it must be re-cached (otherwise changes will be
@ -323,7 +327,8 @@ static void task_manual_content_scan_handler(retro_task_t *task)
{
playlist_free_cached();
playlist_init_cached(
manual_scan->task_config->playlist_file, COLLECTION_SIZE);
manual_scan->task_config->playlist_file, COLLECTION_SIZE,
manual_scan->use_old_format, manual_scan->compress);
}
}
@ -412,6 +417,7 @@ bool task_push_manual_content_scan(void)
manual_scan->status = MANUAL_SCAN_BEGIN;
manual_scan->fuzzy_archive_match = settings->bools.playlist_fuzzy_archive_match;
manual_scan->use_old_format = settings->bools.playlist_use_old_format;
manual_scan->compress = settings->bools.playlist_compression;
if (!manual_scan->m3u_list)
goto error;

View File

@ -50,6 +50,7 @@ enum pl_manager_status
typedef struct pl_manager_handle
{
bool use_old_format;
bool compress;
bool fuzzy_archive_match;
enum pl_manager_status status;
size_t list_size;
@ -99,7 +100,8 @@ static void free_pl_manager_handle(pl_manager_handle_t *pl_manager)
}
static void pl_manager_write_playlist(
playlist_t *playlist, const char *playlist_path, bool use_old_format)
playlist_t *playlist, const char *playlist_path,
bool use_old_format, bool compress)
{
playlist_t *cached_playlist = playlist_get_cached();
@ -108,7 +110,7 @@ static void pl_manager_write_playlist(
return;
/* Write any changes to playlist file */
playlist_write_file(playlist, use_old_format);
playlist_write_file(playlist, use_old_format, compress);
/* If this is the currently cached playlist, then
* it must be re-cached (otherwise changes will be
@ -119,7 +121,8 @@ static void pl_manager_write_playlist(
if (string_is_equal(playlist_path, playlist_get_conf_path(cached_playlist)))
{
playlist_free_cached();
playlist_init_cached(playlist_path, COLLECTION_SIZE);
playlist_init_cached(
playlist_path, COLLECTION_SIZE, use_old_format, compress);
}
}
}
@ -227,7 +230,8 @@ static void task_pl_manager_reset_cores_handler(retro_task_t *task)
pl_manager_write_playlist(
pl_manager->playlist,
pl_manager->playlist_path,
pl_manager->use_old_format);
pl_manager->use_old_format,
pl_manager->compress);
/* Update progress display */
task_free_title(task);
@ -326,6 +330,7 @@ bool task_push_pl_manager_reset_cores(const char *playlist_path)
pl_manager->m3u_index = 0;
pl_manager->status = PL_MANAGER_BEGIN;
pl_manager->use_old_format = settings->bools.playlist_use_old_format;
pl_manager->compress = settings->bools.playlist_compression;
pl_manager->fuzzy_archive_match = false; /* Not relevant here */
task_queue_push(task);
@ -772,7 +777,8 @@ static void task_pl_manager_clean_playlist_handler(retro_task_t *task)
pl_manager_write_playlist(
pl_manager->playlist,
pl_manager->playlist_path,
pl_manager->use_old_format);
pl_manager->use_old_format,
pl_manager->compress);
/* Update progress display */
task_free_title(task);
@ -871,6 +877,7 @@ bool task_push_pl_manager_clean_playlist(const char *playlist_path)
pl_manager->m3u_index = 0;
pl_manager->status = PL_MANAGER_BEGIN;
pl_manager->use_old_format = settings->bools.playlist_use_old_format;
pl_manager->compress = settings->bools.playlist_compression;
pl_manager->fuzzy_archive_match = settings->bools.playlist_fuzzy_archive_match;
if (!pl_manager->m3u_list)

View File

@ -68,6 +68,7 @@ struct screenshot_task_state
bool history_list_enable;
bool pl_fuzzy_archive_match;
bool pl_use_old_format;
bool pl_compression;
bool widgets_ready;
int pitch;
@ -185,7 +186,8 @@ static void task_screenshot_handler(retro_task_t *task)
command_playlist_push_write(g_defaults.image_history, &entry,
state->pl_fuzzy_archive_match,
state->pl_use_old_format);
state->pl_use_old_format,
state->pl_compression);
}
#endif
@ -250,6 +252,7 @@ static bool screenshot_dump(
state->pl_fuzzy_archive_match = settings->bools.playlist_fuzzy_archive_match;
state->pl_use_old_format = settings->bools.playlist_use_old_format;
state->pl_compression = settings->bools.playlist_compression;
state->is_idle = is_idle;
state->is_paused = is_paused;
state->bgr24 = bgr24;

View File

@ -35,6 +35,7 @@ QWidget *PlaylistsPage::widget()
/*layout->add(MENU_ENUM_LABEL_PLAYLIST_ENTRY_REMOVE); TOFIX */
layout->add(MENU_ENUM_LABEL_PLAYLIST_SORT_ALPHABETICAL);
layout->add(MENU_ENUM_LABEL_PLAYLIST_USE_OLD_FORMAT);
layout->add(MENU_ENUM_LABEL_PLAYLIST_COMPRESSION);
layout->add(MENU_ENUM_LABEL_PLAYLIST_SHOW_SUBLABELS);
layout->add(MENU_ENUM_LABEL_PLAYLIST_FUZZY_ARCHIVE_MATCH);
layout->add(MENU_ENUM_LABEL_SCAN_WITHOUT_CORE_MATCH);

View File

@ -386,6 +386,7 @@ void MainWindow::addFilesToPlaylist(QStringList files)
playlist_t *playlist = NULL;
settings_t *settings = config_get_ptr();
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
/* Assume a blank list means we will manually enter in all fields. */
if (files.isEmpty())
@ -652,7 +653,8 @@ void MainWindow::addFilesToPlaylist(QStringList files)
}
}
playlist_write_file(playlist, playlist_use_old_format);
playlist_write_file(
playlist, playlist_use_old_format, playlist_compression);
playlist_free(playlist);
reloadPlaylists();
@ -687,6 +689,7 @@ bool MainWindow::updateCurrentPlaylistEntry(
bool ok = false;
settings_t *settings = config_get_ptr();
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
if ( playlistPath.isEmpty() ||
contentHash.isEmpty() ||
@ -769,7 +772,8 @@ bool MainWindow::updateCurrentPlaylistEntry(
playlist_update(playlist, index, &entry);
}
playlist_write_file(playlist, playlist_use_old_format);
playlist_write_file(
playlist, playlist_use_old_format, playlist_compression);
playlist_free(playlist);
reloadPlaylists();
@ -800,6 +804,7 @@ void MainWindow::onPlaylistWidgetContextMenuRequested(const QPoint&)
settings_t *settings = config_get_ptr();
const char *path_dir_playlist = settings->paths.directory_playlist;
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
QDir playlistDir(path_dir_playlist);
QListWidgetItem *selectedItem = m_listWidget->itemAt(
m_listWidget->viewport()->mapFromGlobal(cursorPos));
@ -996,7 +1001,8 @@ void MainWindow::onPlaylistWidgetContextMenuRequested(const QPoint&)
}
/* Write changes to disk */
playlist_write_file(playlist, playlist_use_old_format);
playlist_write_file(
playlist, playlist_use_old_format, playlist_compression);
/* Free playlist, if required */
if (loadPlaylist)
@ -1342,6 +1348,8 @@ void MainWindow::deleteCurrentPlaylistItem()
bool ok = false;
bool isAllPlaylist = currentPlaylistIsAll();
settings_t *settings = config_get_ptr();
bool playlist_use_old_format = settings->bools.playlist_use_old_format;
bool playlist_compression = settings->bools.playlist_compression;
if (isAllPlaylist)
return;
@ -1366,7 +1374,8 @@ void MainWindow::deleteCurrentPlaylistItem()
playlist = playlist_init(playlistData, COLLECTION_SIZE);
playlist_delete_index(playlist, index);
playlist_write_file(playlist, settings->bools.playlist_use_old_format);
playlist_write_file(
playlist, playlist_use_old_format, playlist_compression);
playlist_free(playlist);
reloadPlaylists();