Add Config Directory option to RGUI.

This commit is contained in:
Themaister 2013-09-15 16:15:38 +02:00
parent ce6de72181
commit a3d61e1ec5
2 changed files with 18 additions and 1 deletions

View File

@ -154,6 +154,7 @@ typedef enum
RGUI_SAVESTATE_DIR_PATH,
RGUI_SAVEFILE_DIR_PATH,
RGUI_LIBRETRO_DIR_PATH,
RGUI_CONFIG_DIR_PATH,
#ifdef HAVE_OVERLAY
RGUI_OVERLAY_DIR_PATH,
#endif

View File

@ -219,6 +219,7 @@ static bool menu_type_is_directory_browser(unsigned type)
#ifdef HAVE_DYNAMIC
type == RGUI_LIBRETRO_DIR_PATH ||
#endif
type == RGUI_CONFIG_DIR_PATH ||
type == RGUI_SAVEFILE_DIR_PATH ||
#ifdef HAVE_OVERLAY
type == RGUI_OVERLAY_DIR_PATH ||
@ -489,6 +490,8 @@ static void render_text(rgui_handle_t *rgui)
else if (menu_type == RGUI_LIBRETRO_DIR_PATH)
snprintf(title, sizeof(title), "LIBRETRO DIR %s", dir);
#endif
else if (menu_type == RGUI_CONFIG_DIR_PATH)
snprintf(title, sizeof(title), "CONFIG DIR %s", dir);
else if (menu_type == RGUI_SAVEFILE_DIR_PATH)
snprintf(title, sizeof(title), "SAVEFILE DIR %s", dir);
#ifdef HAVE_OVERLAY
@ -724,6 +727,9 @@ static void render_text(rgui_handle_t *rgui)
strlcpy(type_str, *rgui->libretro_dir ? rgui->libretro_dir : "<None>", sizeof(type_str));
break;
#endif
case RGUI_CONFIG_DIR_PATH:
strlcpy(type_str, *g_settings.rgui_config_directory ? g_settings.rgui_config_directory : "<default>", sizeof(type_str));
break;
case RGUI_SHADER_DIR_PATH:
strlcpy(type_str, *g_settings.video.shader_dir ? g_settings.video.shader_dir : "<default>", sizeof(type_str));
break;
@ -1422,6 +1428,10 @@ static int rgui_settings_toggle_setting(rgui_handle_t *rgui, unsigned setting, r
*rgui->libretro_dir = '\0';
break;
#endif
case RGUI_CONFIG_DIR_PATH:
if (action == RGUI_ACTION_START)
*g_settings.rgui_config_directory = '\0';
break;
case RGUI_SHADER_DIR_PATH:
if (action == RGUI_ACTION_START)
*g_settings.video.shader_dir = '\0';
@ -2137,6 +2147,7 @@ static void rgui_settings_path_populate_entries(rgui_handle_t *rgui)
{
rgui_list_clear(rgui->selection_buf);
rgui_list_push(rgui->selection_buf, "Browser Directory", RGUI_BROWSER_DIR_PATH, 0);
rgui_list_push(rgui->selection_buf, "Config Directory", RGUI_CONFIG_DIR_PATH, 0);
#ifdef HAVE_DYNAMIC
rgui_list_push(rgui->selection_buf, "Core Directory", RGUI_LIBRETRO_DIR_PATH, 0);
#endif
@ -2886,7 +2897,12 @@ static int rgui_iterate(void *data, unsigned action)
#ifdef HAVE_DYNAMIC
else if (menu_type == RGUI_LIBRETRO_DIR_PATH)
{
strlcpy(rgui->libretro_dir, dir, sizeof(g_extern.savestate_dir));
strlcpy(rgui->libretro_dir, dir, sizeof(rgui->libretro_dir));
rgui_flush_menu_stack_type(rgui, RGUI_SETTINGS_PATH_OPTIONS);
}
else if (menu_type == RGUI_CONFIG_DIR_PATH)
{
strlcpy(g_settings.rgui_config_directory, dir, sizeof(g_settings.rgui_config_directory));
rgui_flush_menu_stack_type(rgui, RGUI_SETTINGS_PATH_OPTIONS);
}
#endif