menu_entry: hide password values

This commit is contained in:
natinusala 2019-01-29 10:32:22 +01:00
parent 406d927f6b
commit bf98664b15
4 changed files with 24 additions and 2 deletions

View File

@ -302,6 +302,7 @@ border_iterate:
ticker.len = (entry_width - 60 - ((int)utf8len(entry_rich_label) * ozone->entry_font_glyph_width)) / ozone->entry_font_glyph_width;
menu_animation_ticker(&ticker);
ozone_draw_entry_value(ozone, video_info, entry_value_ticker, x_offset + 426 + entry_width, y + FONT_SIZE_ENTRIES_LABEL + 8 - 1 + scroll_y,alpha_uint32, &entry);
free(entry_rich_label);

View File

@ -2962,7 +2962,10 @@ static int xmb_draw_item(
if (!string_is_empty(entry->value))
{
ticker.str = entry->value;
char entry_value[255];
menu_entry_get_value(entry, entry_value, sizeof(entry_value));
ticker.str = entry_value;
menu_animation_ticker(&ticker);
}

View File

@ -266,9 +266,20 @@ void menu_entry_reset(uint32_t i)
void menu_entry_get_value(menu_entry_t *entry, char *s, size_t len)
{
size_t size, i;
if (!entry || string_is_empty(entry->value))
return;
strlcpy(s, entry->value, len);
size = strlcpy(s, entry->value, len);
if (menu_entry_is_password(entry))
{
for (i = 0; i < size; i++)
{
s[i] = '*';
}
}
}
void menu_entry_set_value(uint32_t i, const char *s)
@ -277,6 +288,11 @@ void menu_entry_set_value(uint32_t i, const char *s)
setting_set_with_string_representation(setting, s);
}
bool menu_entry_is_password(menu_entry_t *entry)
{
return entry->enum_idx == MENU_ENUM_LABEL_CHEEVOS_PASSWORD;
}
uint32_t menu_entry_num_has_range(uint32_t i)
{
rarch_setting_t *setting = menu_entries_get_setting(i);

View File

@ -101,6 +101,8 @@ void menu_entry_get_value(menu_entry_t *entry, char *s, size_t len);
void menu_entry_set_value(uint32_t i, const char *s);
bool menu_entry_is_password(menu_entry_t *entry);
uint32_t menu_entry_num_has_range(uint32_t i);
float menu_entry_num_min(uint32_t i);