(Menu) Get rid of more hardcoded enums

This commit is contained in:
twinaphex 2014-09-03 01:14:29 +02:00
parent 223e062b66
commit aa21cfda0e
2 changed files with 37 additions and 35 deletions

View File

@ -1283,13 +1283,17 @@ static int menu_setting_ok_toggle(unsigned type,
{ {
driver.menu->defer_core = (!strcmp(label, "detect_core_list")); driver.menu->defer_core = (!strcmp(label, "detect_core_list"));
menu_entries_push(driver.menu->menu_stack, menu_entries_push(driver.menu->menu_stack,
g_settings.menu_content_directory, "", MENU_FILE_DIRECTORY, g_settings.menu_content_directory, label, MENU_FILE_DIRECTORY,
driver.menu->selection_ptr); driver.menu->selection_ptr);
return 0; return 0;
} }
else if ( else if (!strcmp(label, "history_list"))
!strcmp(label, "history_list") || {
menu_common_type_is(type) == MENU_FILE_DIRECTORY) menu_entries_push(driver.menu->menu_stack,
"", label, type, driver.menu->selection_ptr);
return 0;
}
else if (menu_common_type_is(type) == MENU_FILE_DIRECTORY)
{ {
menu_entries_push(driver.menu->menu_stack, menu_entries_push(driver.menu->menu_stack,
"", "", type, driver.menu->selection_ptr); "", "", type, driver.menu->selection_ptr);
@ -1303,7 +1307,7 @@ static int menu_setting_ok_toggle(unsigned type,
) )
{ {
menu_entries_push(driver.menu->menu_stack, menu_entries_push(driver.menu->menu_stack,
dir ? dir : label, "", type, dir ? dir : label, label, type,
driver.menu->selection_ptr); driver.menu->selection_ptr);
return 0; return 0;
} }

View File

@ -698,19 +698,21 @@ int menu_parse_and_resolve(file_list_t *list, file_list_t *menu_list)
const char *exts; const char *exts;
char ext_buf[1024]; char ext_buf[1024];
if (menu_type == MENU_SETTINGS_CORE)
//RARCH_LOG("LABEL: %s\n", label);
if (!strcmp(label, "core_list"))
exts = EXT_EXECUTABLES; exts = EXT_EXECUTABLES;
else if (menu_type == MENU_SETTINGS_CONFIG) else if (!strcmp(label, "configurations"))
exts = "cfg"; exts = "cfg";
else if (menu_type == MENU_SETTINGS_SHADER_PRESET) else if (!strcmp(label, "video_shader_preset"))
exts = "cgp|glslp"; exts = "cgp|glslp";
else if (menu_common_type_is(menu_type) == MENU_SETTINGS_SHADER_OPTIONS) else if (menu_common_type_is(menu_type) == MENU_SETTINGS_SHADER_OPTIONS)
exts = "cg|glsl"; exts = "cg|glsl";
else if (menu_type == MENU_SETTINGS_VIDEO_SOFTFILTER) else if (!strcmp(label, "video_filter"))
exts = "filt"; exts = "filt";
else if (menu_type == MENU_SETTINGS_AUDIO_DSP_FILTER) else if (!strcmp(label, "audio_dsp_plugin"))
exts = "dsp"; exts = "dsp";
else if (menu_type == MENU_SETTINGS_OVERLAY_PRESET) else if (!strcmp(label, "input_overlay"))
exts = "cfg"; exts = "cfg";
else if (menu_type == MENU_CONTENT_HISTORY_PATH) else if (menu_type == MENU_CONTENT_HISTORY_PATH)
exts = "cfg"; exts = "cfg";
@ -755,7 +757,7 @@ int menu_parse_and_resolve(file_list_t *list, file_list_t *menu_list)
path = path_basename(path); path = path_basename(path);
#ifdef HAVE_LIBRETRO_MANAGEMENT #ifdef HAVE_LIBRETRO_MANAGEMENT
if (menu_type == MENU_SETTINGS_CORE && (is_dir || if (!strcmp(label, "core_list") && (is_dir ||
strcasecmp(path, SALAMANDER_FILE) == 0)) strcasecmp(path, SALAMANDER_FILE) == 0))
continue; continue;
#endif #endif
@ -770,34 +772,30 @@ int menu_parse_and_resolve(file_list_t *list, file_list_t *menu_list)
dir, label, menu_type); dir, label, menu_type);
string_list_free(str_list); string_list_free(str_list);
switch (menu_type) if (!strcmp(label, "core_list"))
{ {
case MENU_SETTINGS_CORE: file_list_get_last(menu_list, &dir, NULL,
{ &menu_type);
file_list_get_last(menu_list, &dir, NULL, list_size = file_list_get_size(list);
&menu_type);
list_size = file_list_get_size(list);
for (i = 0; i < list_size; i++) for (i = 0; i < list_size; i++)
{ {
char core_path[PATH_MAX], display_name[256]; char core_path[PATH_MAX], display_name[256];
const char *path = NULL; const char *path = NULL;
unsigned type = 0; unsigned type = 0;
file_list_get_at_offset(list, i, &path, NULL, &type); file_list_get_at_offset(list, i, &path, NULL, &type);
if (type != MENU_FILE_PLAIN) if (type != MENU_FILE_PLAIN)
continue; continue;
fill_pathname_join(core_path, dir, path, sizeof(core_path)); fill_pathname_join(core_path, dir, path, sizeof(core_path));
if (driver.menu->core_info && if (driver.menu->core_info &&
core_info_list_get_display_name(driver.menu->core_info, core_info_list_get_display_name(driver.menu->core_info,
core_path, display_name, sizeof(display_name))) core_path, display_name, sizeof(display_name)))
file_list_set_alt_at_offset(list, i, display_name); file_list_set_alt_at_offset(list, i, display_name);
} }
file_list_sort_on_alt(list); file_list_sort_on_alt(list);
}
break;
} }
driver.menu->scroll_indices_size = 0; driver.menu->scroll_indices_size = 0;