diff --git a/file_list.c b/file_list.c index dcdc5f539c..f4d5f9e007 100644 --- a/file_list.c +++ b/file_list.c @@ -103,6 +103,21 @@ void file_list_clear(file_list_t *list) list->size = 0; } +void file_list_set_label_at_offset(file_list_t *list, size_t index, + const char *label) +{ + free(list->list[index].label); + list->list[index].label = strdup(label); +} + +void file_list_get_label_at_offset(const file_list_t *list, size_t index, + const char **label) +{ + if (label) + *label = list->list[index].label ? + list->list[index].label : list->list[index].path; +} + void file_list_set_alt_at_offset(file_list_t *list, size_t index, const char *alt) { @@ -162,7 +177,11 @@ bool file_list_search(const file_list_t *list, const char *needle, size_t *index const char *str; file_list_get_alt_at_offset(list, i, &alt); if (!alt) - continue; + { + file_list_get_label_at_offset(list, i, &alt); + if (!alt) + continue; + } str = (const char *)strcasestr(alt, needle); if (str == alt) diff --git a/file_list.h b/file_list.h index 24729f3d48..849c85a801 100644 --- a/file_list.h +++ b/file_list.h @@ -59,6 +59,11 @@ void file_list_get_at_offset(const file_list_t *list, size_t index, const char **path, const char **label, unsigned *type); +void file_list_set_label_at_offset(file_list_t *list, size_t index, + const char *label); +void file_list_get_label_at_offset(const file_list_t *list, size_t index, + const char **label); + void file_list_set_alt_at_offset(file_list_t *list, size_t index, const char *alt); void file_list_get_alt_at_offset(const file_list_t *list, size_t index, diff --git a/frontend/menu/backend/menu_common_backend.c b/frontend/menu/backend/menu_common_backend.c index 4c4a0cd90c..61aeb13ba0 100644 --- a/frontend/menu/backend/menu_common_backend.c +++ b/frontend/menu/backend/menu_common_backend.c @@ -1321,7 +1321,8 @@ static int menu_setting_ok_toggle(unsigned type, else if (type == MENU_SETTINGS_CUSTOM_VIEWPORT) { file_list_push(driver.menu->menu_stack, "", "", - type, driver.menu->selection_ptr); + MENU_SETTINGS_CUSTOM_VIEWPORT, + driver.menu->selection_ptr); /* Start with something sane. */ rarch_viewport_t *custom = (rarch_viewport_t*)