mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +00:00
Cut down on menu_entries_push_list
This commit is contained in:
parent
9f9978c0a2
commit
e3807b87f7
@ -258,11 +258,8 @@ static int menu_settings_iterate(unsigned action)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_ACTION_REFRESH:
|
case MENU_ACTION_REFRESH:
|
||||||
file_list_get_last(driver.menu->menu_stack, &path, &label, &menu_type);
|
menu_parse_and_resolve(driver.menu->selection_buf,
|
||||||
|
driver.menu->menu_stack);
|
||||||
if ((menu_parse_check(label, menu_type) == -1))
|
|
||||||
menu_entries_push_list(driver.menu,
|
|
||||||
driver.menu->selection_buf, path, label, menu_type);
|
|
||||||
|
|
||||||
driver.menu->need_refresh = false;
|
driver.menu->need_refresh = false;
|
||||||
break;
|
break;
|
||||||
|
@ -409,7 +409,37 @@ int menu_entries_push_list(menu_handle_t *menu,
|
|||||||
RARCH_LOG("Menu type is: %d\n", menu_type);
|
RARCH_LOG("Menu type is: %d\n", menu_type);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!strcmp(label, "Main Menu"))
|
if (!strcmp(label, "history_list"))
|
||||||
|
{
|
||||||
|
RARCH_LOG("Gets here.\n");
|
||||||
|
file_list_clear(list);
|
||||||
|
list_size = content_playlist_size(g_defaults.history);
|
||||||
|
|
||||||
|
for (i = 0; i < list_size; i++)
|
||||||
|
{
|
||||||
|
char fill_buf[PATH_MAX];
|
||||||
|
const char *path = NULL;
|
||||||
|
const char *core_name = NULL;
|
||||||
|
|
||||||
|
content_playlist_get_index(g_defaults.history, i,
|
||||||
|
&path, NULL, &core_name);
|
||||||
|
strlcpy(fill_buf, core_name, sizeof(fill_buf));
|
||||||
|
|
||||||
|
if (path)
|
||||||
|
{
|
||||||
|
char path_short[PATH_MAX];
|
||||||
|
fill_short_pathname_representation(path_short,path,sizeof(path_short));
|
||||||
|
snprintf(fill_buf,sizeof(fill_buf),"%s (%s)",
|
||||||
|
path_short,core_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
file_list_push(list, fill_buf, "",
|
||||||
|
MENU_FILE_PLAYLIST_ENTRY, 0);
|
||||||
|
|
||||||
|
do_action = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!strcmp(label, "Main Menu"))
|
||||||
{
|
{
|
||||||
settings_list_free(menu->list_mainmenu);
|
settings_list_free(menu->list_mainmenu);
|
||||||
menu->list_mainmenu = (rarch_setting_t *)setting_data_new(SL_FLAG_MAIN_MENU);
|
menu->list_mainmenu = (rarch_setting_t *)setting_data_new(SL_FLAG_MAIN_MENU);
|
||||||
@ -479,35 +509,6 @@ int menu_entries_push_list(menu_handle_t *menu,
|
|||||||
setting->name, setting_set_flags(setting), 0);
|
setting->name, setting_set_flags(setting), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strcmp(label, "history_list"))
|
|
||||||
{
|
|
||||||
file_list_clear(list);
|
|
||||||
list_size = content_playlist_size(g_defaults.history);
|
|
||||||
|
|
||||||
for (i = 0; i < list_size; i++)
|
|
||||||
{
|
|
||||||
char fill_buf[PATH_MAX];
|
|
||||||
const char *path = NULL;
|
|
||||||
const char *core_name = NULL;
|
|
||||||
|
|
||||||
content_playlist_get_index(g_defaults.history, i,
|
|
||||||
&path, NULL, &core_name);
|
|
||||||
strlcpy(fill_buf, core_name, sizeof(fill_buf));
|
|
||||||
|
|
||||||
if (path)
|
|
||||||
{
|
|
||||||
char path_short[PATH_MAX];
|
|
||||||
fill_short_pathname_representation(path_short,path,sizeof(path_short));
|
|
||||||
snprintf(fill_buf,sizeof(fill_buf),"%s (%s)",
|
|
||||||
path_short,core_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
file_list_push(list, fill_buf, "",
|
|
||||||
MENU_FILE_PLAYLIST_ENTRY, 0);
|
|
||||||
|
|
||||||
do_action = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!strcmp(label, "performance_counters"))
|
else if (!strcmp(label, "performance_counters"))
|
||||||
{
|
{
|
||||||
file_list_clear(list);
|
file_list_clear(list);
|
||||||
@ -762,19 +763,23 @@ int menu_entries_push_list(menu_handle_t *menu,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int menu_parse_check(const char *label, unsigned menu_type)
|
static int menu_parse_check(const char *label, unsigned menu_type)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
RARCH_LOG("label is menu_parse_check: %s\n", label);
|
RARCH_LOG("label is menu_parse_check: %s\n", label);
|
||||||
#endif
|
#endif
|
||||||
if (!((menu_type == MENU_FILE_DIRECTORY ||
|
bool check = (!((menu_type == MENU_FILE_DIRECTORY ||
|
||||||
menu_type == MENU_FILE_CARCHIVE ||
|
menu_type == MENU_FILE_CARCHIVE ||
|
||||||
menu_common_type_is(label, menu_type) == MENU_SETTINGS_SHADER_OPTIONS ||
|
menu_common_type_is(label, menu_type) == MENU_SETTINGS_SHADER_OPTIONS ||
|
||||||
menu_common_type_is(label, menu_type) == MENU_FILE_DIRECTORY ||
|
menu_common_type_is(label, menu_type) == MENU_FILE_DIRECTORY ||
|
||||||
menu_type == MENU_FILE_PATH ||
|
menu_type == MENU_FILE_PATH ||
|
||||||
!strcmp(label, "core_list") ||
|
!strcmp(label, "core_list") ||
|
||||||
!strcmp(label, "configurations") ||
|
!strcmp(label, "configurations") ||
|
||||||
!strcmp(label, "disk_image_append"))))
|
!strcmp(label, "disk_image_append"))));
|
||||||
|
if (check)
|
||||||
|
return -1;
|
||||||
|
check = !strcmp(label, "history_list") || !strcmp(label, "deferred_core_list");
|
||||||
|
if (check)
|
||||||
return -1;
|
return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -795,14 +800,9 @@ int menu_parse_and_resolve(file_list_t *list, file_list_t *menu_list)
|
|||||||
RARCH_LOG("label: %s\n", label);
|
RARCH_LOG("label: %s\n", label);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (
|
if (((menu_parse_check(label, type)) == -1))
|
||||||
!strcmp(label, "history_list") ||
|
|
||||||
!strcmp(label, "deferred_core_list"))
|
|
||||||
return menu_entries_push_list(driver.menu, list, path, label, type);
|
return menu_entries_push_list(driver.menu, list, path, label, type);
|
||||||
|
|
||||||
if (menu_parse_check(label, type) == -1)
|
|
||||||
return - 1;
|
|
||||||
|
|
||||||
//RARCH_LOG("LABEL: %s\n", label);
|
//RARCH_LOG("LABEL: %s\n", label);
|
||||||
if (!strcmp(label, "core_list"))
|
if (!strcmp(label, "core_list"))
|
||||||
exts = EXT_EXECUTABLES;
|
exts = EXT_EXECUTABLES;
|
||||||
|
@ -36,8 +36,6 @@ int menu_entries_push_list(menu_handle_t *menu,
|
|||||||
|
|
||||||
void menu_entries_pop_list(file_list_t *list);
|
void menu_entries_pop_list(file_list_t *list);
|
||||||
|
|
||||||
int menu_parse_check(const char *label, unsigned menu_type);
|
|
||||||
|
|
||||||
int menu_parse_and_resolve(file_list_t *list, file_list_t *menu_list);
|
int menu_parse_and_resolve(file_list_t *list, file_list_t *menu_list);
|
||||||
|
|
||||||
void menu_entries_pop_stack(file_list_t *list, const char *needle);
|
void menu_entries_pop_stack(file_list_t *list, const char *needle);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user