Refactor content_directory.

It shouldn't be RGUI browser dir. Instead it is a more developer centric
option for when libretro apps are distributed (along with RetroArch for
example). Also facilitates a standardized assets folder later on if
applicable.
This commit is contained in:
Themaister 2013-12-26 02:03:11 +01:00
parent 831f708ede
commit b23ff3b663
7 changed files with 22 additions and 8 deletions

View File

@ -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

View File

@ -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);

View File

@ -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);
}

View File

@ -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 : "<default>", type_str_size);
strlcpy(type_str, *g_settings.rgui_content_directory ? g_settings.rgui_content_directory : "<default>", type_str_size);
break;
#ifdef HAVE_SCREENSHOTS
case RGUI_SCREENSHOT_DIR_PATH:

View File

@ -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

View File

@ -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 =

View File

@ -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