(Menu) Add Extraction Directory

This commit is contained in:
twinaphex 2014-07-24 20:28:38 +02:00
parent 8ebc6dfd74
commit a21532753b
3 changed files with 21 additions and 3 deletions

View File

@ -545,6 +545,7 @@ static void menu_common_entries_init(void *data, unsigned menu_type)
file_list_push(menu->selection_buf, "System Directory", MENU_SYSTEM_DIR_PATH, 0);
file_list_push(menu->selection_buf, "Screenshot Directory", MENU_SCREENSHOT_DIR_PATH, 0);
file_list_push(menu->selection_buf, "Autoconfig Directory", MENU_AUTOCONFIG_DIR_PATH, 0);
file_list_push(menu->selection_buf, "Extraction Directory", MENU_EXTRACTION_DIR_PATH, 0);
break;
case MENU_SETTINGS_INPUT_OPTIONS:
file_list_clear(menu->selection_buf);
@ -1748,6 +1749,7 @@ static unsigned menu_common_type_is(unsigned type)
type == MENU_OVERLAY_DIR_PATH ||
type == MENU_SCREENSHOT_DIR_PATH ||
type == MENU_AUTOCONFIG_DIR_PATH ||
type == MENU_EXTRACTION_DIR_PATH ||
type == MENU_SYSTEM_DIR_PATH;
if (type_found)
@ -2787,6 +2789,11 @@ static int menu_common_iterate(unsigned action)
strlcpy(g_settings.input.autoconfig_dir, dir, sizeof(g_settings.input.autoconfig_dir));
menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS);
}
else if (menu_type == MENU_EXTRACTION_DIR_PATH)
{
strlcpy(g_settings.extraction_directory, dir, sizeof(g_settings.extraction_directory));
menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS);
}
else
{
if (driver.menu->defer_core)
@ -4285,6 +4292,10 @@ static int menu_common_setting_set(unsigned setting, unsigned action)
if (action == MENU_ACTION_START)
*g_settings.input.autoconfig_dir = '\0';
break;
case MENU_EXTRACTION_DIR_PATH:
if (action == MENU_ACTION_START)
*g_settings.extraction_directory = '\0';
break;
case MENU_SETTINGS_VIDEO_ROTATION:
if ((current_setting = setting_data_find_setting(setting_data, "video_rotation")))
menu_common_setting_set_current_unsigned_integer(current_setting, 1, action, true, true);
@ -5107,6 +5118,9 @@ static void menu_common_setting_set_label(char *type_str, size_t type_str_size,
case MENU_AUTOCONFIG_DIR_PATH:
strlcpy(type_str, *g_settings.input.autoconfig_dir ? g_settings.input.autoconfig_dir : "<default>", type_str_size);
break;
case MENU_EXTRACTION_DIR_PATH:
strlcpy(type_str, *g_settings.extraction_directory ? g_settings.extraction_directory : "<None>", type_str_size);
break;
case MENU_SETTINGS_DISK_INDEX:
{
const struct retro_disk_control_callback *control = &g_extern.system.disk_control;

View File

@ -146,6 +146,7 @@ typedef enum
MENU_OVERLAY_DIR_PATH,
MENU_SYSTEM_DIR_PATH,
MENU_AUTOCONFIG_DIR_PATH,
MENU_EXTRACTION_DIR_PATH,
MENU_SETTINGS_RESTART_GAME,
MENU_SETTINGS_AUDIO_DSP_FILTER,
MENU_SETTINGS_AUDIO_MUTE,

View File

@ -201,16 +201,16 @@ bool setting_data_load_config_path(const rarch_setting_t* settings, const char*
rarch_setting_t* setting_data_find_setting(rarch_setting_t* settings, const char* name)
{
rarch_setting_t *setting;
rarch_setting_t *setting = NULL;
if (!name)
return NULL;
for (setting = settings; setting->type != ST_NONE; setting++)
if (setting->type <= ST_GROUP && strcmp(setting->name, name) == 0)
return setting;
break;
return NULL;
return setting;
}
void setting_data_set_with_string_representation(const rarch_setting_t* setting, const char* value)
@ -635,6 +635,8 @@ static void general_change_handler(const void *data)
strlcpy(g_extern.savestate_dir, setting->value.string, sizeof(g_extern.savestate_dir));
else if (!strcmp(setting->name, "system_directory"))
strlcpy(g_settings.system_directory, setting->value.string, sizeof(g_settings.system_directory));
else if (!strcmp(setting->name, "extraction_directory"))
strlcpy(g_settings.extraction_directory, setting->value.string, sizeof(g_settings.extraction_directory));
else if (!strcmp(setting->name, "input_player1_joypad_index"))
g_settings.input.joypad_map[0] = *setting->value.integer;
else if (!strcmp(setting->name, "input_player2_joypad_index"))
@ -1057,6 +1059,7 @@ rarch_setting_t* setting_data_get_list(void)
CONFIG_PATH(g_extern.savefile_dir, "savefile_directory", "Savefile Directory", "", GROUP_NAME, SUBGROUP_NAME, general_change_handler);
CONFIG_PATH(g_extern.savestate_dir, "savestate_directory", "Savestate Directory", "", GROUP_NAME, SUBGROUP_NAME, general_change_handler)
CONFIG_PATH(g_settings.system_directory, "system_directory", "System Directory", "", GROUP_NAME, SUBGROUP_NAME, general_change_handler)
CONFIG_PATH(g_settings.extraction_directory, "extraction_directory", "Extraction Directory", "", GROUP_NAME, SUBGROUP_NAME, general_change_handler)
END_SUB_GROUP()
END_GROUP()