Start setting up menu_entries function so we can access

multiple stacks
This commit is contained in:
twinaphex 2015-10-27 10:10:33 +01:00
parent 42751462c0
commit 0d89bca635
14 changed files with 51 additions and 45 deletions

View File

@ -471,7 +471,7 @@ static int deferred_push_history_list(menu_displaylist_info_t *info)
int deferred_push_content_list(void *data, void *userdata, const char *path,
const char *label, unsigned type)
{
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
return action_refresh_default((file_list_t*)data, selection_buf);
}

View File

@ -128,7 +128,7 @@ static int action_left_mainmenu(unsigned type, const char *label,
size_t selection = 0;
menu_file_list_cbs_t *cbs = NULL;
unsigned push_list = 0;
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr();
settings_t *settings = config_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();

View File

@ -58,7 +58,7 @@ int generic_action_ok_displaylist_push(const char *path,
const char *info_path = NULL;
global_t *global = global_get_ptr();
settings_t *settings = config_get_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr();
menu_handle_t *menu = menu_driver_get_ptr();

View File

@ -156,7 +156,7 @@ static int action_right_mainmenu(unsigned type, const char *label,
size_t selection = 0;
menu_file_list_cbs_t *cbs = NULL;
unsigned push_list = 0;
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr();
settings_t *settings = config_get_ptr();
unsigned action = MENU_ACTION_RIGHT;

View File

@ -33,9 +33,9 @@ static int action_select_default(const char *path, const char *label, unsigned t
int ret = 0;
enum menu_action action = MENU_ACTION_NOOP;
menu_file_list_cbs_t *cbs = NULL;
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
menu_entry_get(&entry, idx, NULL, false);
menu_entry_get(&entry, 0, idx, NULL, false);
cbs = menu_entries_get_actiondata_at_offset(selection_buf, idx);

View File

@ -213,7 +213,7 @@ int generic_menu_iterate(enum menu_action action)
uint32_t hash = 0;
menu_handle_t *menu = menu_driver_get_ptr();
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
menu_entries_get_last_stack(NULL, &label, NULL, NULL);
@ -276,7 +276,7 @@ int generic_menu_iterate(enum menu_action action)
* hack like this in order to work. */
selection = max(min(selection, (menu_entries_get_size() - 1)), 0);
menu_entry_get(&entry, selection, NULL, false);
menu_entry_get(&entry, 0, selection, NULL, false);
ret = menu_entry_action(&entry, selection, (enum menu_action)action);
if (ret)
@ -368,7 +368,7 @@ bool generic_menu_init_list(void *data)
{
menu_displaylist_info_t info = {0};
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
strlcpy(info.label, menu_hash_to_str(MENU_VALUE_MAIN_MENU), sizeof(info.label));

View File

@ -596,7 +596,7 @@ static void xmb_update_boxart(xmb_handle_t *xmb, unsigned i)
char path[PATH_MAX_LENGTH] = {0};
settings_t *settings = config_get_ptr();
menu_entry_get(&entry, i, NULL, true);
menu_entry_get(&entry, 0, i, NULL, true);
fill_pathname_join(path, settings->boxarts_directory, entry.path, sizeof(path));
strlcat(path, ".png", sizeof(path));
@ -616,7 +616,7 @@ static void xmb_selection_pointer_changed(bool allow_animations)
xmb_handle_t *xmb = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
settings_t *settings = config_get_ptr();
if (!menu)
@ -981,7 +981,7 @@ static void xmb_list_switch(xmb_handle_t *xmb)
size_t selection;
int dir = -1;
menu_handle_t *menu = menu_driver_get_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
settings_t *settings = config_get_ptr();
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
@ -1087,7 +1087,7 @@ static void xmb_list_open(xmb_handle_t *xmb)
size_t selection;
int dir = 0;
menu_handle_t *menu = menu_driver_get_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
if (!menu)
return;
@ -1293,7 +1293,7 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
if (icon_x < -half_size || icon_x > width)
continue;
menu_entry_get(&entry, i, list, true);
menu_entry_get(&entry, 0, i, list, true);
hash_label = menu_hash_calculate(entry.label);
hash_value = menu_hash_calculate(entry.value);
@ -1575,7 +1575,7 @@ static void xmb_frame(void)
const struct font_renderer *font_driver = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
settings_t *settings = config_get_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr();
if (!menu)
@ -1791,7 +1791,7 @@ static void xmb_layout(menu_handle_t *menu, xmb_handle_t *xmb)
size_t selection;
float scale_factor;
unsigned width, height, i, current, end, new_header_height;
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
return;
@ -2478,7 +2478,7 @@ static void xmb_list_cache(menu_list_type_t type, unsigned action)
xmb_handle_t *xmb = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
if (!menu)
return;
@ -2731,7 +2731,7 @@ static bool xmb_menu_init_list(void *data)
int ret;
menu_displaylist_info_t info = {0};
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
strlcpy(info.label, menu_hash_to_str(MENU_VALUE_MAIN_MENU), sizeof(info.label));

View File

@ -624,7 +624,7 @@ static int zarch_zui_render_lay_root_recent(zui_t *zui, zui_tabbed_t *tabbed)
{
menu_entry_t entry;
menu_entries_get(i, &entry);
menu_entry_get(&entry, 0, i, NULL, false);
if (zarch_zui_list_item(zui, tabbed, 0, tabbed->tabline_size + j * 54,
entry.path, i, entry.value))
@ -1275,14 +1275,14 @@ static int zarch_iterate(enum menu_action action)
BIT64_SET(menu->state, MENU_STATE_RENDER_FRAMEBUFFER);
BIT64_SET(menu->state, MENU_STATE_BLIT);
menu_entry_get(&entry, action_id, NULL, false);
menu_entry_get(&entry, 0, action_id, NULL, false);
if (action_id >= 0)
zui->pending_selection = action_id;
if (zui->pending_action_ok.enable)
{
menu_entry_get(&entry, zui->pending_action_ok.idx, NULL, false);
menu_entry_get(&entry, 0, zui->pending_action_ok.idx, NULL, false);
zui->pending_action_ok.enable = false;
act = MENU_ACTION_OK;
@ -1318,7 +1318,13 @@ static bool zarch_menu_init_list(void *data)
int ret;
menu_displaylist_info_t info = {0};
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
#if 0
strlcpy(info.label, menu_hash_to_str(MENU_VALUE_MAIN_MENU), sizeof(info.label));
menu_entries_push(menu_stack, info.path, info.label, info.type, info.flags, 0);
#endif
strlcpy(info.label, menu_hash_to_str(MENU_VALUE_HISTORY_TAB), sizeof(info.label));

View File

@ -404,7 +404,7 @@ void menu_entries_get(size_t i, menu_entry_t *entry)
const char *path = NULL;
const char *entry_label = NULL;
menu_file_list_cbs_t *cbs = NULL;
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
menu_entries_get_last_stack(NULL, &label, NULL, NULL);
@ -496,12 +496,12 @@ file_list_t *menu_entries_get_menu_stack_ptr(void)
return menu_list->menu_stack[0];
}
file_list_t *menu_entries_get_selection_buf_ptr(void)
file_list_t *menu_entries_get_selection_buf_ptr(size_t i)
{
menu_list_t *menu_list = menu_list_get_ptr();
if (!menu_list)
return NULL;
return menu_list->selection_buf[0];
return menu_list->selection_buf[i];
}
bool menu_entries_needs_refresh(void)
@ -661,7 +661,7 @@ size_t menu_entries_get_size(void)
rarch_setting_t *menu_entries_get_setting(uint32_t i)
{
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
menu_file_list_cbs_t *cbs = menu_entries_get_actiondata_at_offset(selection_buf, i);
if (!cbs)

View File

@ -125,7 +125,7 @@ void menu_entries_set_refresh(bool nonblocking);
void menu_entries_unset_refresh(bool nonblocking);
file_list_t *menu_entries_get_selection_buf_ptr(void);
file_list_t *menu_entries_get_selection_buf_ptr(size_t i);
file_list_t *menu_entries_get_menu_stack_ptr(void);

View File

@ -89,7 +89,7 @@ enum menu_entry_type menu_entry_get_type(uint32_t i)
void menu_entry_get_path(uint32_t i, char *s, size_t len)
{
menu_entry_t entry = {{0}};
menu_entry_get(&entry, i, NULL, true);
menu_entry_get(&entry, 0, i, NULL, true);
strlcpy(s, entry.path, len);
}
@ -97,7 +97,7 @@ void menu_entry_get_path(uint32_t i, char *s, size_t len)
void menu_entry_get_label(uint32_t i, char *s, size_t len)
{
menu_entry_t entry = {{0}};
menu_entry_get(&entry, i, NULL, true);
menu_entry_get(&entry, 0, i, NULL, true);
strlcpy(s, entry.label, len);
}
@ -105,7 +105,7 @@ void menu_entry_get_label(uint32_t i, char *s, size_t len)
unsigned menu_entry_get_spacing(uint32_t i)
{
menu_entry_t entry = {{0}};
menu_entry_get(&entry, i, NULL, true);
menu_entry_get(&entry, 0, i, NULL, true);
return entry.spacing;
}
@ -113,7 +113,7 @@ unsigned menu_entry_get_spacing(uint32_t i)
unsigned menu_entry_get_type_new(uint32_t i)
{
menu_entry_t entry = {{0}};
menu_entry_get(&entry, i, NULL, true);
menu_entry_get(&entry, 0, i, NULL, true);
return entry.type;
}
@ -203,7 +203,7 @@ uint32_t menu_entry_pathdir_for_directory(uint32_t i)
void menu_entry_pathdir_get_value(uint32_t i, char *s, size_t len)
{
menu_entry_t entry = {{0}};
menu_entry_get(&entry, i, NULL, true);
menu_entry_get(&entry, 0, i, NULL, true);
strlcpy(s, entry.value, len);
}
@ -242,7 +242,7 @@ void menu_entry_pathdir_extensions(uint32_t i, char *s, size_t len)
void menu_entry_reset(uint32_t i)
{
menu_entry_t entry = {{0}};
menu_entry_get(&entry, i, NULL, true);
menu_entry_get(&entry, 0, i, NULL, true);
menu_entry_action(&entry, i, MENU_ACTION_START);
}
@ -250,7 +250,7 @@ void menu_entry_reset(uint32_t i)
void menu_entry_get_value(uint32_t i, char *s, size_t len)
{
menu_entry_t entry = {{0}};
menu_entry_get(&entry, i, NULL, true);
menu_entry_get(&entry, 0, i, NULL, true);
strlcpy(s, entry.value, len);
}
@ -282,13 +282,13 @@ float menu_entry_num_max(uint32_t i)
return (float)max;
}
void menu_entry_get(menu_entry_t *entry, size_t i,
void *userdata, bool use_representation)
void menu_entry_get(menu_entry_t *entry, size_t stack_idx,
size_t i, void *userdata, bool use_representation)
{
const char *path = NULL;
const char *entry_label = NULL;
menu_file_list_cbs_t *cbs = NULL;
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(stack_idx);
file_list_t *list = selection_buf;
if (userdata)
@ -344,7 +344,7 @@ int menu_entry_select(uint32_t i)
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &i);
menu_entry_get(&entry, i, NULL, false);
menu_entry_get(&entry, 0, i, NULL, false);
return menu_entry_action(&entry, i, MENU_ACTION_SELECT);
}
@ -352,7 +352,7 @@ int menu_entry_select(uint32_t i)
int menu_entry_action(menu_entry_t *entry, unsigned i, enum menu_action action)
{
int ret = 0;
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
menu_file_list_cbs_t *cbs = menu_entries_get_actiondata_at_offset(selection_buf, i);
switch (action)

View File

@ -103,8 +103,8 @@ float menu_entry_num_max(uint32_t i);
bool menu_entry_is_currently_selected(unsigned id);
void menu_entry_get(menu_entry_t *entry, size_t i,
void *userdata, bool use_representation);
void menu_entry_get(menu_entry_t *entry, size_t stack_idx,
size_t i, void *userdata, bool use_representation);
int menu_entry_select(uint32_t i);

View File

@ -181,7 +181,7 @@ static void menu_input_key_end_line(void)
static void menu_input_search_callback(void *userdata, const char *str)
{
size_t idx = 0;
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
if (!selection_buf)
return;
@ -1186,7 +1186,7 @@ void menu_input_post_iterate(int *ret, unsigned action)
menu_entry_t entry = {{0}};
menu_input_t *menu_input = menu_input_get_ptr();
settings_t *settings = config_get_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
return;
@ -1194,7 +1194,7 @@ void menu_input_post_iterate(int *ret, unsigned action)
if (selection_buf)
cbs = menu_entries_get_actiondata_at_offset(selection_buf, selection);
menu_entry_get(&entry, selection, NULL, false);
menu_entry_get(&entry, 0, selection, NULL, false);
if (settings->menu.mouse.enable)
*ret = menu_input_mouse_post_iterate (&menu_input->mouse.state, cbs, action);

View File

@ -512,7 +512,7 @@ int menu_setting_set(unsigned type, const char *label,
size_t selection;
int ret = 0;
menu_file_list_cbs_t *cbs = NULL;
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
return 0;