From 89676e8424dbf3a1f1d9397e06e43749ae60041f Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 15 Sep 2014 04:12:27 +0200 Subject: [PATCH] Add Playlist Directory path setting --- frontend/frontend.c | 2 ++ frontend/menu/disp/shared.h | 2 ++ frontend/menu/menu_common.c | 1 + general.h | 2 ++ retroarch.cfg | 4 ++++ settings.c | 10 ++++++++++ settings_data.c | 1 + 7 files changed, 22 insertions(+) diff --git a/frontend/frontend.c b/frontend/frontend.c index 73b7c764ba..378f13b011 100644 --- a/frontend/frontend.c +++ b/frontend/frontend.c @@ -274,6 +274,8 @@ static void check_defaults_dirs(void) path_mkdir(g_defaults.audio_filter_dir); if (*g_defaults.assets_dir) path_mkdir(g_defaults.assets_dir); + if (*g_defaults.playlist_dir) + path_mkdir(g_defaults.playlist_dir); if (*g_defaults.core_dir) path_mkdir(g_defaults.core_dir); if (*g_defaults.core_info_dir) diff --git a/frontend/menu/disp/shared.h b/frontend/menu/disp/shared.h index e3fb7f061f..03e2d01207 100644 --- a/frontend/menu/disp/shared.h +++ b/frontend/menu/disp/shared.h @@ -80,6 +80,8 @@ static void get_title(const char *label, const char *dir, snprintf(title, sizeof_title, "DSP FILTER %s", dir); else if (!strcmp(label, "rgui_browser_directory")) snprintf(title, sizeof_title, "BROWSER DIR %s", dir); + else if (!strcmp(label, "playlist_directory")) + snprintf(title, sizeof_title, "PLAYLIST DIR %s", dir); else if (!strcmp(label, "content_directory")) snprintf(title, sizeof_title, "CONTENT DIR %s", dir); else if (!strcmp(label, "screenshot_directory")) diff --git a/frontend/menu/menu_common.c b/frontend/menu/menu_common.c index ecfc4d1f2d..6861d5b0f9 100644 --- a/frontend/menu/menu_common.c +++ b/frontend/menu/menu_common.c @@ -444,6 +444,7 @@ unsigned menu_common_type_is(const char *label, unsigned type) !strcmp(label, "overlay_directory") || !strcmp(label, "screenshot_directory") || !strcmp(label, "joypad_autoconfig_dir") || + !strcmp(label, "playlist_directory") || !strcmp(label, "extraction_directory") || !strcmp(label, "system_directory")) return MENU_FILE_DIRECTORY; diff --git a/general.h b/general.h index 629aa231ad..76e998c6e5 100644 --- a/general.h +++ b/general.h @@ -197,6 +197,7 @@ struct defaults char sram_dir[PATH_MAX]; char screenshot_dir[PATH_MAX]; char system_dir[PATH_MAX]; + char playlist_dir[PATH_MAX]; struct { @@ -365,6 +366,7 @@ struct settings char system_directory[PATH_MAX]; char extraction_directory[PATH_MAX]; + char playlist_directory[PATH_MAX]; bool rewind_enable; size_t rewind_buffer_size; diff --git a/retroarch.cfg b/retroarch.cfg index 080e1df44e..a8019d5269 100644 --- a/retroarch.cfg +++ b/retroarch.cfg @@ -12,6 +12,10 @@ # will be extracted to this directory. # extraction_directory = +# If set to a directory, the content history playlist will be saved +# to this directory along with any other playlists. +# playlist_directory = + # Automatically saves a savestate at the end of RetroArch's lifetime. # The path is $SRAM_PATH.auto. # RetroArch will automatically load any savestate with this path on startup if savestate_auto_load is set. diff --git a/settings.c b/settings.c index f28b5c4602..d7eef4cd2c 100644 --- a/settings.c +++ b/settings.c @@ -452,6 +452,7 @@ void config_set_defaults(void) *g_settings.input.overlay = '\0'; *g_settings.content_directory = '\0'; *g_settings.assets_directory = '\0'; + *g_settings.playlist_directory = '\0'; *g_settings.video.shader_path = '\0'; *g_settings.video.shader_dir = '\0'; *g_settings.video.filter_dir = '\0'; @@ -488,6 +489,9 @@ void config_set_defaults(void) if (*g_defaults.assets_dir) strlcpy(g_settings.assets_directory, g_defaults.assets_dir, sizeof(g_settings.assets_directory)); + if (*g_defaults.playlist_dir) + strlcpy(g_settings.playlist_directory, + g_defaults.playlist_dir, sizeof(g_settings.playlist_directory)); if (*g_defaults.core_dir) fill_pathname_expand_special(g_settings.libretro_directory, g_defaults.core_dir, sizeof(g_settings.libretro_directory)); @@ -1067,10 +1071,13 @@ bool config_load_file(const char *path, bool set_defaults) CONFIG_GET_PATH(extraction_directory, "extraction_directory"); CONFIG_GET_PATH(content_directory, "content_directory"); CONFIG_GET_PATH(assets_directory, "assets_directory"); + CONFIG_GET_PATH(playlist_directory, "playlist_directory"); if (!strcmp(g_settings.content_directory, "default")) *g_settings.content_directory = '\0'; if (!strcmp(g_settings.assets_directory, "default")) *g_settings.assets_directory = '\0'; + if (!strcmp(g_settings.playlist_directory, "default")) + *g_settings.playlist_directory = '\0'; #ifdef HAVE_MENU CONFIG_GET_PATH(menu_content_directory, "rgui_browser_directory"); if (!strcmp(g_settings.menu_content_directory, "default")) @@ -1507,6 +1514,9 @@ bool config_save_file(const char *path) config_set_path(conf, "assets_directory", *g_settings.assets_directory ? g_settings.assets_directory : "default"); + config_set_path(conf, "playlist_directory", + *g_settings.playlist_directory ? + g_settings.playlist_directory : "default"); #ifdef HAVE_MENU config_set_path(conf, "rgui_browser_directory", *g_settings.menu_content_directory ? diff --git a/settings_data.c b/settings_data.c index 2ceaf5b1be..f3580abc58 100644 --- a/settings_data.c +++ b/settings_data.c @@ -2649,6 +2649,7 @@ rarch_setting_t *setting_data_get_list(void) #endif CONFIG_DIR(g_settings.screenshot_directory, "screenshot_directory", "Screenshot Directory", "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR) CONFIG_DIR(g_settings.input.autoconfig_dir, "joypad_autoconfig_dir", "Joypad Autoconfig Directory", "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR) + CONFIG_DIR(g_settings.playlist_directory, "playlist_directory", "Playlist Directory", "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR) CONFIG_DIR(g_extern.savefile_dir, "savefile_directory", "Savefile Directory", "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler); CONFIG_DIR(g_extern.savestate_dir, "savestate_directory", "Savestate Directory", "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) CONFIG_DIR(g_settings.system_directory, "system_directory", "System Directory", "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)