From f391c1b65dadd70b2870aed894310e2a14852e87 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 30 Jul 2016 22:32:52 +0200 Subject: [PATCH] Add new path settings for music/image/video history paths --- configuration.c | 73 +++++++++++++++++++++++++++++++++++++++++++++ configuration.h | 3 ++ file_path_special.h | 3 ++ file_path_str.c | 6 ++++ retroarch.cfg | 17 ++++++++++- 5 files changed, 101 insertions(+), 1 deletion(-) diff --git a/configuration.c b/configuration.c index 921d3da016..ca247fdd95 100644 --- a/configuration.c +++ b/configuration.c @@ -760,6 +760,9 @@ static void config_set_defaults(void) *settings->path.core_options = '\0'; *settings->path.content_history = '\0'; + *settings->path.content_music_history = '\0'; + *settings->path.content_image_history = '\0'; + *settings->path.content_video_history = '\0'; *settings->path.cheat_settings = '\0'; *settings->path.shader = '\0'; #ifndef IOS @@ -1737,6 +1740,15 @@ static bool config_load_file(const char *path, bool set_defaults) if (config_get_path(conf, "content_history_path", tmp_str, sizeof(tmp_str))) strlcpy(settings->path.content_history, tmp_str, sizeof(settings->path.content_history)); + if (config_get_path(conf, "content_music_history_path", tmp_str, sizeof(tmp_str))) + strlcpy(settings->path.content_music_history, tmp_str, sizeof(settings->path.content_music_history)); + + if (config_get_path(conf, "content_image_history_path", tmp_str, sizeof(tmp_str))) + strlcpy(settings->path.content_image_history, tmp_str, sizeof(settings->path.content_image_history)); + + if (config_get_path(conf, "content_video_history_path", tmp_str, sizeof(tmp_str))) + strlcpy(settings->path.content_video_history, tmp_str, sizeof(settings->path.content_video_history)); + if (config_get_path(conf, "resampler_directory", tmp_str, sizeof(tmp_str))) strlcpy(settings->directory.resampler, tmp_str, sizeof(settings->directory.resampler)); @@ -1844,7 +1856,62 @@ static bool config_load_file(const char *path, bool set_defaults) } } + if (string_is_empty(settings->path.content_music_history)) + { + if (string_is_empty(settings->directory.content_history)) + { + fill_pathname_resolve_relative( + settings->path.content_music_history, + global->path.config, + file_path_str(FILE_PATH_CONTENT_MUSIC_HISTORY), + sizeof(settings->path.content_music_history)); + } + else + { + fill_pathname_join(settings->path.content_music_history, + settings->directory.content_history, + file_path_str(FILE_PATH_CONTENT_MUSIC_HISTORY), + sizeof(settings->path.content_music_history)); + } + } + if (string_is_empty(settings->path.content_video_history)) + { + if (string_is_empty(settings->directory.content_history)) + { + fill_pathname_resolve_relative( + settings->path.content_video_history, + global->path.config, + file_path_str(FILE_PATH_CONTENT_VIDEO_HISTORY), + sizeof(settings->path.content_video_history)); + } + else + { + fill_pathname_join(settings->path.content_video_history, + settings->directory.content_history, + file_path_str(FILE_PATH_CONTENT_VIDEO_HISTORY), + sizeof(settings->path.content_video_history)); + } + } + + if (string_is_empty(settings->path.content_image_history)) + { + if (string_is_empty(settings->directory.content_history)) + { + fill_pathname_resolve_relative( + settings->path.content_image_history, + global->path.config, + file_path_str(FILE_PATH_CONTENT_IMAGE_HISTORY), + sizeof(settings->path.content_image_history)); + } + else + { + fill_pathname_join(settings->path.content_image_history, + settings->directory.content_history, + file_path_str(FILE_PATH_CONTENT_IMAGE_HISTORY), + sizeof(settings->path.content_image_history)); + } + } if (!string_is_empty(settings->directory.screenshot)) @@ -2808,6 +2875,12 @@ bool config_save_file(const char *path) #endif { "content_history_path", false, settings->path.content_history}, + { "content_music_history_path", false, + settings->path.content_music_history}, + { "content_video_history_path", false, + settings->path.content_video_history}, + { "content_image_history_path", false, + settings->path.content_image_history}, #ifdef HAVE_OVERLAY { "input_overlay", false, settings->path.overlay}, diff --git a/configuration.h b/configuration.h index fc266e1087..daa209594f 100644 --- a/configuration.h +++ b/configuration.h @@ -393,6 +393,9 @@ typedef struct settings char softfilter_plugin[PATH_MAX_LENGTH]; char core_options[PATH_MAX_LENGTH]; char content_history[PATH_MAX_LENGTH]; + char content_music_history[PATH_MAX_LENGTH]; + char content_image_history[PATH_MAX_LENGTH]; + char content_video_history[PATH_MAX_LENGTH]; char libretro_info[PATH_MAX_LENGTH]; char cheat_settings[PATH_MAX_LENGTH]; char bundle_assets_src[PATH_MAX_LENGTH]; diff --git a/file_path_special.h b/file_path_special.h index f8aa12e14d..834da374f1 100644 --- a/file_path_special.h +++ b/file_path_special.h @@ -34,6 +34,9 @@ enum file_path_enum FILE_PATH_LOG_ERROR, FILE_PATH_LOG_INFO, FILE_PATH_CONTENT_HISTORY, + FILE_PATH_CONTENT_MUSIC_HISTORY, + FILE_PATH_CONTENT_VIDEO_HISTORY, + FILE_PATH_CONTENT_IMAGE_HISTORY, FILE_PATH_BACKGROUND_IMAGE, FILE_PATH_TTF_FONT, FILE_PATH_MAIN_CONFIG, diff --git a/file_path_str.c b/file_path_str.c index bb952bd477..e34e52643a 100644 --- a/file_path_str.c +++ b/file_path_str.c @@ -119,6 +119,12 @@ const char *file_path_str(enum file_path_enum enum_idx) return "autoconfig.zip"; case FILE_PATH_CONTENT_HISTORY: return "content_history.lpl"; + case FILE_PATH_CONTENT_MUSIC_HISTORY: + return "content_music_history.lpl"; + case FILE_PATH_CONTENT_VIDEO_HISTORY: + return "content_video_history.lpl"; + case FILE_PATH_CONTENT_IMAGE_HISTORY: + return "content_image_history.lpl"; case FILE_PATH_CORE_OPTIONS_CONFIG: return "retroarch-core-options.cfg"; case FILE_PATH_MAIN_CONFIG: diff --git a/retroarch.cfg b/retroarch.cfg index 4c14db2e3a..f3140707db 100644 --- a/retroarch.cfg +++ b/retroarch.cfg @@ -62,11 +62,26 @@ # A default path will be assigned if not set. # core_options_path = -# Path to content load history file. +# Path to content history file. # RetroArch keeps track of all content loaded in the menu and from CLI directly for convenient quick loading. # A default path will be assigned if not set. # content_history_path = +# Path to music content history file (optional). +# RetroArch keeps track of all music content loaded in the menu and from CLI directly for convenient quick loading. +# A default path will be assigned if not set. +# content_music_history_path = + +# Path to image content history file (optional). +# RetroArch keeps track of all image content loaded in the menu and from CLI directly for convenient quick loading. +# A default path will be assigned if not set. +# content_image_history_path = + +# Path to video content history file (optional). +# RetroArch keeps track of all video content loaded in the menu and from CLI directly for convenient quick loading. +# A default path will be assigned if not set. +# content_video_history_path = + # Number of entries that will be kept in content history file. # content_history_size = 100