From 69aa1ba09a752b9abfd3990566b37d613c871935 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 26 Oct 2016 05:28:16 +0200 Subject: [PATCH] Simplify CONFIG_DIR --- menu/menu_setting.c | 156 ++++++++++++++++++++++---------------------- setting_list.c | 14 ++-- setting_list.h | 6 +- 3 files changed, 92 insertions(+), 84 deletions(-) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 38d68df42c..6bc77b6280 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -6207,10 +6207,10 @@ static bool setting_append_list( list, list_info, settings->directory.system, sizeof(settings->directory.system), - msg_hash_to_str(MENU_ENUM_LABEL_SYSTEM_DIRECTORY), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_DIRECTORY), + MENU_ENUM_LABEL_SYSTEM_DIRECTORY, + MENU_ENUM_LABEL_VALUE_SYSTEM_DIRECTORY, "", - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DIRECTORY_CONTENT), + MENU_ENUM_LABEL_VALUE_DIRECTORY_CONTENT, &group_info, &subgroup_info, parent_group, @@ -6222,10 +6222,10 @@ static bool setting_append_list( list, list_info, settings->directory.core_assets, sizeof(settings->directory.core_assets), - msg_hash_to_str(MENU_ENUM_LABEL_CORE_ASSETS_DIRECTORY), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_ASSETS_DIRECTORY), + MENU_ENUM_LABEL_CORE_ASSETS_DIRECTORY, + MENU_ENUM_LABEL_VALUE_CORE_ASSETS_DIRECTORY, "", - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT), + MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT, &group_info, &subgroup_info, parent_group, @@ -6237,10 +6237,10 @@ static bool setting_append_list( list, list_info, settings->directory.assets, sizeof(settings->directory.assets), - msg_hash_to_str(MENU_ENUM_LABEL_ASSETS_DIRECTORY), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ASSETS_DIRECTORY), + MENU_ENUM_LABEL_ASSETS_DIRECTORY, + MENU_ENUM_LABEL_VALUE_ASSETS_DIRECTORY, "", - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT), + MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT, &group_info, &subgroup_info, parent_group, @@ -6252,10 +6252,10 @@ static bool setting_append_list( list, list_info, settings->directory.dynamic_wallpapers, sizeof(settings->directory.dynamic_wallpapers), - msg_hash_to_str(MENU_ENUM_LABEL_DYNAMIC_WALLPAPERS_DIRECTORY), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DYNAMIC_WALLPAPERS_DIRECTORY), + MENU_ENUM_LABEL_DYNAMIC_WALLPAPERS_DIRECTORY, + MENU_ENUM_LABEL_VALUE_DYNAMIC_WALLPAPERS_DIRECTORY, "", - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT), + MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT, &group_info, &subgroup_info, parent_group, @@ -6267,10 +6267,10 @@ static bool setting_append_list( list, list_info, settings->directory.thumbnails, sizeof(settings->directory.thumbnails), - msg_hash_to_str(MENU_ENUM_LABEL_THUMBNAILS_DIRECTORY), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_THUMBNAILS_DIRECTORY), + MENU_ENUM_LABEL_THUMBNAILS_DIRECTORY, + MENU_ENUM_LABEL_VALUE_THUMBNAILS_DIRECTORY, "", - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT), + MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT, &group_info, &subgroup_info, parent_group, @@ -6282,10 +6282,10 @@ static bool setting_append_list( list, list_info, settings->directory.menu_content, sizeof(settings->directory.menu_content), - msg_hash_to_str(MENU_ENUM_LABEL_RGUI_BROWSER_DIRECTORY), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RGUI_BROWSER_DIRECTORY), + MENU_ENUM_LABEL_RGUI_BROWSER_DIRECTORY, + MENU_ENUM_LABEL_VALUE_RGUI_BROWSER_DIRECTORY, "", - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT), + MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT, &group_info, &subgroup_info, parent_group, @@ -6297,10 +6297,10 @@ static bool setting_append_list( list, list_info, settings->directory.menu_config, sizeof(settings->directory.menu_config), - msg_hash_to_str(MENU_ENUM_LABEL_RGUI_CONFIG_DIRECTORY), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RGUI_CONFIG_DIRECTORY), + MENU_ENUM_LABEL_RGUI_CONFIG_DIRECTORY, + MENU_ENUM_LABEL_VALUE_RGUI_CONFIG_DIRECTORY, "", - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT), + MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT, &group_info, &subgroup_info, parent_group, @@ -6313,10 +6313,10 @@ static bool setting_append_list( list, list_info, settings->directory.libretro, sizeof(settings->directory.libretro), - msg_hash_to_str(MENU_ENUM_LABEL_LIBRETRO_DIR_PATH), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH), + MENU_ENUM_LABEL_LIBRETRO_DIR_PATH, + MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH, g_defaults.dir.core, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DIRECTORY_NONE), + MENU_ENUM_LABEL_VALUE_DIRECTORY_NONE, &group_info, &subgroup_info, parent_group, @@ -6329,10 +6329,10 @@ static bool setting_append_list( list, list_info, settings->path.libretro_info, sizeof(settings->path.libretro_info), - msg_hash_to_str(MENU_ENUM_LABEL_LIBRETRO_INFO_PATH), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LIBRETRO_INFO_PATH), + MENU_ENUM_LABEL_LIBRETRO_INFO_PATH, + MENU_ENUM_LABEL_VALUE_LIBRETRO_INFO_PATH, g_defaults.dir.core_info, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DIRECTORY_NONE), + MENU_ENUM_LABEL_VALUE_DIRECTORY_NONE, &group_info, &subgroup_info, parent_group, @@ -6346,10 +6346,10 @@ static bool setting_append_list( list, list_info, settings->path.content_database, sizeof(settings->path.content_database), - msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_DATABASE_DIRECTORY), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_DATABASE_DIRECTORY), + MENU_ENUM_LABEL_CONTENT_DATABASE_DIRECTORY, + MENU_ENUM_LABEL_VALUE_CONTENT_DATABASE_DIRECTORY, "", - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DIRECTORY_NONE), + MENU_ENUM_LABEL_VALUE_DIRECTORY_NONE, &group_info, &subgroup_info, parent_group, @@ -6361,10 +6361,10 @@ static bool setting_append_list( list, list_info, settings->directory.cursor, sizeof(settings->directory.cursor), - msg_hash_to_str(MENU_ENUM_LABEL_CURSOR_DIRECTORY), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CURSOR_DIRECTORY), + MENU_ENUM_LABEL_CURSOR_DIRECTORY, + MENU_ENUM_LABEL_VALUE_CURSOR_DIRECTORY, "", - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DIRECTORY_NONE), + MENU_ENUM_LABEL_VALUE_DIRECTORY_NONE, &group_info, &subgroup_info, parent_group, @@ -6377,10 +6377,10 @@ static bool setting_append_list( list, list_info, settings->path.cheat_database, sizeof(settings->path.cheat_database), - msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_DATABASE_PATH), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CHEAT_DATABASE_PATH), + MENU_ENUM_LABEL_CHEAT_DATABASE_PATH, + MENU_ENUM_LABEL_VALUE_CHEAT_DATABASE_PATH, "", - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DIRECTORY_NONE), + MENU_ENUM_LABEL_VALUE_DIRECTORY_NONE, &group_info, &subgroup_info, parent_group, @@ -6392,10 +6392,10 @@ static bool setting_append_list( list, list_info, settings->directory.video_filter, sizeof(settings->directory.video_filter), - msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_FILTER_DIR), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_FILTER_DIR), + MENU_ENUM_LABEL_VIDEO_FILTER_DIR, + MENU_ENUM_LABEL_VALUE_VIDEO_FILTER_DIR, "", - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT), + MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT, &group_info, &subgroup_info, parent_group, @@ -6407,10 +6407,10 @@ static bool setting_append_list( list, list_info, settings->directory.audio_filter, sizeof(settings->directory.audio_filter), - msg_hash_to_str(MENU_ENUM_LABEL_AUDIO_FILTER_DIR), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_AUDIO_FILTER_DIR), + MENU_ENUM_LABEL_AUDIO_FILTER_DIR, + MENU_ENUM_LABEL_VALUE_AUDIO_FILTER_DIR, "", - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT), + MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT, &group_info, &subgroup_info, parent_group, @@ -6422,10 +6422,10 @@ static bool setting_append_list( list, list_info, settings->directory.video_shader, sizeof(settings->directory.video_shader), - msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_DIR), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_DIR), + MENU_ENUM_LABEL_VIDEO_SHADER_DIR, + MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_DIR, g_defaults.dir.shader, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT), + MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT, &group_info, &subgroup_info, parent_group, @@ -6439,10 +6439,10 @@ static bool setting_append_list( list, list_info, global->record.output_dir, sizeof(global->record.output_dir), - msg_hash_to_str(MENU_ENUM_LABEL_RECORDING_OUTPUT_DIRECTORY), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY), + MENU_ENUM_LABEL_RECORDING_OUTPUT_DIRECTORY, + MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY, "", - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT), + MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT, &group_info, &subgroup_info, parent_group, @@ -6454,10 +6454,10 @@ static bool setting_append_list( list, list_info, global->record.config_dir, sizeof(global->record.config_dir), - msg_hash_to_str(MENU_ENUM_LABEL_RECORDING_CONFIG_DIRECTORY), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY), + MENU_ENUM_LABEL_RECORDING_CONFIG_DIRECTORY, + MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY, "", - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT), + MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT, &group_info, &subgroup_info, parent_group, @@ -6470,10 +6470,10 @@ static bool setting_append_list( list, list_info, settings->directory.overlay, sizeof(settings->directory.overlay), - msg_hash_to_str(MENU_ENUM_LABEL_OVERLAY_DIRECTORY), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OVERLAY_DIRECTORY), + MENU_ENUM_LABEL_OVERLAY_DIRECTORY, + MENU_ENUM_LABEL_VALUE_OVERLAY_DIRECTORY, g_defaults.dir.overlay, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT), + MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT, &group_info, &subgroup_info, parent_group, @@ -6485,10 +6485,10 @@ static bool setting_append_list( list, list_info, dir_get_ptr(RARCH_DIR_OSK_OVERLAY), dir_get_size(RARCH_DIR_OSK_OVERLAY), - msg_hash_to_str(MENU_ENUM_LABEL_OSK_OVERLAY_DIRECTORY), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OSK_OVERLAY_DIRECTORY), + MENU_ENUM_LABEL_OSK_OVERLAY_DIRECTORY, + MENU_ENUM_LABEL_VALUE_OSK_OVERLAY_DIRECTORY, g_defaults.dir.osk_overlay, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT), + MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT, &group_info, &subgroup_info, parent_group, @@ -6501,10 +6501,10 @@ static bool setting_append_list( list, list_info, settings->directory.screenshot, sizeof(settings->directory.screenshot), - msg_hash_to_str(MENU_ENUM_LABEL_SCREENSHOT_DIRECTORY), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SCREENSHOT_DIRECTORY), + MENU_ENUM_LABEL_SCREENSHOT_DIRECTORY, + MENU_ENUM_LABEL_VALUE_SCREENSHOT_DIRECTORY, "", - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DIRECTORY_CONTENT), + MENU_ENUM_LABEL_VALUE_DIRECTORY_CONTENT, &group_info, &subgroup_info, parent_group, @@ -6516,10 +6516,10 @@ static bool setting_append_list( list, list_info, settings->directory.autoconfig, sizeof(settings->directory.autoconfig), - msg_hash_to_str(MENU_ENUM_LABEL_JOYPAD_AUTOCONFIG_DIR), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_JOYPAD_AUTOCONFIG_DIR), + MENU_ENUM_LABEL_JOYPAD_AUTOCONFIG_DIR, + MENU_ENUM_LABEL_VALUE_JOYPAD_AUTOCONFIG_DIR, "", - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT), + MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT, &group_info, &subgroup_info, parent_group, @@ -6531,10 +6531,10 @@ static bool setting_append_list( list, list_info, settings->directory.input_remapping, sizeof(settings->directory.input_remapping), - msg_hash_to_str(MENU_ENUM_LABEL_INPUT_REMAPPING_DIRECTORY), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_REMAPPING_DIRECTORY), + MENU_ENUM_LABEL_INPUT_REMAPPING_DIRECTORY, + MENU_ENUM_LABEL_VALUE_INPUT_REMAPPING_DIRECTORY, "", - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DIRECTORY_NONE), + MENU_ENUM_LABEL_VALUE_DIRECTORY_NONE, &group_info, &subgroup_info, parent_group, @@ -6546,10 +6546,10 @@ static bool setting_append_list( list, list_info, settings->directory.playlist, sizeof(settings->directory.playlist), - msg_hash_to_str(MENU_ENUM_LABEL_PLAYLIST_DIRECTORY), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_DIRECTORY), + MENU_ENUM_LABEL_PLAYLIST_DIRECTORY, + MENU_ENUM_LABEL_VALUE_PLAYLIST_DIRECTORY, "", - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT), + MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT, &group_info, &subgroup_info, parent_group, @@ -6561,10 +6561,10 @@ static bool setting_append_list( list, list_info, dir_get_ptr(RARCH_DIR_SAVEFILE), dir_get_size(RARCH_DIR_SAVEFILE), - msg_hash_to_str(MENU_ENUM_LABEL_SAVEFILE_DIRECTORY), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SAVEFILE_DIRECTORY), + MENU_ENUM_LABEL_SAVEFILE_DIRECTORY, + MENU_ENUM_LABEL_VALUE_SAVEFILE_DIRECTORY, "", - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DIRECTORY_CONTENT), + MENU_ENUM_LABEL_VALUE_DIRECTORY_CONTENT, &group_info, &subgroup_info, parent_group, @@ -6576,10 +6576,10 @@ static bool setting_append_list( list, list_info, dir_get_ptr(RARCH_DIR_SAVESTATE), dir_get_size(RARCH_DIR_SAVESTATE), - msg_hash_to_str(MENU_ENUM_LABEL_SAVESTATE_DIRECTORY), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SAVESTATE_DIRECTORY), + MENU_ENUM_LABEL_SAVESTATE_DIRECTORY, + MENU_ENUM_LABEL_VALUE_SAVESTATE_DIRECTORY, "", - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DIRECTORY_CONTENT), + MENU_ENUM_LABEL_VALUE_DIRECTORY_CONTENT, &group_info, &subgroup_info, parent_group, @@ -6591,10 +6591,10 @@ static bool setting_append_list( list, list_info, settings->directory.cache, sizeof(settings->directory.cache), - msg_hash_to_str(MENU_ENUM_LABEL_CACHE_DIRECTORY), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CACHE_DIRECTORY), + MENU_ENUM_LABEL_CACHE_DIRECTORY, + MENU_ENUM_LABEL_VALUE_CACHE_DIRECTORY, "", - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DIRECTORY_NONE), + MENU_ENUM_LABEL_VALUE_DIRECTORY_NONE, &group_info, &subgroup_info, parent_group, diff --git a/setting_list.c b/setting_list.c index 92c5eb6afe..9cb65596ee 100644 --- a/setting_list.c +++ b/setting_list.c @@ -1589,15 +1589,21 @@ bool CONFIG_DIR( rarch_setting_t **list, rarch_setting_info_t *list_info, char *target, size_t len, - const char *name, const char *SHORT, - const char *default_value, const char *empty, + enum msg_hash_enums name_enum_idx, + enum msg_hash_enums SHORT_enum_idx, + const char *default_value, + enum msg_hash_enums empty_enum_idx, rarch_setting_group_info_t *group_info, rarch_setting_group_info_t *subgroup_info, const char *parent_group, change_handler_t change_handler, change_handler_t read_handler) { - rarch_setting_t value = setting_string_setting(ST_DIR, name, SHORT, target, len, default_value, empty, - group_info->name, subgroup_info->name, parent_group, change_handler, read_handler); + rarch_setting_t value = setting_string_setting(ST_DIR, + msg_hash_to_str(name_enum_idx), + msg_hash_to_str(SHORT_enum_idx), + target, len, default_value, + msg_hash_to_str(empty_enum_idx), + group_info->name, subgroup_info->name, parent_group, change_handler, read_handler); if (!(settings_list_append(list, list_info))) return false; if (value.name) diff --git a/setting_list.h b/setting_list.h index 3dd96e36c2..00d6f1d65e 100644 --- a/setting_list.h +++ b/setting_list.h @@ -300,8 +300,10 @@ bool CONFIG_DIR( rarch_setting_t **list, rarch_setting_info_t *list_info, char *target, size_t len, - const char *name, const char *SHORT, - const char *default_value, const char *empty, + enum msg_hash_enums name_enum_idx, + enum msg_hash_enums SHORT_enum_idx, + const char *default_value, + enum msg_hash_enums empty_enum_idx, rarch_setting_group_info_t *group_info, rarch_setting_group_info_t *subgroup_info, const char *parent_group,