Turn checked into flag for menu_entry_t

This commit is contained in:
LibretroAdmin 2022-10-26 00:28:57 +02:00
parent 299875f8b6
commit 94a3eba9ef
6 changed files with 14 additions and 10 deletions

View File

@ -4020,7 +4020,8 @@ static void materialui_render_menu_entry_default(
entry_file_type = msg_hash_to_file_type(
msg_hash_calculate(entry_value));
entry_value_type = materialui_get_entry_value_type(
mui, entry_value, entry->checked, entry_type, entry_file_type);
mui, entry_value, entry->flags & MENU_ENTRY_FLAG_CHECKED,
entry_type, entry_file_type);
/* Draw entry icon
* > Has to be done first, since it affects the left
@ -4029,7 +4030,7 @@ static void materialui_render_menu_entry_default(
{
case MUI_ICON_TYPE_INTERNAL:
/* Note: Checked entries never have icons */
if (!entry->checked)
if (!(entry->flags & MENU_ENTRY_FLAG_CHECKED))
icon_texture = mui->textures.list[node->icon_texture_index];
break;
#if defined(HAVE_LIBRETRODB)
@ -9810,7 +9811,8 @@ static int materialui_pointer_up_swipe_horz_default(
entry_file_type = msg_hash_to_file_type(
msg_hash_calculate(entry_value));
entry_value_type = materialui_get_entry_value_type(
mui, entry_value, last_entry.checked, entry_type, entry_file_type);
mui, entry_value, last_entry.flags & MENU_ENTRY_FLAG_CHECKED,
entry_type, entry_file_type);
/* If entry has a 'settings' type, reset scroll position */
if ((entry_value_type == MUI_ENTRY_VALUE_TEXT) ||

View File

@ -4741,7 +4741,7 @@ static void ozone_draw_entry_value(
gfx_display_ctx_driver_t *dispctx = p_disp->dispctx;
/* check icon */
if (entry->checked)
if (entry->flags & MENU_ENTRY_FLAG_CHECKED)
{
float *col = ozone->theme_dynamic.entries_checkmark;
if (dispctx && dispctx->blend_begin)

View File

@ -5352,7 +5352,8 @@ static void rgui_render(void *data,
/* Get 'type' of entry value component */
entry_value_type = rgui_get_entry_value_type(
entry_value, entry.checked, rgui_switch_icons);
entry_value, entry.flags & MENU_ENTRY_FLAG_CHECKED,
rgui_switch_icons);
switch (entry_value_type)
{

View File

@ -3836,7 +3836,7 @@ static int xmb_draw_item(
(!xmb->assets_missing) &&
(color[3] != 0) &&
(
(entry.checked) ||
(entry.flags & MENU_ENTRY_FLAG_CHECKED) ||
!((entry_type >= MENU_SETTING_DROPDOWN_ITEM) && (entry_type <= MENU_SETTING_DROPDOWN_SETTING_UINT_ITEM_SPECIAL))
)
)
@ -3844,7 +3844,7 @@ static int xmb_draw_item(
math_matrix_4x4 mymat_tmp;
uintptr_t texture = xmb_icon_get_id(xmb, core_node, node,
entry.enum_idx, entry.path, entry.label,
entry_type, (i == current), entry.checked);
entry_type, (i == current), entry.flags & MENU_ENTRY_FLAG_CHECKED);
float x = icon_x;
float y = icon_y;
float scale_factor = node->zoom;

View File

@ -400,7 +400,8 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx,
file_list_t *menu_stack = MENU_LIST_GET(menu_st->entries.list, 0);
entry->enum_idx = cbs->enum_idx;
entry->checked = cbs->checked;
if (cbs->checked)
entry->flags |= MENU_ENTRY_FLAG_CHECKED;
if (menu_stack && menu_stack->size)
label = menu_stack->list[menu_stack->size - 1].label;

View File

@ -143,7 +143,8 @@ enum menu_entry_flags
MENU_ENTRY_FLAG_LABEL_ENABLED = (1 << 1),
MENU_ENTRY_FLAG_RICH_LABEL_ENABLED = (1 << 2),
MENU_ENTRY_FLAG_VALUE_ENABLED = (1 << 3),
MENU_ENTRY_FLAG_SUBLABEL_ENABLED = (1 << 4)
MENU_ENTRY_FLAG_SUBLABEL_ENABLED = (1 << 4),
MENU_ENTRY_FLAG_CHECKED = (1 << 5)
};
typedef struct menu_entry
@ -160,7 +161,6 @@ typedef struct menu_entry
char rich_label[255];
char value[255];
char password_value[255];
bool checked;
} menu_entry_t;
int menu_entries_get_title(char *title, size_t title_len);