From 94a3eba9ef7a202cd364d33cbe0fd31cd2c0a015 Mon Sep 17 00:00:00 2001 From: LibretroAdmin Date: Wed, 26 Oct 2022 00:28:57 +0200 Subject: [PATCH] Turn checked into flag for menu_entry_t --- menu/drivers/materialui.c | 8 +++++--- menu/drivers/ozone.c | 2 +- menu/drivers/rgui.c | 3 ++- menu/drivers/xmb.c | 4 ++-- menu/menu_driver.c | 3 ++- menu/menu_entries.h | 4 ++-- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index 58babfb796..dacf7e6e0b 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -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) || diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c index 6d9d0b4345..77ae1c93b8 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -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) diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index 4a725bc973..225e8d1c99 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -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) { diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 2754797713..548059b870 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -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; diff --git a/menu/menu_driver.c b/menu/menu_driver.c index ba877d82d5..67183a7df6 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -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; diff --git a/menu/menu_entries.h b/menu/menu_entries.h index 77242fb177..b1d6d6d575 100644 --- a/menu/menu_entries.h +++ b/menu/menu_entries.h @@ -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);