From bfd9419d6a5ed399a2a2645734934f2d07124def Mon Sep 17 00:00:00 2001 From: LibretroAdmin Date: Tue, 1 Nov 2022 06:51:53 +0100 Subject: [PATCH] (MaterialUI) Turn booleans into flags --- menu/drivers/materialui.c | 514 +++++++++++++++++++++----------------- 1 file changed, 281 insertions(+), 233 deletions(-) diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index dacf7e6e0b..23578168ec 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -549,6 +549,30 @@ typedef struct size_t size; } materialui_playlist_icons_t; +enum materialui_handle_flags +{ + MUI_FLAG_IS_PORTRAIT = (1 << 0), + MUI_FLAG_NEED_COMPUTE = (1 << 1), + MUI_FLAG_SHOW_MOUSE = (1 << 2), + MUI_FLAG_SHOW_SCREENSAVER = (1 << 3), + MUI_FLAG_IS_PLAYLIST_TAB = (1 << 4), + MUI_FLAG_IS_PLAYLIST = (1 << 5), + MUI_FLAG_IS_FILE_LIST = (1 << 6), + MUI_FLAG_IS_DROPDOWN_LIST = (1 << 7), + MUI_FLAG_IS_CORE_UPDATER_LIST = (1 << 8), + MUI_FLAG_LAST_SHOW_NAVBAR = (1 << 9), + MUI_FLAG_LAST_AUTO_ROTATE_NAVBAR = (1 << 10), + MUI_FLAG_MENU_STACK_FLUSHED = (1 << 11), + /* Used to track scroll animations */ + MUI_FLAG_SCROLL_ANIMATION_ACTIVE = (1 << 12), + MUI_FLAG_USE_SMOOTH_TICKER = (1 << 13), + MUI_FLAG_TOUCH_FEEDBACK_UPDATE_SELECTION = (1 << 14), + MUI_FLAG_PRIMARY_THUMBNAIL_AVAILABLE = (1 << 15), + MUI_FLAG_SECONDARY_THUMBNAIL_ENABLED = (1 << 16), + MUI_FLAG_SHOW_FULLSCREEN_THUMBNAILS = (1 << 17), + MUI_FLAG_SHOW_SELECTION_MARKER_SHADOW = (1 << 18) +}; + typedef struct materialui_handle { /* Pointer info */ @@ -638,6 +662,7 @@ typedef struct materialui_handle materialui_nav_bar_t nav_bar; /* unsigned alignment */ /* Colour theme parameters */ materialui_colors_t colors; /* uint32_t alignment */ + uint32_t flags; /* Scrollbar parameters */ materialui_scrollbar_t scrollbar; /* int alignment */ @@ -669,26 +694,6 @@ typedef struct materialui_handle char msgbox[1024]; char menu_title[255]; char fullscreen_thumbnail_label[255]; - bool is_portrait; - bool need_compute; - bool show_mouse; - bool show_screensaver; - bool is_playlist_tab; - bool is_playlist; - bool is_file_list; - bool is_dropdown_list; - bool is_core_updater_list; - bool last_show_nav_bar; - bool last_auto_rotate_nav_bar; - bool menu_stack_flushed; - /* Used to track scroll animations */ - bool scroll_animation_active; - bool use_smooth_ticker; - bool touch_feedback_update_selection; - bool primary_thumbnail_available; - bool secondary_thumbnail_enabled; - bool show_fullscreen_thumbnails; - bool show_selection_marker_shadow; } materialui_handle_t; static void hex32_to_rgba_normalized(uint32_t hex, float* rgba, float alpha) @@ -2903,9 +2908,9 @@ static void materialui_compute_entries_box_playlist_list( int thumbnail_margin = 0; /* Account for additional padding in portrait mode */ - if (mui->is_portrait) + if (mui->flags & MUI_FLAG_IS_PORTRAIT) { - if (mui->secondary_thumbnail_enabled) + if (mui->flags & MUI_FLAG_SECONDARY_THUMBNAIL_ENABLED) thumbnail_margin = (int)mui->scrollbar.width; } /* Account for additional padding in landscape mode */ @@ -2915,7 +2920,7 @@ static void materialui_compute_entries_box_playlist_list( usable_width -= mui->thumbnail_width_max + thumbnail_margin; /* Account for second thumbnail, if enabled */ - if (mui->secondary_thumbnail_enabled) + if (mui->flags & MUI_FLAG_SECONDARY_THUMBNAIL_ENABLED) usable_width -= mui->thumbnail_width_max + thumbnail_margin; } @@ -3167,8 +3172,8 @@ static size_t materialui_auto_select_onscreen_entry( /* If selected item is off screen but we are * currently scrolling towards it (via an animation), * no action is required */ - if (mui->scroll_animation_active && - (mui->scroll_animation_selection == selection)) + if ( (mui->flags & MUI_FLAG_SCROLL_ANIMATION_ACTIVE) + && (mui->scroll_animation_selection == selection)) return selection; /* Update selection index */ @@ -3203,7 +3208,7 @@ static INLINE void materialui_kill_scroll_animation( gfx_animation_kill_by_tag(&scroll_tag); menu_input_set_pointer_y_accel(0.0f); - mui->scroll_animation_active = false; + mui->flags &= ~MUI_FLAG_SCROLL_ANIMATION_ACTIVE; mui->scroll_animation_selection = 0; } @@ -3260,7 +3265,7 @@ static bool materialui_render_process_entry_playlist_thumb_list( /* Load thumbnails for all on-screen entries * and free thumbnails for all off-screen entries */ - if (mui->secondary_thumbnail_enabled) + if (mui->flags & MUI_FLAG_SECONDARY_THUMBNAIL_ENABLED) gfx_thumbnail_process_streams( mui->thumbnail_path_data, p_anim, @@ -3586,14 +3591,15 @@ static void materialui_render(void *data, scale_factor = gfx_display_get_dpi_scale(p_disp, settings, width, height, false, false); - if ((scale_factor != mui->last_scale_factor) || - (width != mui->last_width) || - (height != mui->last_height) || - ((enum materialui_landscape_layout_optimization_type) + if ( (scale_factor != mui->last_scale_factor) + || (width != mui->last_width) + || (height != mui->last_height) + || ((enum materialui_landscape_layout_optimization_type) landscape_layout_optimization != - mui->last_landscape_layout_optimization) || - (show_nav_bar != mui->last_show_nav_bar) || - (auto_rotate_nav_bar != mui->last_auto_rotate_nav_bar)) + mui->last_landscape_layout_optimization) + || (show_nav_bar != ((mui->flags & MUI_FLAG_LAST_SHOW_NAVBAR) > 0)) + || (auto_rotate_nav_bar != ((mui->flags & + MUI_FLAG_LAST_AUTO_ROTATE_NAVBAR) > 0))) { mui->dip_base_unit_size = scale_factor * MUI_DIP_BASE_UNIT_SIZE; mui->last_scale_factor = scale_factor; @@ -3602,8 +3608,14 @@ static void materialui_render(void *data, mui->last_landscape_layout_optimization = (enum materialui_landscape_layout_optimization_type) landscape_layout_optimization; - mui->last_show_nav_bar = show_nav_bar; - mui->last_auto_rotate_nav_bar = auto_rotate_nav_bar; + if (show_nav_bar) + mui->flags |= MUI_FLAG_LAST_SHOW_NAVBAR; + else + mui->flags &= ~MUI_FLAG_LAST_SHOW_NAVBAR; + if (auto_rotate_nav_bar) + mui->flags |= MUI_FLAG_LAST_AUTO_ROTATE_NAVBAR; + else + mui->flags &= ~MUI_FLAG_LAST_AUTO_ROTATE_NAVBAR; /* Screen dimensions/layout are going to change * > Once this happens, menu will scroll to the @@ -3621,7 +3633,7 @@ static void materialui_render(void *data, video_driver_monitor_reset(); } - if (mui->need_compute) + if (mui->flags & MUI_FLAG_NEED_COMPUTE) { if (mui->font_data.list.font && mui->font_data.hint.font) materialui_compute_entries_box(mui, width, height, header_height); @@ -3631,15 +3643,15 @@ static void materialui_render(void *data, * is correctly displayed on screen. * But we can't do this until materialui_compute_entries_box() * has been called, so we delay it until here, when - * mui->need_compute is acted upon. */ + * MUI_FLAG_NEED_COMPUTE is acted upon. */ /* Kill any existing scroll animation * and reset scroll acceleration */ materialui_kill_scroll_animation(mui); /* Get new scroll position */ - mui->scroll_y = materialui_get_scroll(mui, p_disp); - mui->need_compute = false; + mui->scroll_y = materialui_get_scroll(mui, p_disp); + mui->flags &= ~MUI_FLAG_NEED_COMPUTE; } /* Need to update this each frame, otherwise touchscreen @@ -3652,7 +3664,7 @@ static void materialui_render(void *data, /* If menu screensaver is active, update * screensaver and return */ - if (mui->show_screensaver) + if (mui->flags & MUI_FLAG_SHOW_SCREENSAVER) { menu_screensaver_iterate( mui->screensaver, @@ -3696,7 +3708,7 @@ static void materialui_render(void *data, /* If fullscreen thumbnail view is enabled, * scrolling is disabled - otherwise, just apply * normal pointer acceleration */ - else if (!mui->show_fullscreen_thumbnails) + else if (!(mui->flags & MUI_FLAG_SHOW_FULLSCREEN_THUMBNAILS)) mui->scroll_y -= mui->pointer.y_accel; } @@ -3754,11 +3766,11 @@ static void materialui_render(void *data, } /* Track pointer input, if required */ - if (first_entry_found && - !last_entry_found && - (mui->pointer.type != MENU_POINTER_DISABLED) && - !mui->scrollbar.dragged && - !mui->show_fullscreen_thumbnails) + if ( (first_entry_found) + && (!last_entry_found) + && (mui->pointer.type != MENU_POINTER_DISABLED) + && (!(mui->scrollbar.dragged)) + && (!(mui->flags & MUI_FLAG_SHOW_FULLSCREEN_THUMBNAILS))) { int16_t pointer_x = mui->pointer.x; int16_t pointer_y = mui->pointer.y; @@ -3786,7 +3798,7 @@ static void materialui_render(void *data, { /* ...check whether feedback selection updates * are enabled... */ - if (mui->touch_feedback_update_selection) + if (mui->flags & MUI_FLAG_TOUCH_FEEDBACK_UPDATE_SELECTION) { /* ...apply touch feedback to current entry */ mui->touch_feedback_selection = (unsigned)i; @@ -3802,7 +3814,7 @@ static void materialui_render(void *data, /* Once an entry has been auto selected, disable * touch feedback selection updates until the next * pointer down event */ - mui->touch_feedback_update_selection = false; + mui->flags &= ~MUI_FLAG_TOUCH_FEEDBACK_UPDATE_SELECTION; } } } @@ -3997,7 +4009,7 @@ static void materialui_render_menu_entry_default( /* Initial ticker configuration * > Note: ticker is only used for labels/values, * not sublabel text */ - if (mui->use_smooth_ticker) + if (mui->flags & MUI_FLAG_USE_SMOOTH_TICKER) { mui->ticker_smooth.font = mui->font_data.list.font; mui->ticker_smooth.selected = entry_selected; @@ -4202,7 +4214,7 @@ static void materialui_render_menu_entry_default( value_buf[0] = '\0'; /* Apply ticker */ - if (mui->use_smooth_ticker) + if (mui->flags & MUI_FLAG_USE_SMOOTH_TICKER) { mui->ticker_smooth.field_width = entry_value_width_max; mui->ticker_smooth.src_str = entry_value; @@ -4324,7 +4336,7 @@ static void materialui_render_menu_entry_default( if (label_width > 0) { /* Apply ticker */ - if (mui->use_smooth_ticker) + if (mui->flags & MUI_FLAG_USE_SMOOTH_TICKER) { /* Label */ mui->ticker_smooth.field_width = (unsigned)label_width; @@ -4397,13 +4409,13 @@ static void materialui_render_menu_entry_playlist_list( /* Initial ticker configuration * > Note: ticker is only used for labels, * not sublabel text */ - if (mui->use_smooth_ticker) + if (mui->flags & MUI_FLAG_USE_SMOOTH_TICKER) { mui->ticker_smooth.font = mui->font_data.list.font; mui->ticker_smooth.selected = entry_selected; } else - mui->ticker.selected = entry_selected; + mui->ticker.selected = entry_selected; /* Read entry parameters */ if (!string_is_empty(entry->rich_label)) @@ -4435,9 +4447,9 @@ static void materialui_render_menu_entry_playlist_list( * left/right margin equal to the scroll bar * width (to prevent the scroll bar from being * drawn on top of the secondary thumbnail) */ - if (mui->is_portrait) + if (mui->flags & MUI_FLAG_IS_PORTRAIT) { - if (mui->secondary_thumbnail_enabled) + if (mui->flags & MUI_FLAG_SECONDARY_THUMBNAIL_ENABLED) thumbnail_margin = (int)mui->scrollbar.width; } /* When using landscape display orientations, we @@ -4464,7 +4476,7 @@ static void materialui_render_menu_entry_playlist_list( usable_width -= mui->thumbnail_width_max + thumbnail_margin; /* Draw secondary thumbnail, if required */ - if (mui->secondary_thumbnail_enabled) + if (mui->flags & MUI_FLAG_SECONDARY_THUMBNAIL_ENABLED) { materialui_draw_thumbnail( mui, @@ -4543,7 +4555,7 @@ static void materialui_render_menu_entry_playlist_list( if (usable_width > 0) { /* Apply ticker */ - if (mui->use_smooth_ticker) + if (mui->flags & MUI_FLAG_USE_SMOOTH_TICKER) { /* Label */ mui->ticker_smooth.field_width = (unsigned)usable_width; @@ -4653,7 +4665,7 @@ static void materialui_render_menu_entry_playlist_dual_icon( /* Initial ticker configuration * > Note: ticker is only used for labels */ - if (mui->use_smooth_ticker) + if (mui->flags & MUI_FLAG_USE_SMOOTH_TICKER) { mui->ticker_smooth.font = mui->font_data.list.font; mui->ticker_smooth.selected = entry_selected; @@ -4720,7 +4732,7 @@ static void materialui_render_menu_entry_playlist_dual_icon( if (usable_width > 0) { /* Apply ticker */ - if (mui->use_smooth_ticker) + if (mui->flags & MUI_FLAG_USE_SMOOTH_TICKER) { /* Label */ mui->ticker_smooth.field_width = (unsigned)usable_width; @@ -4831,7 +4843,7 @@ static void materialui_render_menu_entry_playlist_desktop( if (usable_width > 0) { /* Apply ticker */ - if (mui->use_smooth_ticker) + if (mui->flags & MUI_FLAG_USE_SMOOTH_TICKER) { mui->ticker_smooth.font = mui->font_data.list.font; mui->ticker_smooth.selected = entry_selected; @@ -5111,7 +5123,7 @@ static void materialui_render_selected_entry_aux_playlist_desktop( (unsigned)((255.0f * mui->transition_alpha * mui->status_bar.alpha) + 0.5f); /* Apply ticker */ - if (mui->use_smooth_ticker) + if (mui->flags & MUI_FLAG_USE_SMOOTH_TICKER) { mui->ticker_smooth.font = mui->font_data.hint.font; mui->ticker_smooth.selected = true; @@ -5185,10 +5197,10 @@ static void materialui_render_menu_list( size_t entries_end = menu_entries_get_size(); unsigned header_height = p_disp->header_height; bool touch_feedback_enabled = - !mui->scrollbar.dragged && - !mui->show_fullscreen_thumbnails && - (mui->touch_feedback_alpha >= 0.5f) && - (mui->touch_feedback_selection == menu_input_get_pointer_selection()); + (!mui->scrollbar.dragged) + && (!(mui->flags & MUI_FLAG_SHOW_FULLSCREEN_THUMBNAILS)) + && (mui->touch_feedback_alpha >= 0.5f) + && (mui->touch_feedback_selection == menu_input_get_pointer_selection()); bool entry_value_enabled = (mui->list_view_type == MUI_LIST_VIEW_DEFAULT); bool entry_sublabel_enabled = (mui->list_view_type != MUI_LIST_VIEW_PLAYLIST_THUMB_DUAL_ICON) && @@ -5461,7 +5473,7 @@ static void materialui_render_selection_highlight( NULL); /* Draw shadow, if required */ - if (mui->show_selection_marker_shadow) + if (mui->flags & MUI_FLAG_SHOW_SELECTION_MARKER_SHADOW) { gfx_display_draw_quad( p_disp, @@ -5506,8 +5518,10 @@ static void materialui_render_entry_touch_feedback( /* Check whether pointer is currently * held and stationary */ bool pointer_active = - (!mui->scrollbar.dragged && !mui->show_fullscreen_thumbnails && - mui->pointer.pressed && !mui->pointer.dragged); + ( (!mui->scrollbar.dragged) + && (!(mui->flags & MUI_FLAG_SHOW_FULLSCREEN_THUMBNAILS)) + && (mui->pointer.pressed) + && (!mui->pointer.dragged)); /* If pointer is held and stationary, need to check * that current pointer selection is valid @@ -5568,7 +5582,7 @@ static void materialui_render_entry_touch_feedback( mui->transition_alpha * mui->touch_feedback_alpha); /* Set shadow colour (if required) */ - if (mui->show_selection_marker_shadow) + if (mui->flags & MUI_FLAG_SHOW_SELECTION_MARKER_SHADOW) { float selection_marker_shadow_alpha = mui->colors.selection_marker_shadow_opacity * @@ -5612,9 +5626,14 @@ static void materialui_render_header( int sys_bar_text_y = (int)(((float)mui->sys_bar_height / 2.0f) + (float)mui->font_data.hint.line_centre_offset); int title_x = 0; bool show_back_icon = menu_entries_ctl(MENU_ENTRIES_CTL_SHOW_BACK, NULL); - bool show_search_icon = mui->is_playlist || mui->is_file_list || mui->is_core_updater_list; - bool show_switch_view_icon = mui->is_playlist && mui->primary_thumbnail_available; - bool use_landscape_layout = !mui->is_portrait && + bool show_search_icon = + (mui->flags & MUI_FLAG_IS_PLAYLIST) + || (mui->flags & MUI_FLAG_IS_FILE_LIST) + || (mui->flags & MUI_FLAG_IS_CORE_UPDATER_LIST); + bool show_switch_view_icon = + (mui->flags & MUI_FLAG_IS_PLAYLIST) + && (mui->flags & MUI_FLAG_PRIMARY_THUMBNAIL_AVAILABLE); + bool use_landscape_layout = (!(mui->flags & MUI_FLAG_IS_PORTRAIT)) && (mui->last_landscape_layout_optimization != MATERIALUI_LANDSCAPE_LAYOUT_OPTIMIZATION_DISABLED); const char *menu_title = mui->menu_title; bool battery_level_enable = settings->bools.menu_battery_level_enable; @@ -5841,7 +5860,7 @@ static void materialui_render_header( menu_entries_get_core_title(core_title, sizeof(core_title)); - if (mui->use_smooth_ticker) + if (mui->flags & MUI_FLAG_USE_SMOOTH_TICKER) { mui->ticker_smooth.font = mui->font_data.hint.font; mui->ticker_smooth.selected = true; @@ -5954,10 +5973,10 @@ static void materialui_render_header( /* >> If fullscreen thumbnail view is enabled, title * is the label of the currently selected entry */ - if (mui->show_fullscreen_thumbnails) + if (mui->flags & MUI_FLAG_SHOW_FULLSCREEN_THUMBNAILS) menu_title = mui->fullscreen_thumbnail_label; - if (mui->use_smooth_ticker) + if (mui->flags & MUI_FLAG_USE_SMOOTH_TICKER) { mui->ticker_smooth.font = mui->font_data.title.font; mui->ticker_smooth.selected = true; @@ -6372,7 +6391,7 @@ static void materialui_hide_fullscreen_thumbnails( mui->fullscreen_thumbnail_alpha = 0.0f; /* Disable fullscreen thumbnails */ - mui->show_fullscreen_thumbnails = false; + mui->flags &= ~MUI_FLAG_SHOW_FULLSCREEN_THUMBNAILS; } /* Enables (and triggers a fade in of) the fullscreen @@ -6408,15 +6427,15 @@ static void materialui_show_fullscreen_thumbnails( * current selection has at least one valid thumbnail * and all thumbnails for current selection are already * loaded/available */ - if ((primary_thumbnail->status == GFX_THUMBNAIL_STATUS_AVAILABLE) && - (mui->secondary_thumbnail_enabled && - ((secondary_thumbnail->status != GFX_THUMBNAIL_STATUS_MISSING) && - (secondary_thumbnail->status != GFX_THUMBNAIL_STATUS_AVAILABLE)))) + if ( (primary_thumbnail->status == GFX_THUMBNAIL_STATUS_AVAILABLE) + && ( (mui->flags & MUI_FLAG_SECONDARY_THUMBNAIL_ENABLED) + && ((secondary_thumbnail->status != GFX_THUMBNAIL_STATUS_MISSING) + && (secondary_thumbnail->status != GFX_THUMBNAIL_STATUS_AVAILABLE)))) return; - if ((primary_thumbnail->status == GFX_THUMBNAIL_STATUS_MISSING) && - (!mui->secondary_thumbnail_enabled || - (secondary_thumbnail->status != GFX_THUMBNAIL_STATUS_AVAILABLE))) + if ( (primary_thumbnail->status == GFX_THUMBNAIL_STATUS_MISSING) + && ((!(mui->flags & MUI_FLAG_SECONDARY_THUMBNAIL_ENABLED)) + || (secondary_thumbnail->status != GFX_THUMBNAIL_STATUS_AVAILABLE))) return; /* Menu list must be stationary while fullscreen @@ -6463,7 +6482,7 @@ static void materialui_show_fullscreen_thumbnails( /* Enable fullscreen thumbnails */ mui->fullscreen_thumbnail_selection = selection; - mui->show_fullscreen_thumbnails = true; + mui->flags |= MUI_FLAG_SHOW_FULLSCREEN_THUMBNAILS; } static void materialui_render_fullscreen_thumbnails( @@ -6477,6 +6496,14 @@ static void materialui_render_fullscreen_thumbnails( /* Check whether fullscreen thumbnails are visible */ if (mui->fullscreen_thumbnail_alpha > 0.0f) { + int view_width; + int view_height; + int thumbnail_box_width; + int thumbnail_box_height; + int primary_thumbnail_x; + int primary_thumbnail_y; + int secondary_thumbnail_x; + int secondary_thumbnail_y; gfx_thumbnail_t *primary_thumbnail = NULL; gfx_thumbnail_t *secondary_thumbnail = NULL; bool show_primary_thumbnail = false; @@ -6486,21 +6513,13 @@ static void materialui_render_fullscreen_thumbnails( float primary_thumbnail_draw_height = 0.0f; float secondary_thumbnail_draw_width = 0.0f; float secondary_thumbnail_draw_height = 0.0f; - int view_width; - int view_height; - int thumbnail_box_width; - int thumbnail_box_height; - int primary_thumbnail_x; - int primary_thumbnail_y; - int secondary_thumbnail_x; - int secondary_thumbnail_y; /* Sanity check: Return immediately if this is a view * mode without thumbnails * > Note: Baring inexplicable internal errors, this * can never happen... */ - if ((mui->list_view_type == MUI_LIST_VIEW_DEFAULT) || - (mui->list_view_type == MUI_LIST_VIEW_PLAYLIST)) + if ( (mui->list_view_type == MUI_LIST_VIEW_DEFAULT) + || (mui->list_view_type == MUI_LIST_VIEW_PLAYLIST)) goto error; /* Paranoid safety check: ensure that current @@ -6521,8 +6540,8 @@ static void materialui_render_fullscreen_thumbnails( show_primary_thumbnail = (primary_thumbnail->status != GFX_THUMBNAIL_STATUS_MISSING); show_secondary_thumbnail = - mui->secondary_thumbnail_enabled && - (secondary_thumbnail->status != GFX_THUMBNAIL_STATUS_MISSING); + (mui->flags & MUI_FLAG_SECONDARY_THUMBNAIL_ENABLED) + && (secondary_thumbnail->status != GFX_THUMBNAIL_STATUS_MISSING); if (show_primary_thumbnail) num_thumbnails++; @@ -6545,7 +6564,7 @@ static void materialui_render_fullscreen_thumbnails( * at the top, secondary at the bottom * > When using landscape layouts, primary is shown * on the left, secondary on the right */ - if (mui->is_portrait) + if (mui->flags & MUI_FLAG_IS_PORTRAIT) { /* Thumbnail bounding box width is fixed */ thumbnail_box_width = view_width - (int)(mui->margin * 4); @@ -6595,10 +6614,10 @@ static void materialui_render_fullscreen_thumbnails( } /* Sanity check */ - if ((view_width < 1) || - (view_height < 1) || - (thumbnail_box_width < 1) || - (thumbnail_box_height < 1)) + if ( (view_width < 1) + || (view_height < 1) + || (thumbnail_box_width < 1) + || (thumbnail_box_height < 1)) goto error; /* Get thumbnail draw dimensions @@ -6616,8 +6635,8 @@ static void materialui_render_fullscreen_thumbnails( &primary_thumbnail_draw_width, &primary_thumbnail_draw_height); /* Sanity check */ - if ((primary_thumbnail_draw_width <= 0.0f) || - (primary_thumbnail_draw_height <= 0.0f)) + if ( (primary_thumbnail_draw_width <= 0.0f) + || (primary_thumbnail_draw_height <= 0.0f)) goto error; } @@ -6626,11 +6645,12 @@ static void materialui_render_fullscreen_thumbnails( gfx_thumbnail_get_draw_dimensions( secondary_thumbnail, thumbnail_box_width, thumbnail_box_height, 1.0f, - &secondary_thumbnail_draw_width, &secondary_thumbnail_draw_height); + &secondary_thumbnail_draw_width, + &secondary_thumbnail_draw_height); /* Sanity check */ - if ((secondary_thumbnail_draw_width <= 0.0f) || - (secondary_thumbnail_draw_height <= 0.0f)) + if ( (secondary_thumbnail_draw_width <= 0.0f) + || (secondary_thumbnail_draw_height <= 0.0f)) goto error; } @@ -6639,7 +6659,7 @@ static void materialui_render_fullscreen_thumbnails( * draw dimensions...) */ if (num_thumbnails == 2) { - if (mui->is_portrait) + if (mui->flags & MUI_FLAG_IS_PORTRAIT) { int primary_padding = (thumbnail_box_height - (int)primary_thumbnail_draw_height) >> 1; int secondary_padding = (thumbnail_box_height - (int)secondary_thumbnail_draw_height) >> 1; @@ -6669,7 +6689,8 @@ static void materialui_render_fullscreen_thumbnails( mui->colors.screen_fade_opacity * mui->fullscreen_thumbnail_alpha); gfx_display_set_alpha( - mui->colors.surface_background, mui->fullscreen_thumbnail_alpha); + mui->colors.surface_background, + mui->fullscreen_thumbnail_alpha); /* Darken background */ gfx_display_draw_quad( @@ -6765,7 +6786,7 @@ static void materialui_render_fullscreen_thumbnails( error: /* If fullscreen thumbnails are enabled at * this point, must disable them immediately... */ - if (mui->show_fullscreen_thumbnails) + if (mui->flags & MUI_FLAG_SHOW_FULLSCREEN_THUMBNAILS) materialui_hide_fullscreen_thumbnails(mui, false); } @@ -6826,7 +6847,7 @@ static void materialui_colors_set_transition_alpha(materialui_handle_t *mui) /* Selection marker shadow only fades if * it is enabled (i.e. content running + * semi-transparent background) */ - if (mui->show_selection_marker_shadow) + if (mui->flags & MUI_FLAG_SHOW_SELECTION_MARKER_SHADOW) { float selection_marker_shadow_alpha = mui->colors.selection_marker_shadow_opacity * alpha; @@ -6880,7 +6901,7 @@ static void materialui_colors_reset_transition_alpha(materialui_handle_t *mui) * currently viewing a playlist 'desktop'-layout */ if (mui->list_view_type == MUI_LIST_VIEW_PLAYLIST_THUMB_DESKTOP) { - float status_bar_shadow_alpha = + float status_bar_shadow_alpha = mui->colors.status_bar_shadow_opacity; gfx_display_set_alpha(mui->colors.side_bar_background, 1.0f); @@ -6893,9 +6914,9 @@ static void materialui_colors_reset_transition_alpha(materialui_handle_t *mui) /* Selection marker shadow only fades if * it is enabled (i.e. content running + * semi-transparent background) */ - if (mui->show_selection_marker_shadow) + if (mui->flags & MUI_FLAG_SHOW_SELECTION_MARKER_SHADOW) { - float selection_marker_shadow_alpha = + float selection_marker_shadow_alpha = mui->colors.selection_marker_shadow_opacity; mui->colors.selection_marker_shadow_top[11] = selection_marker_shadow_alpha; @@ -6965,7 +6986,7 @@ static void materialui_frame(void *data, video_frame_info_t *video_info) /* If menu screensaver is active, draw * screensaver and return */ - if (mui->show_screensaver) + if (mui->flags & MUI_FLAG_SHOW_SCREENSAVER) { menu_screensaver_frame(mui->screensaver, video_info, p_disp); @@ -6997,12 +7018,11 @@ static void materialui_frame(void *data, video_frame_info_t *video_info) } /* Update line ticker(s) */ - mui->use_smooth_ticker = menu_ticker_smooth; - - if (mui->use_smooth_ticker) + if (menu_ticker_smooth) { mui->ticker_smooth.idx = p_anim->ticker_pixel_idx; mui->ticker_smooth.type_enum = menu_ticker_type; + mui->flags |= MUI_FLAG_USE_SMOOTH_TICKER; } else { @@ -7014,8 +7034,10 @@ static void materialui_frame(void *data, video_frame_info_t *video_info) * should be drawn * > Improves selection marker visibility when * running with a transparent background */ - mui->show_selection_marker_shadow = libretro_running && - (menu_framebuffer_opacity < 1.0f); + if (libretro_running && (menu_framebuffer_opacity < 1.0f)) + mui->flags |= MUI_FLAG_SHOW_SELECTION_MARKER_SHADOW; + else + mui->flags &= ~MUI_FLAG_SHOW_SELECTION_MARKER_SHADOW; /* Handle any transparency adjustments required * by menu transition animations */ @@ -7180,7 +7202,8 @@ static void materialui_frame(void *data, video_frame_info_t *video_info) } /* Draw mouse cursor */ - if (mui->show_mouse && (mui->pointer.type != MENU_POINTER_DISABLED)) + if ( (mui->flags & MUI_FLAG_SHOW_MOUSE) + && (mui->pointer.type != MENU_POINTER_DISABLED)) { float color_white[16] = { 1.0f, 1.0f, 1.0f, 1.0f, @@ -7227,13 +7250,13 @@ static void materialui_set_list_view_type( unsigned thumbnail_view_portrait, unsigned thumbnail_view_landscape) { - if (!mui->is_playlist) + if (!(mui->flags & MUI_FLAG_IS_PLAYLIST)) { /* This is not a playlist - set default list * view and register that primary thumbnail * is disabled */ - mui->list_view_type = MUI_LIST_VIEW_DEFAULT; - mui->primary_thumbnail_available = false; + mui->list_view_type = MUI_LIST_VIEW_DEFAULT; + mui->flags &= ~MUI_FLAG_PRIMARY_THUMBNAIL_AVAILABLE; } else { @@ -7242,14 +7265,13 @@ static void materialui_set_list_view_type( mui->list_view_type = MUI_LIST_VIEW_PLAYLIST; /* Check whether primary thumbnail is enabled */ - mui->primary_thumbnail_available = - gfx_thumbnail_is_enabled(mui->thumbnail_path_data, GFX_THUMBNAIL_RIGHT); - - if (mui->primary_thumbnail_available) + if (gfx_thumbnail_is_enabled(mui->thumbnail_path_data, + GFX_THUMBNAIL_RIGHT)) { + mui->flags |= MUI_FLAG_PRIMARY_THUMBNAIL_AVAILABLE; /* Get thumbnail view mode based on current * display orientation */ - if (mui->is_portrait) + if (mui->flags & MUI_FLAG_IS_PORTRAIT) { switch (thumbnail_view_portrait) { @@ -7352,7 +7374,7 @@ static void materialui_set_landscape_optimisations_enable( mui->landscape_optimization.entry_margin = 0; /* Early out if current orientation is portrait */ - if (mui->is_portrait) + if (mui->flags & MUI_FLAG_IS_PORTRAIT) return; /* Check whether optimisations are enabled, globally @@ -7696,7 +7718,7 @@ static void materialui_set_secondary_thumbnail_enable( settings->bools.menu_materialui_dual_thumbnail_list_view_enable; /* Disable by default */ - mui->secondary_thumbnail_enabled = false; + mui->flags &= ~MUI_FLAG_SECONDARY_THUMBNAIL_ENABLED; /* Check whether user has manually disabled * secondary thumbnails */ @@ -7719,7 +7741,7 @@ static void materialui_set_secondary_thumbnail_enable( /* > Account for additional padding (margins) when * using portrait orientations */ - if (mui->is_portrait) + if (mui->flags & MUI_FLAG_IS_PORTRAIT) thumbnail_margin = (int)mui->scrollbar.width; /* > Account for additional padding (margins) when * using landscape orientations */ @@ -7733,27 +7755,29 @@ static void materialui_set_secondary_thumbnail_enable( /* > A secondary thumbnail may only be drawn * if the remaining (text) width is greater * than twice the thumbnail width */ - mui->secondary_thumbnail_enabled = - usable_width > (int)(mui->thumbnail_width_max * 2); + if (usable_width > (int)(mui->thumbnail_width_max * 2)) + mui->flags |= MUI_FLAG_SECONDARY_THUMBNAIL_ENABLED; + else + mui->flags &= ~MUI_FLAG_SECONDARY_THUMBNAIL_ENABLED; } break; case MUI_LIST_VIEW_PLAYLIST_THUMB_DUAL_ICON: case MUI_LIST_VIEW_PLAYLIST_THUMB_DESKTOP: /* List view requires secondary thumbnails * > Attempt to force enable, but set - * mui->secondary_thumbnail_enabled to 'true' + * MUI_FLAG_SECONDARY_THUMBNAIL_ENABLED to 'true' * regardless of the result since we still * want 'missing thumbnail' images if * thumbnails are actively disabled via * a per-playlist override */ materialui_force_enable_secondary_thumbnail(mui, settings); - mui->secondary_thumbnail_enabled = true; + mui->flags |= MUI_FLAG_SECONDARY_THUMBNAIL_ENABLED; break; case MUI_LIST_VIEW_PLAYLIST: case MUI_LIST_VIEW_DEFAULT: default: /* List view has no thumbnails */ - mui->secondary_thumbnail_enabled = false; + mui->flags &= ~MUI_FLAG_SECONDARY_THUMBNAIL_ENABLED; break; } } @@ -7790,7 +7814,7 @@ static void materialui_update_list_view(materialui_handle_t *mui, settings_t *se /* List view configuration complete - signal * that entry dimensions must be recalculated */ - mui->need_compute = true; + mui->flags |= MUI_FLAG_NEED_COMPUTE; } static void materialui_init_font( @@ -7890,7 +7914,10 @@ static void materialui_layout( int hint_font_size; unsigned new_header_height; - mui->is_portrait = mui->last_height >= mui->last_width; + if (mui->last_height >= mui->last_width) + mui->flags |= MUI_FLAG_IS_PORTRAIT; + else + mui->flags &= ~MUI_FLAG_IS_PORTRAIT; mui->cursor_size = mui->dip_base_unit_size / 3; @@ -7936,13 +7963,14 @@ static void materialui_layout( mui->nav_bar.divider_width = mui->entry_divider_width; mui->nav_bar.selection_marker_width = mui->nav_bar.width / 16; - if (!mui->last_show_nav_bar) + if (!(mui->flags & MUI_FLAG_LAST_SHOW_NAVBAR)) { mui->nav_bar.location = MUI_NAV_BAR_LOCATION_HIDDEN; mui->nav_bar_layout_width = 0; mui->nav_bar_layout_height = 0; } - else if (!mui->is_portrait && mui->last_auto_rotate_nav_bar) + else if ((!(mui->flags & MUI_FLAG_IS_PORTRAIT)) + && (mui->flags & MUI_FLAG_LAST_AUTO_ROTATE_NAVBAR)) { mui->nav_bar.location = MUI_NAV_BAR_LOCATION_RIGHT; mui->nav_bar_layout_width = mui->nav_bar.width; @@ -7971,7 +7999,7 @@ static void materialui_layout( materialui_update_list_view(mui, settings); - mui->need_compute = true; + mui->flags |= MUI_FLAG_NEED_COMPUTE; } static void materialui_init_nav_bar(materialui_handle_t *mui) @@ -8067,19 +8095,11 @@ static void *materialui_init(void **userdata, bool video_is_threaded) mui->dip_base_unit_size = mui->last_scale_factor * MUI_DIP_BASE_UNIT_SIZE; - mui->last_show_nav_bar = settings->bools.menu_materialui_show_nav_bar; - mui->last_auto_rotate_nav_bar = settings->bools.menu_materialui_auto_rotate_nav_bar; - - mui->show_mouse = false; - mui->show_screensaver = false; - - mui->need_compute = false; - mui->is_playlist_tab = false; - mui->is_playlist = false; - mui->is_file_list = false; - mui->is_dropdown_list = false; - mui->is_core_updater_list = false; - mui->menu_stack_flushed = false; + if (settings->bools.menu_materialui_show_nav_bar) + mui->flags |= MUI_FLAG_LAST_SHOW_NAVBAR; + if (settings->bools.menu_materialui_auto_rotate_nav_bar) + mui->flags |= MUI_FLAG_LAST_AUTO_ROTATE_NAVBAR; + mui->flags = 0; mui->first_onscreen_entry = 0; mui->last_onscreen_entry = 0; @@ -8096,7 +8116,8 @@ static void *materialui_init(void **userdata, bool video_is_threaded) goto error; /* Initial ticker configuration */ - mui->use_smooth_ticker = settings->bools.menu_ticker_smooth; + if (settings->bools.menu_ticker_smooth) + mui->flags |= MUI_FLAG_USE_SMOOTH_TICKER; mui->ticker_smooth.font_scale = 1.0f; mui->ticker_smooth.spacer = ticker_spacer; mui->ticker_smooth.x_offset = &mui->ticker_x_offset; @@ -8107,12 +8128,10 @@ static void *materialui_init(void **userdata, bool video_is_threaded) * reset */ mui->touch_feedback_selection = 0; mui->touch_feedback_alpha = 0.0f; - mui->touch_feedback_update_selection = false; mui->transition_alpha = 1.0f; mui->transition_x_offset = 0.0f; mui->last_stack_size = 1; - mui->scroll_animation_active = false; mui->scroll_animation_selection = 0; /* Ensure message box string is empty */ @@ -8132,13 +8151,11 @@ static void *materialui_init(void **userdata, bool video_is_threaded) gfx_thumbnail_set_fade_missing(true); /* Ensure that fullscreen thumbnails are inactive */ - mui->show_fullscreen_thumbnails = false; mui->fullscreen_thumbnail_selection = 0; mui->fullscreen_thumbnail_alpha = 0.0f; mui->fullscreen_thumbnail_label[0] = '\0'; /* Ensure status bar has sane initial values */ - mui->status_bar.enabled = false; mui->status_bar.height = 0; mui->status_bar.str[0] = '\0'; mui->status_bar.runtime_fallback_str[0] = '\0'; @@ -8289,7 +8306,7 @@ static bool materialui_load_image(void *userdata, void *data, enum menu_image_ty static void materialui_scroll_animation_end(void *userdata) { materialui_handle_t *mui = (materialui_handle_t*)userdata; - mui->scroll_animation_active = false; + mui->flags &= ~MUI_FLAG_SCROLL_ANIMATION_ACTIVE; mui->scroll_animation_selection = 0; } @@ -8308,7 +8325,7 @@ static void materialui_animate_scroll( menu_input_set_pointer_y_accel(0.0f); /* Set 'animation active' flag */ - mui->scroll_animation_active = true; + mui->flags |= MUI_FLAG_SCROLL_ANIMATION_ACTIVE; mui->scroll_animation_selection = menu_navigation_get_selection(); /* Configure animation */ @@ -8495,7 +8512,7 @@ static void materialui_init_transition_animation( * bar to switch directly from low level menu * to a top level menu * - We apply a standard 'back' animation here */ - if (mui->menu_stack_flushed) + if (mui->flags & MUI_FLAG_MENU_STACK_FLUSHED) { if (transition_animation != MATERIALUI_TRANSITION_ANIM_FADE) mui->transition_x_offset = -1.0f; @@ -8571,33 +8588,41 @@ static void materialui_populate_entries( /* Check whether this is the playlists tab * (this requires special handling when * scrolling via an alphabet search) */ - mui->is_playlist_tab = string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)); + if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB))) + mui->flags |= MUI_FLAG_IS_PLAYLIST_TAB; + else + mui->flags &= ~MUI_FLAG_IS_PLAYLIST_TAB; /* Check whether this is the core updater menu * (this requires special handling when long * pressing an entry) */ - mui->is_core_updater_list = string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_CORE_UPDATER_LIST)); + if (string_is_equal(label, + msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_CORE_UPDATER_LIST))) + mui->flags |= MUI_FLAG_IS_CORE_UPDATER_LIST; + else + mui->flags &= ~MUI_FLAG_IS_CORE_UPDATER_LIST; /* Check whether we are currently viewing a playlist, * file-browser-type list or dropdown list * (each of these is regarded as a 'plain' list, * and potentially a 'long' list, with special * gesture-based navigation shortcuts) */ - mui->is_playlist = false; - mui->is_file_list = false; - mui->is_dropdown_list = false; + mui->flags &= ~(MUI_FLAG_IS_PLAYLIST + | MUI_FLAG_IS_FILE_LIST + | MUI_FLAG_IS_DROPDOWN_LIST); - mui->is_playlist = string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_PLAYLIST_LIST)) || + if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_PLAYLIST_LIST)) || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY)) || - string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_FAVORITES_LIST)); - - if (!mui->is_playlist) + string_is_equal(label, +msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_FAVORITES_LIST))) + mui->flags |= MUI_FLAG_IS_PLAYLIST; + else { /* > All of the following count as a 'file list' * Note: MENU_ENUM_LABEL_FAVORITES is always set * as the 'label' when navigating directories after * selecting load content */ - mui->is_file_list = string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_SCAN_DIRECTORY)) || + if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_SCAN_DIRECTORY)) || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_SCAN_FILE)) || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_IMAGES_LIST)) || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_MUSIC_LIST)) || @@ -8609,25 +8634,32 @@ static void materialui_populate_entries( string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_FILE_LOAD_APPEND)) || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_CORE_CHEAT_OPTIONS)) || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_INPUT_OVERLAY)) || - string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_CORE_MANAGER_LIST)); - - if (!mui->is_file_list) - mui->is_dropdown_list = string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST)) || - string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_SPECIAL)) || - string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_RESOLUTION)) || - string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_VIDEO_SHADER_PARAMETER)) || - string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_VIDEO_SHADER_PRESET_PARAMETER)) || - string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_VIDEO_SHADER_NUM_PASSES)) || - string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_PLAYLIST_DEFAULT_CORE)) || - string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_PLAYLIST_LABEL_DISPLAY_MODE)) || - string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_PLAYLIST_RIGHT_THUMBNAIL_MODE)) || - string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_PLAYLIST_LEFT_THUMBNAIL_MODE)) || - string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_PLAYLIST_SORT_MODE)) || - string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_MANUAL_CONTENT_SCAN_SYSTEM_NAME)) || - string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_MANUAL_CONTENT_SCAN_CORE_NAME)) || - string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_DISK_INDEX)) || - string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_INPUT_DESCRIPTION)) || - string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_INPUT_DESCRIPTION_KBD)); + string_is_equal(label, +msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_CORE_MANAGER_LIST))) + mui->flags |= MUI_FLAG_IS_FILE_LIST; + else + { + if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST)) || + string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_SPECIAL)) || + string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_RESOLUTION)) || + string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_VIDEO_SHADER_PARAMETER)) || + string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_VIDEO_SHADER_PRESET_PARAMETER)) || + string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_VIDEO_SHADER_NUM_PASSES)) || + string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_PLAYLIST_DEFAULT_CORE)) || + string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_PLAYLIST_LABEL_DISPLAY_MODE)) || + string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_PLAYLIST_RIGHT_THUMBNAIL_MODE)) || + string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_PLAYLIST_LEFT_THUMBNAIL_MODE)) || + string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_PLAYLIST_SORT_MODE)) || + string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_MANUAL_CONTENT_SCAN_SYSTEM_NAME)) || + string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_MANUAL_CONTENT_SCAN_CORE_NAME)) || + string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_DISK_INDEX)) || + string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_INPUT_DESCRIPTION)) || + string_is_equal(label, +msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_INPUT_DESCRIPTION_KBD))) + mui->flags |= MUI_FLAG_IS_DROPDOWN_LIST; + else + mui->flags &= ~MUI_FLAG_IS_DROPDOWN_LIST; + } } /* If this is a *valid* playlist, then cache it @@ -8636,7 +8668,7 @@ static void materialui_populate_entries( * valid if the first item is of the correct * FILE_TYPE_RPL_ENTRY type */ mui->playlist = NULL; - if (mui->is_playlist) + if (mui->flags & MUI_FLAG_IS_PLAYLIST) { file_list_t *list = menu_entries_get_selection_buf_ptr(0); size_t list_size = menu_entries_get_size(); @@ -8663,7 +8695,7 @@ static void materialui_populate_entries( * animations when switching to a new list) */ mui->touch_feedback_selection = 0; mui->touch_feedback_alpha = 0.0f; - mui->touch_feedback_update_selection = false; + mui->flags &= ~MUI_FLAG_TOUCH_FEEDBACK_UPDATE_SELECTION; /* Initialise menu transition animation */ materialui_init_transition_animation(mui, settings); @@ -8673,7 +8705,7 @@ static void materialui_populate_entries( materialui_hide_fullscreen_thumbnails(mui, false); /* Reset 'menu stack flushed' state */ - mui->menu_stack_flushed = false; + mui->flags &= ~MUI_FLAG_MENU_STACK_FLUSHED; /* At this point, the first and last on screen * entry indices are set based on the *previous* @@ -8711,9 +8743,9 @@ static void materialui_populate_entries( /* Note: mui->scroll_y position needs to be set here, * but we can't do this until materialui_compute_entries_box() - * has been called. We therefore delegate it until mui->need_compute + * has been called. We therefore delegate it until MUI_FLAG_NEED_COMPUTE * is acted upon */ - mui->need_compute = true; + mui->flags |= MUI_FLAG_NEED_COMPUTE; } /* Context reset is called on launch or when a core is launched */ @@ -8755,10 +8787,10 @@ static int materialui_environ(enum menu_environ_cb type, switch (type) { case MENU_ENVIRON_ENABLE_MOUSE_CURSOR: - mui->show_mouse = true; + mui->flags |= MUI_FLAG_SHOW_MOUSE; break; case MENU_ENVIRON_DISABLE_MOUSE_CURSOR: - mui->show_mouse = false; + mui->flags &= ~MUI_FLAG_SHOW_MOUSE; break; case MENU_ENVIRON_RESET_HORIZONTAL_LIST: { @@ -8775,7 +8807,7 @@ static int materialui_environ(enum menu_environ_cb type, /* If we are currently viewing the playlists tab, * the menu must be refreshed (since icon indices * may have changed) */ - if (mui->is_playlist_tab) + if (mui->flags & MUI_FLAG_IS_PLAYLIST_TAB) { bool refresh = false; menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); @@ -8784,10 +8816,10 @@ static int materialui_environ(enum menu_environ_cb type, } break; case MENU_ENVIRON_ENABLE_SCREENSAVER: - mui->show_screensaver = true; + mui->flags |= MUI_FLAG_SHOW_SCREENSAVER; break; case MENU_ENVIRON_DISABLE_SCREENSAVER: - mui->show_screensaver = false; + mui->flags &= ~MUI_FLAG_SHOW_SCREENSAVER; break; default: return -1; @@ -8890,7 +8922,7 @@ static int materialui_switch_tabs( /* Reset status parameters to default values * > Saves checks later */ mui->nav_bar.menu_navigation_wrapped = false; - mui->menu_stack_flushed = false; + mui->flags &= ~MUI_FLAG_MENU_STACK_FLUSHED; /* If target tab is NULL, interpret menu action */ if (!target_tab) @@ -8952,10 +8984,13 @@ static int materialui_switch_tabs( * AND action_content_list_switch() will cause the * menu to refresh * > For animation purposes, we therefore cannot - * register 'menu_stack_flushed' status until + * register MUI_FLAG_MENU_STACK_FLUSHED status until * AFTER action_content_list_switch() has been * called */ - mui->menu_stack_flushed = stack_flushed; + if (stack_flushed) + mui->flags |= MUI_FLAG_MENU_STACK_FLUSHED; + else + mui->flags &= ~MUI_FLAG_MENU_STACK_FLUSHED; return ret; } @@ -8967,12 +9002,13 @@ static int materialui_switch_tabs( * cycles current thumbnail view mode */ static void materialui_switch_list_view(materialui_handle_t *mui, settings_t *settings) { - bool secondary_thumbnail_enabled_prev = mui->secondary_thumbnail_enabled; + bool secondary_thumbnail_enabled_prev = mui->flags & + MUI_FLAG_SECONDARY_THUMBNAIL_ENABLED; /* Only enable view switching if we are currently viewing * a playlist with thumbnails enabled */ - if ((mui->list_view_type == MUI_LIST_VIEW_DEFAULT) || - !mui->primary_thumbnail_available) + if ( (mui->list_view_type == MUI_LIST_VIEW_DEFAULT) + || (!(mui->flags & MUI_FLAG_PRIMARY_THUMBNAIL_AVAILABLE))) return; /* If currently selected item is off screen, then @@ -8983,7 +9019,7 @@ static void materialui_switch_list_view(materialui_handle_t *mui, settings_t *se materialui_auto_select_onscreen_entry(mui, MUI_ONSCREEN_ENTRY_CENTRE); /* Update setting based upon current display orientation */ - if (mui->is_portrait) + if (mui->flags & MUI_FLAG_IS_PORTRAIT) { configuration_set_uint( settings, @@ -9016,16 +9052,17 @@ static void materialui_switch_list_view(materialui_handle_t *mui, settings_t *se * (this would happen automatically at the next * menu level change - or destroy context, etc. * - but it's cleanest to do it here) */ - if ((mui->list_view_type == MUI_LIST_VIEW_DEFAULT) || - (mui->list_view_type == MUI_LIST_VIEW_PLAYLIST) || - (secondary_thumbnail_enabled_prev && !mui->secondary_thumbnail_enabled)) + if ( (mui->list_view_type == MUI_LIST_VIEW_DEFAULT) + || (mui->list_view_type == MUI_LIST_VIEW_PLAYLIST) + || ((secondary_thumbnail_enabled_prev) + && (!(mui->flags & MUI_FLAG_SECONDARY_THUMBNAIL_ENABLED)))) materialui_reset_thumbnails(); /* We want to 'fade in' when switching views, so * trigger normal transition animation */ materialui_init_transition_animation(mui, settings); - mui->need_compute = true; + mui->flags |= MUI_FLAG_NEED_COMPUTE; } @@ -9049,7 +9086,7 @@ static enum menu_action materialui_parse_menu_entry_action( /* If fullscreen thumbnail view is active, any * valid menu action will disable it... */ - if (mui->show_fullscreen_thumbnails) + if (mui->flags & MUI_FLAG_SHOW_FULLSCREEN_THUMBNAILS) { if (action != MENU_ACTION_NOOP) { @@ -9125,7 +9162,9 @@ static enum menu_action materialui_parse_menu_entry_action( * list, left/right are used for fast navigation * > If current selection is off screen, auto select * 'middle' item */ - if (mui->is_playlist || mui->is_file_list || mui->is_dropdown_list) + if ( (mui->flags & MUI_FLAG_IS_PLAYLIST) + || (mui->flags & MUI_FLAG_IS_FILE_LIST) + || (mui->flags & MUI_FLAG_IS_DROPDOWN_LIST)) materialui_auto_select_onscreen_entry(mui, MUI_ONSCREEN_ENTRY_CENTRE); else { @@ -9145,7 +9184,7 @@ static enum menu_action materialui_parse_menu_entry_action( * > If this is the playlists tab, an alphabet * search is highly ineffective - instead, * interpret this as a 'left' scroll action */ - if (mui->is_playlist_tab) + if (mui->flags & MUI_FLAG_IS_PLAYLIST_TAB) { materialui_auto_select_onscreen_entry(mui, MUI_ONSCREEN_ENTRY_CENTRE); new_action = MENU_ACTION_LEFT; @@ -9160,7 +9199,7 @@ static enum menu_action materialui_parse_menu_entry_action( * > If this is the playlists tab, an alphabet * search is highly ineffective - instead, * interpret this as a 'right' scroll action */ - if (mui->is_playlist_tab) + if (mui->flags & MUI_FLAG_IS_PLAYLIST_TAB) { materialui_auto_select_onscreen_entry(mui, MUI_ONSCREEN_ENTRY_CENTRE); new_action = MENU_ACTION_RIGHT; @@ -9179,7 +9218,7 @@ static enum menu_action materialui_parse_menu_entry_action( { size_t selection = menu_navigation_get_selection(); - if (mui->is_playlist) + if (mui->flags & MUI_FLAG_IS_PLAYLIST) { settings_t *settings = config_get_ptr(); if (settings) @@ -9199,7 +9238,7 @@ static enum menu_action materialui_parse_menu_entry_action( { size_t selection = menu_navigation_get_selection(); - if (mui->is_playlist) + if (mui->flags & MUI_FLAG_IS_PLAYLIST) { materialui_show_fullscreen_thumbnails(mui, selection); new_action = MENU_ACTION_NOOP; @@ -9238,8 +9277,8 @@ static enum menu_action materialui_parse_menu_entry_action( { size_t selection = menu_navigation_get_selection(); - if (mui->is_playlist || - !materialui_entry_onscreen(mui, selection)) + if ( (mui->flags & MUI_FLAG_IS_PLAYLIST) + || !materialui_entry_onscreen(mui, selection)) new_action = MENU_ACTION_NOOP; } break; @@ -9653,7 +9692,7 @@ static int materialui_pointer_down(void *userdata, * has no meaning when handling touch screen input... */ mui->touch_feedback_selection = 0; mui->touch_feedback_alpha = 0.0f; - mui->touch_feedback_update_selection = true; + mui->flags |= MUI_FLAG_TOUCH_FEEDBACK_UPDATE_SELECTION; /* Enable scrollbar dragging, if required */ @@ -9663,7 +9702,8 @@ static int materialui_pointer_down(void *userdata, /* > Check if scrollbar is enabled * (note: dragging is disabled when showing * fullscreen thumbnails) */ - if (mui->scrollbar.active && !mui->show_fullscreen_thumbnails) + if ( mui->scrollbar.active + && (!(mui->flags & MUI_FLAG_SHOW_FULLSCREEN_THUMBNAILS))) { unsigned width; unsigned height; @@ -9689,7 +9729,8 @@ static int materialui_pointer_down(void *userdata, * screen width), need to increase 'grab box' size * (otherwise the active region is too close to the * navigation bar) */ - if (!mui->is_portrait && mui->last_auto_rotate_nav_bar) + if ( (!(mui->flags & MUI_FLAG_IS_PORTRAIT)) + && (mui->flags & MUI_FLAG_LAST_AUTO_ROTATE_NAVBAR)) { if (mui->landscape_optimization.border_width <= mui->margin) drag_margin_horz += (int)mui->margin; @@ -9917,7 +9958,7 @@ static int materialui_pointer_up(void *userdata, /* If fullscreen thumbnail view is enabled, * all input will disable it and otherwise * be ignored */ - if (mui->show_fullscreen_thumbnails) + if (mui->flags & MUI_FLAG_SHOW_FULLSCREEN_THUMBNAILS) { /* Must reset scroll acceleration, in case * user performed a swipe (don't want menu @@ -9946,10 +9987,13 @@ static int materialui_pointer_up(void *userdata, { /* If this is a playlist, file list or core * updater list, enable search functionality */ - if (mui->is_playlist || mui->is_file_list || mui->is_core_updater_list) + if ( (mui->flags & MUI_FLAG_IS_PLAYLIST) + || (mui->flags & MUI_FLAG_IS_FILE_LIST) + || (mui->flags & MUI_FLAG_IS_CORE_UPDATER_LIST)) { bool switch_view_enabled = - mui->is_playlist && mui->primary_thumbnail_available; + (mui->flags & MUI_FLAG_IS_PLAYLIST) + && (mui->flags & MUI_FLAG_PRIMARY_THUMBNAIL_AVAILABLE); /* Note: We add a little extra padding to minimise * the risk of accidentally triggering a cancel */ unsigned back_x_threshold = @@ -10066,7 +10110,7 @@ static int materialui_pointer_up(void *userdata, * message box for current entry. * In all other cases, perform 'reset to default' * action */ - if (mui->is_core_updater_list) + if (mui->flags & MUI_FLAG_IS_CORE_UPDATER_LIST) return materialui_menu_entry_action(mui, entry, selection, MENU_ACTION_INFO); else return materialui_menu_entry_action(mui, entry, selection, MENU_ACTION_START); @@ -10085,13 +10129,15 @@ static int materialui_pointer_up(void *userdata, return materialui_menu_entry_action(mui, entry, selection, MENU_ACTION_RIGHT); /* If we are displaying a playlist/file list/dropdown list, * swipes are used for fast navigation */ - else if (mui->is_playlist || mui->is_file_list || mui->is_dropdown_list) + else if ((mui->flags & MUI_FLAG_IS_PLAYLIST) + || (mui->flags & MUI_FLAG_IS_FILE_LIST) + || (mui->flags & MUI_FLAG_IS_DROPDOWN_LIST)) return materialui_pointer_up_swipe_horz_plain_list( mui, entry, height, header_height, y, selection, true); /* If this is the core updater list, swipes are used * to open the core information menu */ - else if (mui->is_core_updater_list) + else if (mui->flags & MUI_FLAG_IS_CORE_UPDATER_LIST) return materialui_menu_entry_action(mui, entry, selection, MENU_ACTION_START); } /* In all other cases, just perform a normal 'left' @@ -10111,13 +10157,15 @@ static int materialui_pointer_up(void *userdata, return materialui_menu_entry_action(mui, entry, selection, MENU_ACTION_LEFT); /* If we are displaying a playlist/file list/dropdown list, * swipes are used for fast navigation */ - else if (mui->is_playlist || mui->is_file_list || mui->is_dropdown_list) + else if ((mui->flags & MUI_FLAG_IS_PLAYLIST) + || (mui->flags & MUI_FLAG_IS_FILE_LIST) + || (mui->flags & MUI_FLAG_IS_DROPDOWN_LIST)) return materialui_pointer_up_swipe_horz_plain_list( mui, entry, height, header_height, y, selection, false); /* If this is the core updater list, swipes are used * to open the core information menu */ - else if (mui->is_core_updater_list) + else if (mui->flags & MUI_FLAG_IS_CORE_UPDATER_LIST) return materialui_menu_entry_action(mui, entry, selection, MENU_ACTION_START); } /* In all other cases, just perform a normal 'right' @@ -10157,7 +10205,7 @@ static void materialui_list_insert( if (!mui || !list) return; - mui->need_compute = true; + mui->flags |= MUI_FLAG_NEED_COMPUTE; node = (materialui_node_t*)list->list[i].userdata; if (!node)