diff --git a/menu/cbs/menu_cbs_select.c b/menu/cbs/menu_cbs_select.c index ec5e585d31..93c8c057f4 100644 --- a/menu/cbs/menu_cbs_select.c +++ b/menu/cbs/menu_cbs_select.c @@ -91,14 +91,13 @@ static int action_select_default( if (action != MENU_ACTION_NOOP) { menu_entry_t entry; - MENU_ENTRY_INIT(entry); + MENU_ENTRY_INITIALIZE(entry); + entry.flags |= MENU_ENTRY_FLAG_PATH_ENABLED + | MENU_ENTRY_FLAG_LABEL_ENABLED; /* Note: If menu_entry_action() is modified, * will have to verify that these parameters * remain unused... */ - entry.rich_label_enabled = false; - entry.value_enabled = false; - entry.sublabel_enabled = false; menu_entry_get(&entry, 0, idx, NULL, false); ret = menu_entry_action(&entry, idx, action); diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index a4fdb6bb6d..47cafa3fa7 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -1469,12 +1469,10 @@ static int action_bind_sublabel_input_remap_port( unsigned display_port = 0; menu_entry_t entry; - MENU_ENTRY_INIT(entry); - entry.path_enabled = false; - entry.label_enabled = true; - entry.rich_label_enabled = false; - entry.value_enabled = false; - entry.sublabel_enabled = false; + MENU_ENTRY_INITIALIZE(entry); + + entry.flags |= MENU_ENTRY_FLAG_LABEL_ENABLED; + menu_entry_get(&entry, 0, i, NULL, false); /* We need the actual frontend port index. diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index dcce297d79..58babfb796 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -2775,11 +2775,9 @@ static uint8_t materialui_count_sublabel_lines( wrapped_sublabel_str[0] = '\0'; /* Get entry sublabel */ - MENU_ENTRY_INIT(entry); - entry.path_enabled = false; - entry.label_enabled = false; - entry.rich_label_enabled = false; - entry.value_enabled = false; + MENU_ENTRY_INITIALIZE(entry); + entry.flags |= MENU_ENTRY_FLAG_SUBLABEL_ENABLED; + menu_entry_get(&entry, 0, entry_idx, NULL, true); /* If sublabel is empty, return immediately */ @@ -5215,10 +5213,15 @@ static void materialui_render_menu_list( break; /* Get current entry */ - MENU_ENTRY_INIT(entry); - entry.path_enabled = false; - entry.value_enabled = entry_value_enabled; - entry.sublabel_enabled = entry_sublabel_enabled; + MENU_ENTRY_INITIALIZE(entry); + + entry.flags |= MENU_ENTRY_FLAG_LABEL_ENABLED + | MENU_ENTRY_FLAG_RICH_LABEL_ENABLED; + if (entry_value_enabled) + entry.flags |= MENU_ENTRY_FLAG_VALUE_ENABLED; + if (entry_sublabel_enabled) + entry.flags |= MENU_ENTRY_FLAG_SUBLABEL_ENABLED; + menu_entry_get(&entry, 0, i, NULL, true); /* Render entry: label, value + associated icons */ @@ -6427,10 +6430,9 @@ static void materialui_show_fullscreen_thumbnails( mui->fullscreen_thumbnail_label[0] = '\0'; /* > Get menu entry */ - MENU_ENTRY_INIT(selected_entry); - selected_entry.path_enabled = false; - selected_entry.value_enabled = false; - selected_entry.sublabel_enabled = false; + MENU_ENTRY_INITIALIZE(selected_entry); + selected_entry.flags |= MENU_ENTRY_FLAG_LABEL_ENABLED + | MENU_ENTRY_FLAG_RICH_LABEL_ENABLED; menu_entry_get(&selected_entry, 0, selection, NULL, true); /* > Get entry label */ @@ -9335,12 +9337,12 @@ static int materialui_menu_entry_action( /* Selection has changed - must update entry * pointer (we could probably get away without * doing this, but it would break the API...) */ - MENU_ENTRY_INIT(new_entry); - new_entry.path_enabled = false; - new_entry.label_enabled = false; - new_entry.rich_label_enabled = false; - new_entry.value_enabled = false; - new_entry.sublabel_enabled = false; + MENU_ENTRY_INITIALIZE(new_entry); + new_entry.flags &= ~(MENU_ENTRY_FLAG_PATH_ENABLED + | MENU_ENTRY_FLAG_LABEL_ENABLED + | MENU_ENTRY_FLAG_RICH_LABEL_ENABLED + | MENU_ENTRY_FLAG_VALUE_ENABLED + | MENU_ENTRY_FLAG_SUBLABEL_ENABLED); menu_entry_get(&new_entry, 0, new_selection, NULL, true); entry_ptr = &new_entry; } @@ -9794,11 +9796,8 @@ static int materialui_pointer_up_swipe_horz_default( menu_entry_t last_entry; /* Get entry */ - MENU_ENTRY_INIT(last_entry); - last_entry.path_enabled = false; - last_entry.label_enabled = false; - last_entry.rich_label_enabled = false; - last_entry.sublabel_enabled = false; + MENU_ENTRY_INITIALIZE(last_entry); + last_entry.flags |= MENU_ENTRY_FLAG_VALUE_ENABLED; menu_entry_get(&last_entry, 0, selection, NULL, true); diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c index bba2206f77..6d9d0b4345 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -3387,10 +3387,9 @@ static bool ozone_is_load_content_playlist(void *userdata) if (ozone->depth != 4 || ozone->is_db_manager_list || ozone->is_file_list) return false; - MENU_ENTRY_INIT(entry); - entry.path_enabled = false; - entry.value_enabled = false; - entry.sublabel_enabled = false; + MENU_ENTRY_INITIALIZE(entry); + entry.flags |= MENU_ENTRY_FLAG_LABEL_ENABLED + | MENU_ENTRY_FLAG_RICH_LABEL_ENABLED; menu_entry_get(&entry, 0, 0, NULL, true); return entry.type == FILE_TYPE_RPL_ENTRY; @@ -3428,11 +3427,8 @@ static void ozone_update_savestate_thumbnail_path(void *data, unsigned i) { menu_entry_t entry; - MENU_ENTRY_INIT(entry); - entry.path_enabled = false; - entry.rich_label_enabled = false; - entry.value_enabled = false; - entry.sublabel_enabled = false; + MENU_ENTRY_INITIALIZE(entry); + entry.flags |= MENU_ENTRY_FLAG_LABEL_ENABLED; menu_entry_get(&entry, 0, i, NULL, true); if (!string_is_empty(entry.label)) @@ -5049,11 +5045,8 @@ static void ozone_compute_entries_position( menu_entry_t entry; ozone_node_t *node = NULL; - MENU_ENTRY_INIT(entry); - entry.path_enabled = false; - entry.label_enabled = false; - entry.rich_label_enabled = false; - entry.value_enabled = false; + MENU_ENTRY_INITIALIZE(entry); + entry.flags |= MENU_ENTRY_FLAG_SUBLABEL_ENABLED; menu_entry_get(&entry, 0, (unsigned)i, NULL, true); /* Empty playlist detection: @@ -5069,9 +5062,7 @@ static void ozone_compute_entries_position( ozone->empty_playlist = false; /* Cache node */ - node = (ozone_node_t*)selection_buf->list[i].userdata; - - if (!node) + if (!(node = (ozone_node_t*)selection_buf->list[i].userdata)) continue; node->height = ozone->dimensions.entry_height; @@ -5378,9 +5369,12 @@ border_iterate: entry_selected = selection == i; - MENU_ENTRY_INIT(entry); - entry.path_enabled = false; - entry.label_enabled = ozone->is_contentless_cores; + MENU_ENTRY_INITIALIZE(entry); + entry.flags |= MENU_ENTRY_FLAG_RICH_LABEL_ENABLED + | MENU_ENTRY_FLAG_VALUE_ENABLED + | MENU_ENTRY_FLAG_SUBLABEL_ENABLED; + if (ozone->is_contentless_cores) + entry.flags |= MENU_ENTRY_FLAG_LABEL_ENABLED; menu_entry_get(&entry, 0, (unsigned)i, selection_buf, true); if (entry.enum_idx == MENU_ENUM_LABEL_CHEEVOS_PASSWORD) @@ -7110,11 +7104,8 @@ static void ozone_set_thumbnail_content(void *data, const char *s) menu_entry_t entry; size_t selection = menu_navigation_get_selection(); - MENU_ENTRY_INIT(entry); - entry.label_enabled = false; - entry.rich_label_enabled = false; - entry.value_enabled = false; - entry.sublabel_enabled = false; + MENU_ENTRY_INITIALIZE(entry); + entry.flags |= MENU_ENTRY_FLAG_PATH_ENABLED; menu_entry_get(&entry, 0, selection, NULL, true); if (!string_is_empty(entry.path)) @@ -7129,11 +7120,8 @@ static void ozone_set_thumbnail_content(void *data, const char *s) { /* Selected entry */ menu_entry_t entry; - MENU_ENTRY_INIT(entry); - entry.label_enabled = false; - entry.rich_label_enabled = false; - entry.value_enabled = false; - entry.sublabel_enabled = false; + MENU_ENTRY_INITIALIZE(entry); + entry.flags |= MENU_ENTRY_FLAG_PATH_ENABLED; menu_entry_get(&entry, 0, menu_navigation_get_selection(), NULL, true); ozone->want_thumbnail_bar = ozone->fullscreen_thumbnails_available = @@ -7151,11 +7139,8 @@ static void ozone_set_thumbnail_content(void *data, const char *s) if (node) { - MENU_ENTRY_INIT(entry); - entry.label_enabled = false; - entry.rich_label_enabled = false; - entry.value_enabled = false; - entry.sublabel_enabled = false; + MENU_ENTRY_INITIALIZE(entry); + entry.flags |= MENU_ENTRY_FLAG_PATH_ENABLED; menu_entry_get(&entry, 0, selection, NULL, true); if (!string_is_empty(entry.path) && !string_is_empty(node->fullpath)) @@ -7283,11 +7268,8 @@ static bool ozone_is_current_entry_settings(size_t current_selection) unsigned entry_type = 0; enum msg_file_type entry_file_type = FILE_TYPE_NONE; - MENU_ENTRY_INIT(last_entry); - last_entry.path_enabled = false; - last_entry.label_enabled = false; - last_entry.rich_label_enabled = false; - last_entry.sublabel_enabled = false; + MENU_ENTRY_INITIALIZE(last_entry); + last_entry.flags |= MENU_ENTRY_FLAG_VALUE_ENABLED; menu_entry_get(&last_entry, 0, current_selection, NULL, true); @@ -7807,12 +7789,7 @@ static int ozone_menu_entry_action( { /* Selection has changed - must update * entry pointer */ - MENU_ENTRY_INIT(new_entry); - new_entry.path_enabled = false; - new_entry.label_enabled = false; - new_entry.rich_label_enabled = false; - new_entry.value_enabled = false; - new_entry.sublabel_enabled = false; + MENU_ENTRY_INITIALIZE(new_entry); menu_entry_get(&new_entry, 0, new_selection, NULL, true); entry_ptr = &new_entry; } @@ -10153,12 +10130,7 @@ static void ozone_selection_changed(ozone_handle_t *ozone, bool allow_animation) uintptr_t tag = (uintptr_t)selection_buf; size_t selection = menu_navigation_get_selection(); - MENU_ENTRY_INIT(entry); - entry.path_enabled = false; - entry.label_enabled = false; - entry.rich_label_enabled = false; - entry.value_enabled = false; - entry.sublabel_enabled = false; + MENU_ENTRY_INITIALIZE(entry); menu_entry_get(&entry, 0, selection, NULL, true); entry_type = entry.type; diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index 96d13a6698..4a725bc973 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -5300,10 +5300,9 @@ static void rgui_render(void *data, type_str_buf[0] = '\0'; /* Get current entry */ - MENU_ENTRY_INIT(entry); - entry.path_enabled = false; - entry.label_enabled = false; - entry.sublabel_enabled = false; + MENU_ENTRY_INITIALIZE(entry); + entry.flags |= MENU_ENTRY_FLAG_RICH_LABEL_ENABLED + | MENU_ENTRY_FLAG_VALUE_ENABLED; menu_entry_get(&entry, 0, (unsigned)i, NULL, true); if (entry.enum_idx == MENU_ENUM_LABEL_CHEEVOS_PASSWORD) @@ -6597,11 +6596,8 @@ static void rgui_update_savestate_thumbnail_path(void *data, unsigned i) { menu_entry_t entry; - MENU_ENTRY_INIT(entry); - entry.path_enabled = false; - entry.rich_label_enabled = false; - entry.value_enabled = false; - entry.sublabel_enabled = false; + MENU_ENTRY_INITIALIZE(entry); + entry.flags |= MENU_ENTRY_FLAG_LABEL_ENABLED; menu_entry_get(&entry, 0, i, NULL, true); if (!string_is_empty(entry.label)) @@ -6741,11 +6737,8 @@ static void rgui_scan_selected_entry_thumbnail(rgui_t *rgui, bool force_load) { /* Selected entry */ menu_entry_t entry; - MENU_ENTRY_INIT(entry); - entry.label_enabled = false; - entry.rich_label_enabled = false; - entry.value_enabled = false; - entry.sublabel_enabled = false; + MENU_ENTRY_INITIALIZE(entry); + entry.flags |= MENU_ENTRY_FLAG_PATH_ENABLED; menu_entry_get(&entry, 0, selection, NULL, true); rgui->playlist_index = @@ -6877,11 +6870,8 @@ static void rgui_update_menu_sublabel(rgui_t *rgui, size_t selection) { menu_entry_t entry; - MENU_ENTRY_INIT(entry); - entry.path_enabled = false; - entry.label_enabled = false; - entry.rich_label_enabled = false; - entry.value_enabled = false; + MENU_ENTRY_INITIALIZE(entry); + entry.flags |= MENU_ENTRY_FLAG_SUBLABEL_ENABLED; menu_entry_get(&entry, 0, (unsigned)selection, NULL, true); if (!string_is_empty(entry.sublabel)) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index a912bb2152..2754797713 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -1180,11 +1180,8 @@ static void xmb_update_savestate_thumbnail_path(void *data, unsigned i) { menu_entry_t entry; - MENU_ENTRY_INIT(entry); - entry.path_enabled = false; - entry.rich_label_enabled = false; - entry.value_enabled = false; - entry.sublabel_enabled = false; + MENU_ENTRY_INITIALIZE(entry); + entry.flags |= MENU_ENTRY_FLAG_LABEL_ENABLED; menu_entry_get(&entry, 0, i, NULL, true); if (!string_is_empty(entry.label)) @@ -1399,11 +1396,8 @@ static void xmb_set_thumbnail_content(void *data, const char *s) menu_entry_t entry; size_t selection = menu_navigation_get_selection(); - MENU_ENTRY_INIT(entry); - entry.label_enabled = false; - entry.rich_label_enabled = false; - entry.value_enabled = false; - entry.sublabel_enabled = false; + MENU_ENTRY_INITIALIZE(entry); + entry.flags |= MENU_ENTRY_FLAG_PATH_ENABLED; menu_entry_get(&entry, 0, selection, NULL, true); if (!string_is_empty(entry.path)) @@ -1421,11 +1415,8 @@ static void xmb_set_thumbnail_content(void *data, const char *s) { /* Selected entry */ menu_entry_t entry; - MENU_ENTRY_INIT(entry); - entry.label_enabled = false; - entry.rich_label_enabled = false; - entry.value_enabled = false; - entry.sublabel_enabled = false; + MENU_ENTRY_INITIALIZE(entry); + entry.flags |= MENU_ENTRY_FLAG_PATH_ENABLED; menu_entry_get(&entry, 0, menu_navigation_get_selection(), NULL, true); xmb->fullscreen_thumbnails_available = @@ -1443,11 +1434,8 @@ static void xmb_set_thumbnail_content(void *data, const char *s) if (node) { - MENU_ENTRY_INIT(entry); - entry.label_enabled = false; - entry.rich_label_enabled = false; - entry.value_enabled = false; - entry.sublabel_enabled = false; + MENU_ENTRY_INITIALIZE(entry); + entry.flags |= MENU_ENTRY_FLAG_PATH_ENABLED; menu_entry_get(&entry, 0, selection, NULL, true); if ( !string_is_empty(entry.path) && !string_is_empty(node->fullpath)) @@ -1604,12 +1592,7 @@ static void xmb_selection_pointer_changed( { menu_entry_t entry; unsigned entry_type; - MENU_ENTRY_INIT(entry); - entry.path_enabled = false; - entry.label_enabled = false; - entry.rich_label_enabled = false; - entry.value_enabled = false; - entry.sublabel_enabled = false; + MENU_ENTRY_INITIALIZE(entry); menu_entry_get(&entry, 0, selection, NULL, true); entry_type = entry.type; @@ -3493,9 +3476,14 @@ static int xmb_draw_item( if (icon_x < -half_size || icon_x > width) return 0; - MENU_ENTRY_INIT(entry); - entry.label_enabled = xmb->is_contentless_cores; - entry.sublabel_enabled = (i == current); + MENU_ENTRY_INITIALIZE(entry); + entry.flags |= MENU_ENTRY_FLAG_PATH_ENABLED + | MENU_ENTRY_FLAG_RICH_LABEL_ENABLED + | MENU_ENTRY_FLAG_VALUE_ENABLED; + if (xmb->is_contentless_cores) + entry.flags |= MENU_ENTRY_FLAG_LABEL_ENABLED; + if (i == current) + entry.flags |= MENU_ENTRY_FLAG_SUBLABEL_ENABLED; menu_entry_get(&entry, 0, i, list, true); entry_type = entry.type; @@ -4551,12 +4539,7 @@ static void xmb_render(void *data, if (get_entry) { - MENU_ENTRY_INIT(entry); - entry.path_enabled = false; - entry.label_enabled = false; - entry.rich_label_enabled = false; - entry.value_enabled = false; - entry.sublabel_enabled = false; + MENU_ENTRY_INITIALIZE(entry); menu_entry_get(&entry, 0, selection, NULL, true); } diff --git a/menu/menu_driver.c b/menu/menu_driver.c index c7a4e01775..ba877d82d5 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -365,6 +365,7 @@ void menu_navigation_set_selection(size_t val) void menu_entry_get(menu_entry_t *entry, size_t stack_idx, size_t i, void *userdata, bool use_representation) { + bool path_enabled; char newpath[255]; const char *path = NULL; const char *entry_label = NULL; @@ -372,12 +373,14 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx, struct menu_state *menu_st = &menu_driver_state; file_list_t *selection_buf = MENU_ENTRIES_GET_SELECTION_BUF_PTR_INTERNAL(menu_st, stack_idx); file_list_t *list = (userdata) ? (file_list_t*)userdata : selection_buf; - bool path_enabled = entry->path_enabled; + uint8_t entry_flags = entry->flags; newpath[0] = '\0'; if (!list) return; + + path_enabled = entry_flags & MENU_ENTRY_FLAG_PATH_ENABLED; path = list->list[i].path; entry_label = list->list[i].label; @@ -387,7 +390,8 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx, cbs = (menu_file_list_cbs_t*)list->list[i].actiondata; entry->idx = (unsigned)i; - if (entry->label_enabled && !string_is_empty(entry_label)) + if ( (entry_flags & MENU_ENTRY_FLAG_LABEL_ENABLED) + && !string_is_empty(entry_label)) strlcpy(entry->label, entry_label, sizeof(entry->label)); if (cbs) @@ -401,7 +405,8 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx, if (menu_stack && menu_stack->size) label = menu_stack->list[menu_stack->size - 1].label; - if (entry->rich_label_enabled && cbs->action_label) + if ( (entry_flags & MENU_ENTRY_FLAG_RICH_LABEL_ENABLED) + && cbs->action_label) { cbs->action_label(list, entry->type, (unsigned)i, @@ -409,11 +414,11 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx, entry->rich_label, sizeof(entry->rich_label)); - if (string_is_empty(entry->rich_label)) + if (!path_enabled && string_is_empty(entry->rich_label)) path_enabled = true; } - if ((path_enabled || entry->value_enabled) && + if ((path_enabled || (entry_flags & MENU_ENTRY_FLAG_VALUE_ENABLED)) && cbs->action_get_value && use_representation) { @@ -421,7 +426,9 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx, &entry->spacing, entry->type, (unsigned)i, label, entry->value, - entry->value_enabled ? sizeof(entry->value) : 0, + (entry_flags & MENU_ENTRY_FLAG_VALUE_ENABLED) + ? sizeof(entry->value) + : 0, path, newpath, path_enabled ? sizeof(newpath) : 0); @@ -439,7 +446,7 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx, } } - if (entry->sublabel_enabled) + if (entry_flags & MENU_ENTRY_FLAG_SUBLABEL_ENABLED) { if (!string_is_empty(cbs->action_sublabel_cache)) strlcpy(entry->sublabel, @@ -578,9 +585,10 @@ bool menu_entries_list_search(const char *needle, size_t *idx) * entry here, since we need the exact label * that is currently displayed by the menu * driver */ - MENU_ENTRY_INIT(entry); - entry.value_enabled = false; - entry.sublabel_enabled = false; + MENU_ENTRY_INITIALIZE(entry); + entry.flags |= MENU_ENTRY_FLAG_PATH_ENABLED + | MENU_ENTRY_FLAG_LABEL_ENABLED + | MENU_ENTRY_FLAG_RICH_LABEL_ENABLED; menu_entry_get(&entry, 0, i, NULL, true); /* When using the file browser, one or more @@ -4111,11 +4119,8 @@ void get_current_menu_value(struct menu_state *menu_st, menu_entry_t entry; const char* entry_label; - MENU_ENTRY_INIT(entry); - entry.path_enabled = false; - entry.label_enabled = false; - entry.rich_label_enabled = false; - entry.sublabel_enabled = false; + MENU_ENTRY_INITIALIZE(entry); + entry.flags |= MENU_ENTRY_FLAG_VALUE_ENABLED; menu_entry_get(&entry, 0, menu_st->selection_ptr, NULL, true); if (entry.enum_idx == MENU_ENUM_LABEL_CHEEVOS_PASSWORD) @@ -4132,7 +4137,12 @@ void get_current_menu_label(struct menu_state *menu_st, menu_entry_t entry; const char* entry_label; - MENU_ENTRY_INIT(entry); + MENU_ENTRY_INITIALIZE(entry); + entry.flags |= MENU_ENTRY_FLAG_PATH_ENABLED + | MENU_ENTRY_FLAG_LABEL_ENABLED + | MENU_ENTRY_FLAG_RICH_LABEL_ENABLED + | MENU_ENTRY_FLAG_VALUE_ENABLED + | MENU_ENTRY_FLAG_SUBLABEL_ENABLED; menu_entry_get(&entry, 0, menu_st->selection_ptr, NULL, true); if (!string_is_empty(entry.rich_label)) @@ -4148,11 +4158,8 @@ void get_current_menu_sublabel(struct menu_state *menu_st, { menu_entry_t entry; - MENU_ENTRY_INIT(entry); - entry.path_enabled = false; - entry.label_enabled = false; - entry.rich_label_enabled = false; - entry.value_enabled = false; + MENU_ENTRY_INITIALIZE(entry); + entry.flags |= MENU_ENTRY_FLAG_SUBLABEL_ENABLED; menu_entry_get(&entry, 0, menu_st->selection_ptr, NULL, true); strlcpy(s, entry.sublabel, len); } @@ -6647,13 +6654,12 @@ int menu_input_post_iterate( (menu_file_list_cbs_t*)selection_buf->list[selection].actiondata : NULL; - MENU_ENTRY_INIT(entry); + MENU_ENTRY_INITIALIZE(entry); /* Note: If menu_input_pointer_post_iterate() is * modified, will have to verify that these * parameters remain unused... */ - entry.rich_label_enabled = false; - entry.value_enabled = false; - entry.sublabel_enabled = false; + entry.flags |= MENU_ENTRY_FLAG_PATH_ENABLED + | MENU_ENTRY_FLAG_LABEL_ENABLED; menu_entry_get(&entry, 0, selection, NULL, false); return menu_input_pointer_post_iterate(p_disp, current_time, cbs, &entry, action); @@ -7680,17 +7686,15 @@ static int generic_menu_iterate( * should not rely on a hack like this in order to work. */ selection = MAX(MIN(selection, (menu_list_size - 1)), 0); - MENU_ENTRY_INIT(entry); + MENU_ENTRY_INITIALIZE(entry); /* NOTE: If menu_entry_action() is modified, * will have to verify that these parameters * remain unused... */ - entry.rich_label_enabled = false; - entry.value_enabled = false; - entry.sublabel_enabled = false; + entry.flags |= MENU_ENTRY_FLAG_PATH_ENABLED + | MENU_ENTRY_FLAG_LABEL_ENABLED; menu_entry_get(&entry, 0, selection, NULL, false); - ret = menu_entry_action(&entry, - selection, (enum menu_action)action); - if (ret) + if ((ret = menu_entry_action(&entry, + selection, (enum menu_action)action))) return -1; BIT64_SET(menu->state, MENU_STATE_POST_ITERATE); @@ -8296,10 +8300,9 @@ size_t menu_update_fullscreen_thumbnail_label( tmpstr[0] = '\0'; /* > Get menu entry */ - MENU_ENTRY_INIT(selected_entry); - selected_entry.path_enabled = false; - selected_entry.value_enabled = false; - selected_entry.sublabel_enabled = false; + MENU_ENTRY_INITIALIZE(selected_entry); + selected_entry.flags |= MENU_ENTRY_FLAG_LABEL_ENABLED + | MENU_ENTRY_FLAG_RICH_LABEL_ENABLED; menu_entry_get(&selected_entry, 0, menu_navigation_get_selection(), NULL, true); /* > Get entry label */ @@ -8340,10 +8343,9 @@ bool menu_is_running_quick_menu(void) { menu_entry_t entry; - MENU_ENTRY_INIT(entry); - entry.path_enabled = false; - entry.value_enabled = false; - entry.sublabel_enabled = false; + MENU_ENTRY_INITIALIZE(entry); + entry.flags |= MENU_ENTRY_FLAG_LABEL_ENABLED + | MENU_ENTRY_FLAG_RICH_LABEL_ENABLED; menu_entry_get(&entry, 0, 0, NULL, true); return string_is_equal(entry.label, "resume_content") || @@ -8354,10 +8356,9 @@ bool menu_is_nonrunning_quick_menu(void) { menu_entry_t entry; - MENU_ENTRY_INIT(entry); - entry.path_enabled = false; - entry.value_enabled = false; - entry.sublabel_enabled = false; + MENU_ENTRY_INITIALIZE(entry); + entry.flags |= MENU_ENTRY_FLAG_LABEL_ENABLED + | MENU_ENTRY_FLAG_RICH_LABEL_ENABLED; menu_entry_get(&entry, 0, 0, NULL, true); return string_is_equal(entry.label, "collection"); diff --git a/menu/menu_entries.h b/menu/menu_entries.h index 800177c247..77242fb177 100644 --- a/menu/menu_entries.h +++ b/menu/menu_entries.h @@ -137,6 +137,15 @@ typedef struct menu_file_list_cbs bool checked; } menu_file_list_cbs_t; +enum menu_entry_flags +{ + MENU_ENTRY_FLAG_PATH_ENABLED = (1 << 0), + 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) +}; + typedef struct menu_entry { size_t entry_idx; @@ -144,6 +153,7 @@ typedef struct menu_entry unsigned type; unsigned spacing; enum msg_hash_enums enum_idx; + uint8_t flags; char path[255]; char label[255]; char sublabel[MENU_SUBLABEL_MAX_LENGTH]; @@ -151,11 +161,6 @@ typedef struct menu_entry char value[255]; char password_value[255]; bool checked; - bool path_enabled; - bool label_enabled; - bool rich_label_enabled; - bool value_enabled; - bool sublabel_enabled; } menu_entry_t; int menu_entries_get_title(char *title, size_t title_len); @@ -231,7 +236,7 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx, int menu_entry_action( menu_entry_t *entry, size_t i, enum menu_action action); -#define MENU_ENTRY_INIT(entry) \ +#define MENU_ENTRY_INITIALIZE(entry) \ entry.path[0] = '\0'; \ entry.label[0] = '\0'; \ entry.sublabel[0] = '\0'; \ @@ -243,11 +248,7 @@ int menu_entry_action( entry.idx = 0; \ entry.type = 0; \ entry.spacing = 0; \ - entry.path_enabled = true; \ - entry.label_enabled = true; \ - entry.rich_label_enabled = true; \ - entry.value_enabled = true; \ - entry.sublabel_enabled = true + entry.flags = 0 RETRO_END_DECLS