mirror of
https://github.com/libretro/RetroArch
synced 2025-03-03 04:14:00 +00:00
Add experimental menu_entries_push/file_list_push
This commit is contained in:
parent
7e7a1fa5f9
commit
a430c7f543
@ -65,6 +65,11 @@ bool file_list_append(file_list_t *userdata, const char *path,
|
||||
const char *label, unsigned type, size_t current_directory_ptr,
|
||||
size_t entry_index);
|
||||
|
||||
bool file_list_push(file_list_t *list,
|
||||
const char *path, const char *label,
|
||||
unsigned type, size_t directory_ptr,
|
||||
size_t entry_idx);
|
||||
|
||||
void file_list_pop(file_list_t *list, size_t *directory_ptr);
|
||||
|
||||
void file_list_clear(file_list_t *list);
|
||||
|
@ -59,6 +59,49 @@ static bool file_list_capacity(file_list_t *list, size_t cap)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool file_list_push(file_list_t *list,
|
||||
const char *path, const char *label,
|
||||
unsigned type, size_t directory_ptr,
|
||||
size_t entry_idx)
|
||||
{
|
||||
unsigned i;
|
||||
if (list->size >= list->capacity &&
|
||||
!file_list_capacity(list, list->capacity * 2 + 1))
|
||||
return false;
|
||||
|
||||
list->size++;
|
||||
|
||||
for (i = list->size -1; i > 0; i--)
|
||||
{
|
||||
file_list_t *copy = calloc(1, sizeof(file_list_t));
|
||||
|
||||
memcpy(copy, &list->list[i-1], sizeof(file_list_t));
|
||||
|
||||
memcpy(&list->list[i-1], &list->list[i], sizeof(file_list_t));
|
||||
memcpy(&list->list[i], copy, sizeof(file_list_t));
|
||||
|
||||
free(copy);
|
||||
}
|
||||
|
||||
memset(&list->list[0], 0, sizeof(file_list_t));
|
||||
|
||||
list->list[0].label = NULL;
|
||||
list->list[0].path = NULL;
|
||||
list->list[0].alt = NULL;
|
||||
list->list[0].userdata = NULL;
|
||||
list->list[0].actiondata = NULL;
|
||||
list->list[0].type = type;
|
||||
list->list[0].directory_ptr = directory_ptr;
|
||||
list->list[0].entry_idx = entry_idx;
|
||||
|
||||
if (label)
|
||||
list->list[0].label = strdup(label);
|
||||
if (path)
|
||||
list->list[0].path = strdup(path);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool file_list_append(file_list_t *list,
|
||||
const char *path, const char *label,
|
||||
unsigned type, size_t directory_ptr,
|
||||
|
@ -2345,6 +2345,13 @@ static int menu_displaylist_parse_add_content_list(
|
||||
MENU_SETTING_ACTION, 0, 0);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
menu_entries_push(info->list,
|
||||
"Daddy is talking shit",
|
||||
"daddys_talking_shit",
|
||||
MENU_SETTING_ACTION, 0, 0);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -536,6 +536,40 @@ void menu_entries_add(file_list_t *list, const char *path, const char *label,
|
||||
menu_cbs_init(list, cbs, path, label, type, idx);
|
||||
}
|
||||
|
||||
void menu_entries_push(file_list_t *list, const char *path, const char *label,
|
||||
unsigned type, size_t directory_ptr, size_t entry_idx)
|
||||
{
|
||||
menu_ctx_list_t list_info;
|
||||
size_t idx;
|
||||
menu_file_list_cbs_t *cbs = NULL;
|
||||
if (!list || !label)
|
||||
return;
|
||||
|
||||
file_list_push(list, path, label, type, directory_ptr, entry_idx);
|
||||
|
||||
idx = 0;
|
||||
|
||||
list_info.list = list;
|
||||
list_info.path = path;
|
||||
list_info.label = label;
|
||||
list_info.idx = idx;
|
||||
|
||||
menu_driver_ctl(RARCH_MENU_CTL_LIST_INSERT, &list_info);
|
||||
|
||||
file_list_free_actiondata(list, idx);
|
||||
cbs = (menu_file_list_cbs_t*)
|
||||
calloc(1, sizeof(menu_file_list_cbs_t));
|
||||
|
||||
if (!cbs)
|
||||
return;
|
||||
|
||||
file_list_set_actiondata(list, idx, cbs);
|
||||
|
||||
cbs->setting = menu_setting_find(label);
|
||||
|
||||
menu_cbs_init(list, cbs, path, label, type, idx);
|
||||
}
|
||||
|
||||
menu_file_list_cbs_t *menu_entries_get_last_stack_actiondata(void)
|
||||
{
|
||||
menu_list_t *menu_list = NULL;
|
||||
|
@ -174,6 +174,9 @@ void menu_entries_set_alt_at_offset(file_list_t *list, size_t idx,
|
||||
|
||||
rarch_setting_t *menu_entries_get_setting(uint32_t i);
|
||||
|
||||
void menu_entries_push(file_list_t *list, const char *path, const char *label,
|
||||
unsigned type, size_t directory_ptr, size_t entry_idx);
|
||||
|
||||
bool menu_entries_ctl(enum menu_entries_ctl_state state, void *data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
Loading…
x
Reference in New Issue
Block a user