(Menu) Refactor ST_PATH settings

This commit is contained in:
twinaphex 2014-09-06 02:47:31 +02:00
parent 7e6aa11c5b
commit a3443a7911
4 changed files with 34 additions and 32 deletions

View File

@ -1653,31 +1653,13 @@ static int menu_action_ok(const char *dir,
&& (type == MENU_FILE_USE_DIRECTORY))
{
menu_common_setting_set_current_string(setting, dir);
menu_flush_stack_label(driver.menu->menu_stack, "Path Options");
menu_entries_pop_stack(driver.menu->menu_stack, setting->name);
}
else if (setting && !strcmp(setting->name, "input_overlay")
&& type == MENU_FILE_PLAIN)
else if ((setting && setting->type == ST_PATH)
&& (type == MENU_FILE_PLAIN))
{
menu_common_setting_set_current_string_path(setting, dir, path);
menu_flush_stack_label(driver.menu->menu_stack, "settings");
}
else if (setting && !strcmp(setting->name, "game_history_path")
&& type == MENU_FILE_PLAIN)
{
menu_common_setting_set_current_string_path(setting, dir, path);
menu_flush_stack_label(driver.menu->menu_stack, "Path Options");
}
else if (setting && !strcmp(setting->name, "video_filter")
&& type == MENU_FILE_PLAIN)
{
menu_common_setting_set_current_string_path(setting, dir, path);
menu_flush_stack_label(driver.menu->menu_stack, "Video Options");
}
else if (setting && !strcmp(setting->name, "audio_dsp_plugin")
&& type == MENU_FILE_PLAIN)
{
menu_common_setting_set_current_string_path(setting, dir, path);
menu_flush_stack_label(driver.menu->menu_stack, "Audio Options");
menu_entries_pop_stack(driver.menu->menu_stack, setting->name);
}
#ifdef HAVE_SHADER_MANAGER
else if (!strcmp(menu_label, "video_shader_preset")

View File

@ -827,6 +827,25 @@ void menu_flush_stack_type(file_list_t *list,
}
}
void menu_entries_pop_stack(file_list_t *list,
const char *needle)
{
const char *path = NULL;
const char *label = NULL;
unsigned type = 0;
if (!driver.menu)
return;
driver.menu->need_refresh = true;
file_list_get_last(list, &path, &label, &type);
while (strcmp(needle, label) == 0)
{
file_list_pop(list, &driver.menu->selection_ptr);
file_list_get_last(list, &path, &label, &type);
}
}
void menu_flush_stack_label(file_list_t *list,
const char *needle)
{

View File

@ -34,6 +34,7 @@ int menu_parse_check(const char *label, unsigned menu_type);
int menu_parse_and_resolve(file_list_t *list, file_list_t *menu_list);
void menu_entries_pop(file_list_t *list);
void menu_entries_pop_stack(file_list_t *list, const char *needle);
void menu_flush_stack_type(file_list_t *list, unsigned final_type);
void menu_flush_stack_label(file_list_t *list, const char *needle);

View File

@ -1744,28 +1744,28 @@ rarch_setting_t *setting_data_get_mainmenu(bool regenerate)
START_GROUP("Main Menu")
START_SUB_GROUP("State")
#if defined(HAVE_DYNAMIC) || defined(HAVE_LIBRETRO_MANAGEMENT)
CONFIG_BOOL(lists[0], "core_list", "Core", false, "...", "...", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[0], "core_list", "Core", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
#endif
if (g_extern.history)
{
CONFIG_BOOL(lists[1], "history_list", "Load Content (History)", false, "...", "...", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[1], "history_list", "Load Content (History)", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
}
if (driver.menu && g_extern.core_info && core_info_list_num_info_files(g_extern.core_info))
{
CONFIG_BOOL(lists[2], "detect_core_list", "Load Content (Detect Core)", false, "...", "...", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[2], "detect_core_list", "Load Content (Detect Core)", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
}
CONFIG_BOOL(lists[3], "load_content", "Load Content", false, "...", "...", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[4], "core_options", "Core Options", false, "...", "...", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[5], "core_information", "Core Information", false, "...", "...", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[6], "settings", "Settings", false, "...", "...", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[3], "load_content", "Load Content", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[4], "core_options", "Core Options", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[5], "core_information", "Core Information", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[6], "settings", "Settings", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
if (g_extern.perfcnt_enable)
{
CONFIG_BOOL(lists[7], "performance_counters", "Performance Counters", false, "...", "...", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[7], "performance_counters", "Performance Counters", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
}
if (g_extern.main_is_init && !g_extern.libretro_dummy)
{
CONFIG_BOOL(lists[8], "savestate", "Save State", false, "...", "...", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[9], "loadstate", "Load State", false, "...", "...", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[8], "savestate", "Save State", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[9], "loadstate", "Load State", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[10], "take_screenshot", "Take Screenshot", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[11], "resume_content", "Resume Content", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[12], "restart_content", "Restart Content", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)