(XMB) Use menu_list_get_ptr

This commit is contained in:
twinaphex 2015-06-08 11:30:19 +02:00
parent 2cfa890a58
commit a7b43854e0
2 changed files with 37 additions and 31 deletions

View File

@ -477,8 +477,9 @@ end:
static void xmb_selection_pointer_changed(void)
{
unsigned i, current, end;
xmb_handle_t *xmb = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
xmb_handle_t *xmb = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
if (!menu)
return;
@ -497,7 +498,7 @@ static void xmb_selection_pointer_changed(void)
float ia = xmb->item.passive.alpha;
float iz = xmb->item.passive.zoom;
xmb_node_t *node = (xmb_node_t*)file_list_get_userdata_at_offset(
menu->menu_list->selection_buf, i);
menu_list->selection_buf, i);
if (!node)
continue;
@ -817,7 +818,8 @@ static void xmb_list_switch_horizontal_list(xmb_handle_t *xmb, menu_handle_t *me
static void xmb_list_switch(xmb_handle_t *xmb)
{
int dir = -1;
menu_handle_t *menu = menu_driver_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
if (!menu)
return;
@ -839,7 +841,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->menu_list->selection_buf,
xmb_list_switch_new(xmb, menu_list->selection_buf,
dir, menu->navigation.selection_ptr);
xmb->categories.active.idx_old = menu->categories.selection_ptr;
}
@ -873,8 +875,9 @@ static void xmb_list_open_horizontal_list(xmb_handle_t *xmb, menu_handle_t *menu
static void xmb_list_open(xmb_handle_t *xmb)
{
int dir = 0;
menu_handle_t *menu = menu_driver_get_ptr();
int dir = 0;
menu_handle_t *menu = menu_driver_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
if (!menu)
return;
@ -890,7 +893,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->menu_list->selection_buf,
xmb_list_open_new(xmb, menu_list->selection_buf,
dir, menu->navigation.selection_ptr);
switch (xmb->depth)
@ -1212,9 +1215,10 @@ static void xmb_draw_cursor(gl_t *gl, xmb_handle_t *xmb, float x, float y)
static void xmb_render(void)
{
unsigned i, current, end;
xmb_handle_t *xmb = NULL;
settings_t *settings = config_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();
xmb_handle_t *xmb = NULL;
settings_t *settings = config_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
if (!menu)
return;
@ -1227,7 +1231,7 @@ static void xmb_render(void)
menu_animation_update(menu->animation, menu->dt / IDEAL_DT);
current = menu->navigation.selection_ptr;
end = menu_list_get_size(menu->menu_list);
end = menu_list_get_size(menu_list);
if (settings->menu.pointer.enable)
{
@ -1298,8 +1302,9 @@ static void xmb_frame(void)
xmb_handle_t *xmb = NULL;
gl_t *gl = NULL;
const struct font_renderer *font_driver = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
settings_t *settings = config_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
settings_t *settings = config_get_ptr();
if (!menu)
return;
@ -1352,8 +1357,8 @@ static void xmb_frame(void)
xmb->categories.selection_ptr_old);
xmb_draw_items(xmb, gl,
menu->menu_list->selection_buf,
menu->menu_list->menu_stack,
menu_list->selection_buf,
menu_list->menu_stack,
menu->navigation.selection_ptr,
menu->categories.selection_ptr);
@ -1933,8 +1938,9 @@ static void xmb_list_delete(file_list_t *list,
static void xmb_list_cache(menu_list_type_t type, unsigned action)
{
size_t stack_size;
xmb_handle_t *xmb = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
xmb_handle_t *xmb = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
if (!menu)
return;
@ -1944,8 +1950,8 @@ static void xmb_list_cache(menu_list_type_t type, unsigned action)
if (!xmb)
return;
file_list_copy(menu->menu_list->selection_buf, xmb->selection_buf_old);
file_list_copy(menu->menu_list->menu_stack, xmb->menu_stack_old);
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;
switch (type)
@ -1965,24 +1971,24 @@ static void xmb_list_cache(menu_list_type_t type, unsigned action)
break;
}
stack_size = menu->menu_list->menu_stack->size;
stack_size = menu_list->menu_stack->size;
if (menu->menu_list->menu_stack->list[stack_size - 1].label)
free(menu->menu_list->menu_stack->list[stack_size - 1].label);
menu->menu_list->menu_stack->list[stack_size - 1].label = NULL;
if (menu_list->menu_stack->list[stack_size - 1].label)
free(menu_list->menu_stack->list[stack_size - 1].label);
menu_list->menu_stack->list[stack_size - 1].label = NULL;
if (menu->categories.selection_ptr == 0)
{
menu->menu_list->menu_stack->list[stack_size - 1].label =
menu_list->menu_stack->list[stack_size - 1].label =
strdup("Main Menu");
menu->menu_list->menu_stack->list[stack_size - 1].type =
menu_list->menu_stack->list[stack_size - 1].type =
MENU_SETTINGS;
}
else
{
menu->menu_list->menu_stack->list[stack_size - 1].label =
menu_list->menu_stack->list[stack_size - 1].label =
strdup("Horizontal Menu");
menu->menu_list->menu_stack->list[stack_size - 1].type =
menu_list->menu_stack->list[stack_size - 1].type =
MENU_SETTING_HORIZONTAL_MENU;
}
break;

View File

@ -40,7 +40,7 @@ static INLINE void sanitize_to_string(char *s, const char *label, size_t len)
static int action_get_title_default(const char *path, const char *label,
unsigned menu_type, char *s, size_t len)
{
uint32_t hash = 0;
uint32_t label_hash = 0;
char elem0[PATH_MAX_LENGTH], elem1[PATH_MAX_LENGTH];
char elem0_path[PATH_MAX_LENGTH], elem1_path[PATH_MAX_LENGTH];
struct string_list *list_label = string_split(label, "|");
@ -72,7 +72,7 @@ static int action_get_title_default(const char *path, const char *label,
string_list_free(list_path);
}
hash = djb2_calculate(label);
label_hash = djb2_calculate(label);
#if 0
RARCH_LOG("label %s, elem0 %s, elem1 %s\n", label, elem0, elem1);
@ -94,7 +94,7 @@ static int action_get_title_default(const char *path, const char *label,
}
}
switch (hash)
switch (label_hash)
{
case MENU_LABEL_DEFERRED_DATABASE_MANAGER_LIST:
snprintf(s, len, "DATABASE SELECTION - %s", (elem0_path[0] != '\0') ? path_basename(elem0_path) : "");