Merge pull request #1795 from heuripedes/master

Minor improvements
This commit is contained in:
Twinaphex 2015-06-15 01:07:02 +02:00
commit 42e28f4125
5 changed files with 32 additions and 19 deletions

View File

@ -367,8 +367,9 @@ static int menu_cbs_init_bind_left_compare_label(menu_file_list_cbs_t *cbs,
for (i = 0; i < MAX_USERS; i++) for (i = 0; i < MAX_USERS; i++)
{ {
uint32_t label_setting_hash; uint32_t label_setting_hash;
char label_setting[PATH_MAX_LENGTH] = {0}; char label_setting[PATH_MAX_LENGTH];
label_setting[0] = '\0';
snprintf(label_setting, sizeof(label_setting), "input_player%d_joypad_index", i + 1); snprintf(label_setting, sizeof(label_setting), "input_player%d_joypad_index", i + 1);
label_setting_hash = djb2_calculate(label_setting); label_setting_hash = djb2_calculate(label_setting);

View File

@ -440,8 +440,9 @@ static int menu_cbs_init_bind_right_compare_label(menu_file_list_cbs_t *cbs,
for (i = 0; i < MAX_USERS; i++) for (i = 0; i < MAX_USERS; i++)
{ {
uint32_t label_setting_hash; uint32_t label_setting_hash;
char label_setting[PATH_MAX_LENGTH] = {0}; char label_setting[PATH_MAX_LENGTH];
label_setting[0] = '\0';
snprintf(label_setting, sizeof(label_setting), "input_player%d_joypad_index", i + 1); snprintf(label_setting, sizeof(label_setting), "input_player%d_joypad_index", i + 1);
label_setting_hash = djb2_calculate(label_setting); label_setting_hash = djb2_calculate(label_setting);

View File

@ -1013,9 +1013,6 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
xmb_node_t *core_node = NULL; xmb_node_t *core_node = NULL;
size_t end = 0; size_t end = 0;
uint64_t frame_count = video_driver_get_frame_count(); uint64_t frame_count = video_driver_get_frame_count();
char name[PATH_MAX_LENGTH] = {0};
char value[PATH_MAX_LENGTH] = {0};
menu_entry_t entry = {{0}};
menu_handle_t *menu = menu_driver_get_ptr(); menu_handle_t *menu = menu_driver_get_ptr();
if (!list || !list->size || !menu) if (!list || !list->size || !menu)
@ -1038,6 +1035,10 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
for (i = 0; i < end; i++) for (i = 0; i < end; i++)
{ {
const float half_size = xmb->icon.size / 2.0f;
char name[PATH_MAX_LENGTH];
char value[PATH_MAX_LENGTH];
menu_entry_t entry;
float icon_x, icon_y; float icon_x, icon_y;
GLuint texture_switch = 0; GLuint texture_switch = 0;
@ -1054,15 +1055,18 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
if (!node) if (!node)
continue; continue;
icon_x = node->x + xmb->margins.screen.left + icon_y = xmb->margins.screen.top + node->y + half_size;
xmb->icon.spacing.horizontal - xmb->icon.size / 2.0;
icon_y = xmb->margins.screen.top + node->y + xmb->icon.size / 2.0;
if ( if (icon_y < half_size)
icon_x < -xmb->icon.size / 2 || continue;
icon_x > width ||
icon_y < xmb->icon.size / 2 || if (icon_y > height + xmb->icon.size)
icon_y > height + xmb->icon.size) break;
icon_x = node->x + xmb->margins.screen.left +
xmb->icon.spacing.horizontal - half_size;
if (icon_x < -half_size || icon_x > width)
continue; continue;
menu_entry_get(&entry, i, list, true); menu_entry_get(&entry, i, list, true);
@ -1304,9 +1308,9 @@ static void xmb_frame(void)
math_matrix_4x4 mymat, mrot, mscal; math_matrix_4x4 mymat, mrot, mscal;
unsigned depth; unsigned depth;
unsigned width, height; unsigned width, height;
char msg[PATH_MAX_LENGTH] = {0}; char msg[PATH_MAX_LENGTH];
char title_msg[PATH_MAX_LENGTH] = {0}; char title_msg[PATH_MAX_LENGTH];
char timedate[PATH_MAX_LENGTH] = {0}; char timedate[PATH_MAX_LENGTH];
bool render_background = false; bool render_background = false;
xmb_handle_t *xmb = NULL; xmb_handle_t *xmb = NULL;
gl_t *gl = NULL; gl_t *gl = NULL;
@ -1330,6 +1334,10 @@ static void xmb_frame(void)
if (!gl) if (!gl)
return; return;
msg[0] = '\0';
title_msg[0] = '\0';
timedate[0] = '\0';
video_driver_get_size(&width, &height); video_driver_get_size(&width, &height);
menu_display_font_bind_block(menu, font_driver, &xmb->raster_block); menu_display_font_bind_block(menu, font_driver, &xmb->raster_block);

View File

@ -49,8 +49,8 @@ void menu_cbs_init(void *data,
const char *path, const char *label, const char *path, const char *label,
unsigned type, size_t idx) unsigned type, size_t idx)
{ {
char elem0[PATH_MAX_LENGTH] = {0}; char elem0[PATH_MAX_LENGTH];
char elem1[PATH_MAX_LENGTH] = {0}; char elem1[PATH_MAX_LENGTH];
struct string_list *str_list = NULL; struct string_list *str_list = NULL;
const char *menu_label = NULL; const char *menu_label = NULL;
menu_file_list_cbs_t *cbs = NULL; menu_file_list_cbs_t *cbs = NULL;
@ -68,6 +68,9 @@ void menu_cbs_init(void *data,
if (!cbs) if (!cbs)
return; return;
elem0[0] = '\0';
elem1[0] = '\0';
menu_list_get_last_stack(menu_list, NULL, &menu_label, NULL, NULL); menu_list_get_last_stack(menu_list, NULL, &menu_label, NULL, NULL);
if (label) if (label)

View File

@ -322,7 +322,7 @@ rarch_setting_t *menu_setting_find(const char *label)
for (; settings->type != ST_NONE; settings++) for (; settings->type != ST_NONE; settings++)
{ {
if (settings->type <= ST_GROUP && needle == settings->name_hash) if (needle == settings->name_hash && settings->type <= ST_GROUP)
{ {
/* make sure this isn't a collision */ /* make sure this isn't a collision */
if (strcmp(label, settings->name) != 0) if (strcmp(label, settings->name) != 0)