diff --git a/apple/common/setting_data.c b/apple/common/setting_data.c index 048e232e79..2a138d1f6c 100644 --- a/apple/common/setting_data.c +++ b/apple/common/setting_data.c @@ -378,7 +378,7 @@ const rarch_setting_t* setting_data_get_list() CONFIG_UINT(g_settings.game_history_size, "game_history_size", "Content History Size", game_history_size) #ifdef HAVE_RGUI - CONFIG_PATH(g_settings.content_directory, "rgui_browser_directory", "Content Directory", DEFAULT_ME_YO) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR) + CONFIG_PATH(g_settings.rgui_content_directory, "rgui_browser_directory", "Content Directory", DEFAULT_ME_YO) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR) CONFIG_PATH(g_settings.rgui_config_directory, "rgui_config_directory", "Config Directory", DEFAULT_ME_YO) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR) CONFIG_BOOL(g_settings.rgui_show_start_screen, "rgui_show_start_screen", "Show Start Screen", rgui_show_start_screen) #endif diff --git a/dynamic.c b/dynamic.c index aadb260a53..ac81cc37ad 100644 --- a/dynamic.c +++ b/dynamic.c @@ -914,10 +914,14 @@ bool rarch_environment_cb(unsigned cmd, void *data) RARCH_LOG("Environ (Private) EXEC.\n"); break; + case RETRO_ENVIRONMENT_GET_CONTENT_DIRECTORY: - *(const char **)data = *g_settings.content_directory ? g_settings.content_directory : NULL; + { + const char **dir = (const char**)dir; + *dir = *g_settings.content_directory ? g_settings.content_directory : NULL; RARCH_LOG("Environ CONTENT_DIRECTORY: \"%s\".\n", g_settings.content_directory); break; + } default: RARCH_LOG("Environ UNSUPPORTED (#%u).\n", cmd); diff --git a/frontend/menu/menu_common.c b/frontend/menu/menu_common.c index ca5945422e..802177646d 100644 --- a/frontend/menu/menu_common.c +++ b/frontend/menu/menu_common.c @@ -387,7 +387,7 @@ void menu_init(void) rarch_fail(1, "menu_init()"); } - strlcpy(rgui->base_path, g_settings.content_directory, sizeof(rgui->base_path)); + strlcpy(rgui->base_path, g_settings.rgui_content_directory, sizeof(rgui->base_path)); rgui->menu_stack = (file_list_t*)calloc(1, sizeof(file_list_t)); rgui->selection_buf = (file_list_t*)calloc(1, sizeof(file_list_t)); file_list_push(rgui->menu_stack, "", RGUI_SETTINGS, 0); @@ -1222,7 +1222,7 @@ static int menu_iterate_func(void *data, unsigned action) } else if (menu_type == RGUI_BROWSER_DIR_PATH) { - strlcpy(g_settings.content_directory, dir, sizeof(g_settings.content_directory)); + strlcpy(g_settings.rgui_content_directory, dir, sizeof(g_settings.rgui_content_directory)); strlcpy(rgui->base_path, dir, sizeof(rgui->base_path)); menu_flush_stack_type(rgui, RGUI_SETTINGS_PATH_OPTIONS); } diff --git a/frontend/menu/menu_settings.c b/frontend/menu/menu_settings.c index 709e143fe0..742d02dc21 100644 --- a/frontend/menu/menu_settings.c +++ b/frontend/menu/menu_settings.c @@ -894,7 +894,7 @@ int menu_set_settings(void *data, unsigned setting, unsigned action) case RGUI_BROWSER_DIR_PATH: if (action == RGUI_ACTION_START) { - *g_settings.content_directory = '\0'; + *g_settings.rgui_content_directory = '\0'; *rgui->base_path = '\0'; } break; @@ -1720,7 +1720,7 @@ void menu_set_settings_label(char *type_str, size_t type_str_size, unsigned *w, snprintf(type_str, type_str_size, (g_settings.fps_show) ? "ON" : "OFF"); break; case RGUI_BROWSER_DIR_PATH: - strlcpy(type_str, *g_settings.content_directory ? g_settings.content_directory : "", type_str_size); + strlcpy(type_str, *g_settings.rgui_content_directory ? g_settings.rgui_content_directory : "", type_str_size); break; #ifdef HAVE_SCREENSHOTS case RGUI_SCREENSHOT_DIR_PATH: diff --git a/general.h b/general.h index 4c4f1f7e80..8046c4aefd 100644 --- a/general.h +++ b/general.h @@ -297,6 +297,7 @@ struct settings char content_directory[PATH_MAX]; #if defined(HAVE_MENU) + char rgui_content_directory[PATH_MAX]; char rgui_config_directory[PATH_MAX]; bool rgui_show_start_screen; #endif diff --git a/retroarch.cfg b/retroarch.cfg index 8758f08fcb..e18b750862 100644 --- a/retroarch.cfg +++ b/retroarch.cfg @@ -43,6 +43,10 @@ # Sets start directory for RGUI ROM browser. # rgui_browser_directory = +# Content directory. Interacts with RETRO_ENVIRONMENT_GET_CONTENT_DIRECTORY. +# Usually set by developers who bundle libretro/RetroArch apps to point to assets. +# content_directory = + # Sets start directory for RGUI config browser. # rgui_config_directory = diff --git a/settings.c b/settings.c index 5929d860a0..15d64ad0b1 100644 --- a/settings.c +++ b/settings.c @@ -370,6 +370,7 @@ void config_set_defaults(void) *g_settings.input.overlay = '\0'; *g_settings.content_directory = '\0'; #ifdef HAVE_MENU + *g_settings.rgui_content_directory = '\0'; *g_settings.rgui_config_directory = '\0'; #endif @@ -819,10 +820,13 @@ bool config_load_file(const char *path) } } - CONFIG_GET_PATH(content_directory, "rgui_browser_directory"); + CONFIG_GET_PATH(content_directory, "content_directory"); if (!strcmp(g_settings.content_directory, "default")) *g_settings.content_directory = '\0'; #ifdef HAVE_MENU + CONFIG_GET_PATH(rgui_content_directory, "rgui_browser_directory"); + if (!strcmp(g_settings.rgui_content_directory, "default")) + *g_settings.rgui_content_directory = '\0'; CONFIG_GET_PATH(rgui_config_directory, "rgui_config_directory"); if (!strcmp(g_settings.rgui_config_directory, "default")) *g_settings.rgui_config_directory = '\0'; @@ -1162,8 +1166,9 @@ bool config_save_file(const char *path) config_set_path(conf, "savestate_directory", *g_extern.savestate_dir ? g_extern.savestate_dir : "default"); config_set_path(conf, "video_shader_dir", *g_settings.video.shader_dir ? g_settings.video.shader_dir : "default"); + config_set_path(conf, "content_directory", *g_settings.content_directory ? g_settings.content_directory : "default"); #ifdef HAVE_MENU - config_set_path(conf, "rgui_browser_directory", *g_settings.content_directory ? g_settings.content_directory : "default"); + config_set_path(conf, "rgui_browser_directory", *g_settings.rgui_content_directory ? g_settings.rgui_content_directory : "default"); config_set_path(conf, "rgui_config_directory", *g_settings.rgui_config_directory ? g_settings.rgui_config_directory : "default"); config_set_bool(conf, "rgui_show_start_screen", g_settings.rgui_show_start_screen); #endif