Go through menu_navigation_t pointer

This commit is contained in:
twinaphex 2015-06-13 16:22:05 +02:00
parent c94d5c75f3
commit d4cbc7695a
11 changed files with 86 additions and 58 deletions

View file

@ -18,12 +18,15 @@
static int action_info_default(unsigned type, const char *label)
{
menu_displaylist_info_t info = {0};
menu_handle_t *menu = menu_driver_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
if (!menu)
return 0;
info.list = menu->menu_list->menu_stack;
info.list = menu->menu_list->menu_stack;
info.directory_ptr = nav->selection_ptr;
strlcpy(info.label, "info_screen", sizeof(info.label));
info.directory_ptr = menu->navigation.selection_ptr;
return menu_displaylist_push_list(&info, DISPLAYLIST_HELP);
}

View file

@ -281,6 +281,7 @@ static int action_iterate_menu_viewport(char *s, size_t len, const char *label,
unsigned type = 0;
video_viewport_t *custom = video_viewport_get_custom();
menu_handle_t *menu = menu_driver_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
settings_t *settings = config_get_ptr();
struct retro_system_av_info *av_info = video_viewport_get_system_av_info();
@ -357,7 +358,7 @@ static int action_iterate_menu_viewport(char *s, size_t len, const char *label,
{
info.list = menu_list->menu_stack;
info.type = MENU_SETTINGS_CUSTOM_VIEWPORT;
info.directory_ptr = menu->navigation.selection_ptr;
info.directory_ptr = nav->selection_ptr;
menu_displaylist_push_list(&info, DISPLAYLIST_INFO);
}
@ -372,7 +373,7 @@ static int action_iterate_menu_viewport(char *s, size_t len, const char *label,
info.list = menu_list->menu_stack;
strlcpy(info.label, "custom_viewport_2", sizeof(info.label));
info.type = 0;
info.directory_ptr = menu->navigation.selection_ptr;
info.directory_ptr = nav->selection_ptr;
menu_displaylist_push_list(&info, DISPLAYLIST_INFO);
}
@ -503,6 +504,7 @@ static int action_iterate_main(const char *label, unsigned action)
bool do_render = false;
int ret = 0;
menu_handle_t *menu = menu_driver_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
uint32_t hash = djb2_calculate(label);
if (!menu || !menu_list)
@ -528,7 +530,7 @@ static int action_iterate_main(const char *label, unsigned action)
break;
case ITERATE_TYPE_INFO:
ret = action_iterate_info(msg, sizeof(msg), label);
pop_selected = &menu->navigation.selection_ptr;
pop_selected = &nav->selection_ptr;
do_messagebox = true;
do_pop_stack = true;
do_post_iterate = true;
@ -538,7 +540,7 @@ static int action_iterate_main(const char *label, unsigned action)
break;
case ITERATE_TYPE_MESSAGE:
strlcpy(msg, menu->message_contents, sizeof(msg));
pop_selected = &menu->navigation.selection_ptr;
pop_selected = &nav->selection_ptr;
do_messagebox = true;
do_pop_stack = true;
break;

View file

@ -1068,9 +1068,10 @@ static int action_ok_cursor_manager_list(const char *path,
static int action_ok_config_load(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
const char *menu_path = NULL;
char config[PATH_MAX_LENGTH] = {0};
const char *menu_path = NULL;
char config[PATH_MAX_LENGTH] = {0};
menu_handle_t *menu = menu_driver_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
if (!menu)
return -1;
@ -1083,7 +1084,7 @@ static int action_ok_config_load(const char *path,
menu->msg_force = true;
if (rarch_replace_config(config))
{
menu_navigation_clear(&menu->navigation, false);
menu_navigation_clear(nav, false);
return -1;
}

View file

@ -143,6 +143,7 @@ static int action_right_mainmenu(unsigned type, const char *label,
unsigned push_list = 0;
menu_list_t *menu_list = menu_list_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
unsigned action = MENU_ACTION_RIGHT;
size_t list_size = menu_driver_list_get_size(MENU_LIST_PLAIN);
if (!menu)
@ -150,7 +151,7 @@ static int action_right_mainmenu(unsigned type, const char *label,
if (list_size == 1)
{
menu->navigation.selection_ptr = 0;
nav->selection_ptr = 0;
if (menu->categories.selection_ptr != (menu_driver_list_get_size(MENU_LIST_HORIZONTAL)))
push_list = 1;
}
@ -158,7 +159,7 @@ static int action_right_mainmenu(unsigned type, const char *label,
push_list = 2;
cbs = menu_list_get_actiondata_at_offset(menu_list->selection_buf,
menu->navigation.selection_ptr);
nav->selection_ptr);
switch (push_list)
{

View file

@ -335,6 +335,7 @@ static void glui_frame(void)
const struct font_renderer *font_driver = NULL;
driver_t *driver = driver_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
settings_t *settings = config_get_ptr();
uint64_t frame_count = video_driver_get_frame_count();
const uint32_t normal_color = FONT_COLOR_ARGB_TO_RGBA(
@ -379,7 +380,7 @@ static void glui_frame(void)
glui_render_quad(gl, 0,
menu->header_height - menu->scroll_y + glui->line_height *
menu->navigation.selection_ptr,
nav->selection_ptr,
width, glui->line_height, 1, 1, 1, 0.1);
menu->animation_is_active = true;

View file

@ -336,6 +336,7 @@ static void rgui_render(void)
char title_msg[64] = {0};
char timedate[PATH_MAX_LENGTH] = {0};
menu_handle_t *menu = menu_driver_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
runloop_t *runloop = rarch_main_get_ptr();
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
@ -452,7 +453,7 @@ static void rgui_render(void)
unsigned entry_spacing = menu_entry_get_spacing(i);
bool entry_selected = menu_entry_is_currently_selected(i);
if (i > (menu->navigation.selection_ptr + 100))
if (i > (nav->selection_ptr + 100))
continue;
menu_entry_get_value(i, entry_value, sizeof(entry_value));

View file

@ -533,10 +533,12 @@ static void rmenu_xui_render(void)
{
size_t end, i;
char title[PATH_MAX_LENGTH] = {0};
const char *dir = NULL, *label = NULL;
unsigned menu_type = 0;
menu_handle_t *menu = menu_driver_get_ptr();
uint64_t frame_count = video_driver_get_frame_count();
const char *dir = NULL;
const char *label = NULL;
unsigned menu_type = 0;
menu_handle_t *menu = menu_driver_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
uint64_t frame_count = video_driver_get_frame_count();
if (!menu)
return;
@ -581,7 +583,7 @@ static void rmenu_xui_render(void)
mbstowcs(msg_right, entry_value, sizeof(msg_right) / sizeof(wchar_t));
rmenu_xui_set_list_text(i, msg_left, msg_right);
}
XuiListSetCurSelVisible(m_menulist, menu->navigation.selection_ptr);
XuiListSetCurSelVisible(m_menulist, nav->selection_ptr);
if (menu->keyboard.display)
{
@ -598,7 +600,8 @@ static void rmenu_xui_render(void)
static void rmenu_xui_populate_entries(const char *path,
const char *label, unsigned i)
{
menu_handle_t *menu = menu_driver_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
if (!menu)
return;
@ -606,23 +609,25 @@ static void rmenu_xui_populate_entries(const char *path,
(void)label;
(void)path;
XuiListSetCurSelVisible(m_menulist, menu->navigation.selection_ptr);
XuiListSetCurSelVisible(m_menulist, nav->selection_ptr);
}
static void rmenu_xui_navigation_clear(bool pending_push)
{
menu_handle_t *menu = menu_driver_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
if (menu)
XuiListSetCurSelVisible(m_menulist, menu->navigation.selection_ptr);
XuiListSetCurSelVisible(m_menulist, nav->selection_ptr);
}
static void rmenu_xui_navigation_set_visible(void)
{
menu_handle_t *menu = menu_driver_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
if (menu)
XuiListSetCurSelVisible(m_menulist, menu->navigation.selection_ptr);
XuiListSetCurSelVisible(m_menulist, nav->selection_ptr);
}
static void rmenu_xui_navigation_alphabet(size_t *ptr_out)

View file

@ -506,6 +506,7 @@ static void xmb_selection_pointer_changed(void)
unsigned i, current, end;
xmb_handle_t *xmb = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
if (!menu)
@ -516,7 +517,7 @@ static void xmb_selection_pointer_changed(void)
if (!xmb)
return;
current = menu->navigation.selection_ptr;
current = nav->selection_ptr;
end = menu_entries_get_end();
for (i = 0; i < end; i++)
@ -809,6 +810,7 @@ static void xmb_list_switch(xmb_handle_t *xmb)
{
int dir = -1;
menu_handle_t *menu = menu_driver_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
if (!menu)
@ -832,7 +834,7 @@ static void xmb_list_switch(xmb_handle_t *xmb)
xmb_list_switch_old(xmb, xmb->selection_buf_old,
dir, xmb->selection_ptr_old);
xmb_list_switch_new(xmb, menu_list->selection_buf,
dir, menu->navigation.selection_ptr);
dir, nav->selection_ptr);
xmb->categories.active.idx_old = menu->categories.selection_ptr;
}
@ -866,6 +868,7 @@ static void xmb_list_open(xmb_handle_t *xmb)
{
int dir = 0;
menu_handle_t *menu = menu_driver_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
if (!menu)
@ -883,7 +886,7 @@ static void xmb_list_open(xmb_handle_t *xmb)
xmb_list_open_old(xmb, xmb->selection_buf_old,
dir, xmb->selection_ptr_old);
xmb_list_open_new(xmb, menu_list->selection_buf,
dir, menu->navigation.selection_ptr);
dir, nav->selection_ptr);
switch (xmb->depth)
{
@ -1210,6 +1213,7 @@ static void xmb_render(void)
xmb_handle_t *xmb = NULL;
settings_t *settings = config_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
if (!menu)
@ -1222,7 +1226,7 @@ static void xmb_render(void)
menu_animation_update(menu->animation, menu->dt / IDEAL_DT);
current = menu->navigation.selection_ptr;
current = nav->selection_ptr;
end = menu_list_get_size(menu_list);
if (settings->menu.pointer.enable)
@ -1295,6 +1299,7 @@ static void xmb_frame(void)
gl_t *gl = NULL;
const struct font_renderer *font_driver = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
settings_t *settings = config_get_ptr();
@ -1352,7 +1357,7 @@ static void xmb_frame(void)
xmb_draw_items(xmb, gl,
menu_list->selection_buf,
menu_list->menu_stack,
menu->navigation.selection_ptr,
nav->selection_ptr,
menu->categories.selection_ptr);
matrix_4x4_rotate_z(&mrot, 0 /* rotation */);
@ -1873,11 +1878,12 @@ static void xmb_navigation_alphabet(size_t *unused)
static void xmb_list_insert(file_list_t *list,
const char *path, const char *unused, size_t list_size)
{
int current = 0;
int i = list_size;
xmb_node_t *node = NULL;
xmb_handle_t *xmb = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
int current = 0;
int i = list_size;
xmb_node_t *node = NULL;
xmb_handle_t *xmb = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
if (!menu)
return;
@ -1895,7 +1901,7 @@ static void xmb_list_insert(file_list_t *list,
return;
}
current = menu->navigation.selection_ptr;
current = nav->selection_ptr;
node->alpha = xmb->item.passive.alpha;
node->zoom = xmb->item.passive.zoom;
@ -1924,6 +1930,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();
menu_list_t *menu_list = menu_list_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
if (!menu)
return;
@ -1935,7 +1942,7 @@ static void xmb_list_cache(menu_list_type_t type, unsigned action)
file_list_copy(menu_list->selection_buf, xmb->selection_buf_old);
file_list_copy(menu_list->menu_stack, xmb->menu_stack_old);
xmb->selection_ptr_old = menu->navigation.selection_ptr;
xmb->selection_ptr_old = nav->selection_ptr;
switch (type)
{

View file

@ -1742,6 +1742,7 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
bool need_push = false;
rarch_setting_t *setting = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
global_t *global = global_get_ptr();
settings_t *settings = config_get_ptr();
@ -1756,7 +1757,7 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
menu_driver_list_cache(MENU_LIST_PLAIN, 0);
menu_list_push(info->list, info->path, info->label, info->type, info->directory_ptr, 0);
menu_navigation_clear(&menu->navigation, true);
menu_navigation_clear(nav, true);
menu_set_refresh();
break;
case DISPLAYLIST_HELP:

View file

@ -257,11 +257,12 @@ static int menu_list_flush_stack_type(
void menu_list_flush_stack(menu_list_t *list,
const char *needle, unsigned final_type)
{
const char *path = NULL;
const char *label = NULL;
unsigned type = 0;
size_t entry_idx = 0;
menu_handle_t *menu = menu_driver_get_ptr();
const char *path = NULL;
const char *label = NULL;
unsigned type = 0;
size_t entry_idx = 0;
menu_handle_t *menu = menu_driver_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
if (!menu || !list)
return;
@ -270,14 +271,15 @@ void menu_list_flush_stack(menu_list_t *list,
while (menu_list_flush_stack_type(needle, label, type, final_type) != 0)
{
menu_list_pop(list->menu_stack, &menu->navigation.selection_ptr);
menu_list_pop(list->menu_stack, &nav->selection_ptr);
menu_list_get_last(list->menu_stack, &path, &label, &type, &entry_idx);
}
}
void menu_list_pop_stack(menu_list_t *list)
{
menu_handle_t *menu = menu_driver_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
if (!menu || !list)
return;
@ -286,18 +288,19 @@ void menu_list_pop_stack(menu_list_t *list)
menu_driver_list_cache(MENU_LIST_PLAIN, 0);
menu_list_pop(list->menu_stack, &menu->navigation.selection_ptr);
menu_list_pop(list->menu_stack, &nav->selection_ptr);
menu_set_refresh();
}
void menu_list_pop_stack_by_needle(menu_list_t *list,
const char *needle)
{
const char *path = NULL;
const char *label = NULL;
unsigned type = 0;
size_t entry_idx = 0;
menu_handle_t *menu = menu_driver_get_ptr();
const char *path = NULL;
const char *label = NULL;
unsigned type = 0;
size_t entry_idx = 0;
menu_handle_t *menu = menu_driver_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
if (!menu || !list)
return;
@ -307,7 +310,7 @@ void menu_list_pop_stack_by_needle(menu_list_t *list,
while (strcmp(needle, label) == 0)
{
menu_list_pop(list->menu_stack, &menu->navigation.selection_ptr);
menu_list_pop(list->menu_stack, &nav->selection_ptr);
menu_list_get_last(list->menu_stack, &path, &label, &type, &entry_idx);
}
}

View file

@ -242,7 +242,8 @@ static int setting_handler(rarch_setting_t *setting, unsigned action)
int menu_action_handle_setting(rarch_setting_t *setting,
unsigned type, unsigned action, bool wraparound)
{
menu_displaylist_info_t info = {0};
menu_displaylist_info_t info = {0};
menu_navigation_t *nav = menu_navigation_get_ptr();
if (!setting)
return -1;
@ -252,11 +253,11 @@ int menu_action_handle_setting(rarch_setting_t *setting,
case ST_PATH:
if (action == MENU_ACTION_OK)
{
menu_handle_t *menu = menu_driver_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
info.list = menu->menu_list->menu_stack;
info.list = menu_list->menu_stack;
info.type = type;
info.directory_ptr = menu->navigation.selection_ptr;
info.directory_ptr = nav->selection_ptr;
strlcpy(info.path, setting->default_value.string, sizeof(info.path));
strlcpy(info.label, setting->name, sizeof(info.label));
@ -332,13 +333,15 @@ int menu_setting_set(unsigned type, const char *label,
int ret = 0;
rarch_setting_t *setting = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
if (!menu)
return 0;
setting = menu_setting_find(
menu->menu_list->selection_buf->list
[menu->navigation.selection_ptr].label);
menu_list->selection_buf->list
[nav->selection_ptr].label);
if (!setting)
return 0;