(XMB) Add title margin adjustment

This commit is contained in:
sonninnos 2022-03-18 12:56:16 +02:00 committed by Autechre
parent c6e83d23f5
commit 27a6210f96
9 changed files with 68 additions and 31 deletions

View File

@ -739,6 +739,7 @@ static const bool content_show_playlists = true;
#ifdef HAVE_XMB
#define DEFAULT_XMB_ANIMATION 0
#define DEFAULT_XMB_VERTICAL_FADE_FACTOR 100
#define DEFAULT_XMB_TITLE_MARGIN 5
static const unsigned xmb_alpha_factor = 75;
static const unsigned menu_font_color_red = 255;

View File

@ -2211,6 +2211,7 @@ static struct config_uint_setting *populate_settings_uint(
SETTING_UINT("menu_font_color_blue", &settings->uints.menu_font_color_blue, true, menu_font_color_blue, false);
SETTING_UINT("menu_xmb_thumbnail_scale_factor", &settings->uints.menu_xmb_thumbnail_scale_factor, true, xmb_thumbnail_scale_factor, false);
SETTING_UINT("menu_xmb_vertical_fade_factor",&settings->uints.menu_xmb_vertical_fade_factor, true, DEFAULT_XMB_VERTICAL_FADE_FACTOR, false);
SETTING_UINT("menu_xmb_title_margin", &settings->uints.menu_xmb_title_margin, true, DEFAULT_XMB_TITLE_MARGIN, false);
#endif
SETTING_UINT("materialui_menu_color_theme", &settings->uints.menu_materialui_color_theme, true, DEFAULT_MATERIALUI_THEME, false);
SETTING_UINT("materialui_menu_transition_animation", &settings->uints.menu_materialui_transition_animation, true, DEFAULT_MATERIALUI_TRANSITION_ANIM, false);

View File

@ -278,6 +278,7 @@ typedef struct settings
unsigned menu_xmb_color_theme;
unsigned menu_xmb_thumbnail_scale_factor;
unsigned menu_xmb_vertical_fade_factor;
unsigned menu_xmb_title_margin;
unsigned menu_materialui_color_theme;
unsigned menu_materialui_transition_animation;
unsigned menu_materialui_thumbnail_view_portrait;

View File

@ -3214,6 +3214,10 @@ MSG_HASH(
MENU_ENUM_LABEL_MENU_XMB_VERTICAL_FADE_FACTOR,
"menu_xmb_vertical_fade_factor"
)
MSG_HASH(
MENU_ENUM_LABEL_MENU_XMB_TITLE_MARGIN,
"menu_xmb_title_margin"
)
MSG_HASH(
MENU_ENUM_LABEL_MENU_THUMBNAIL_UPSCALE_THRESHOLD,
"menu_thumbnail_upscale_threshold"

View File

@ -9461,6 +9461,10 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_MENU_XMB_VERTICAL_FADE_FACTOR,
"Vertical Fade Factor"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_MENU_XMB_TITLE_MARGIN,
"Title Margin"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS,
"Enable Settings Tab (Restart Required)"

View File

@ -360,6 +360,8 @@ typedef struct xmb_handle
float margins_title_left;
float margins_title_top;
float margins_title_bottom;
float margins_title;
float last_margins_title;
float margins_label_left;
float margins_label_top;
float icon_spacing_horizontal;
@ -3534,13 +3536,13 @@ static int xmb_draw_item(
/* Calculate position depending on the current
* list and if Thumbnail Vertical Disposition
* is enabled (branchless version) */
float x_position = (video_width - xmb->margins_title_left/4) *
float x_position = (video_width - xmb->margins_title_left) *
!menu_xmb_vertical_thumbnails +
(node->x + xmb->margins_screen_left +
xmb->icon_spacing_horizontal -
xmb->margins_label_left) *
menu_xmb_vertical_thumbnails;
float y_position = (video_height - xmb->margins_title_bottom/4) *
float y_position = (video_height - xmb->margins_title_bottom) *
!menu_xmb_vertical_thumbnails +
(xmb->margins_screen_top + xmb->margins_label_top +
xmb->icon_spacing_vertical * xmb->active_item_factor) *
@ -4097,9 +4099,11 @@ static void xmb_render(void *data,
scale_factor = xmb_get_scale_factor(settings, xmb->use_ps3_layout, width);
if ((xmb->use_ps3_layout != xmb->last_use_ps3_layout) ||
(scale_factor != xmb->last_scale_factor))
(xmb->margins_title != xmb->last_margins_title) ||
(scale_factor != xmb->last_scale_factor))
{
xmb->last_use_ps3_layout = xmb->use_ps3_layout;
xmb->last_margins_title = xmb->margins_title;
xmb->last_scale_factor = scale_factor;
xmb_context_reset_internal(xmb, video_driver_is_threaded(),
@ -4958,6 +4962,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
thumbnail_margin_height_full = (float)video_height - xmb->margins_title_top - ((xmb->icon_size / 4.0f) * 2.0f);
left_thumbnail_margin_x = xmb->icon_size / 6.0f;
right_thumbnail_margin_x = (float)video_width - (xmb->icon_size / 6.0f) - right_thumbnail_margin_width;
xmb->margins_title = (float)settings->uints.menu_xmb_title_margin * 10.0f;
/* Configure shadow effect */
if (xmb_shadows_enable)
@ -5270,10 +5275,11 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
if (powerstate.battery_enabled)
{
size_t x_pos = xmb->icon_size / 6;
size_t x_pos_icon = xmb->margins_title_left;
if (!xmb->assets_missing)
{
float margin_offset = -(xmb->icon_size / 2) - (7 * xmb->last_scale_factor);
if (dispctx && dispctx->blend_begin)
dispctx->blend_begin(userdata);
xmb_draw_icon(
@ -5292,8 +5298,8 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
(powerstate.percent > 20)? XMB_TEXTURE_BATTERY_40 :
XMB_TEXTURE_BATTERY_20
],
video_width - (xmb->icon_size / 2) - x_pos_icon,
xmb->icon_size,
video_width - xmb->margins_title_left + margin_offset,
xmb->icon_size + xmb->margins_title_top + margin_offset,
video_width,
video_height,
1,
@ -5321,14 +5327,14 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
{
gfx_display_ctx_datetime_t datetime;
char timedate[255];
int x_pos = 0;
size_t x_pos = 2;
if (percent_width)
x_pos = percent_width + (xmb->icon_size / 2.5);
if (!xmb->assets_missing)
{
int x_pos = 0;
if (percent_width)
x_pos = percent_width + (xmb->icon_size / 2.5);
float margin_offset = -(xmb->icon_size / 2) - (7 * xmb->last_scale_factor);
if (dispctx && dispctx->blend_begin)
dispctx->blend_begin(userdata);
@ -5341,8 +5347,8 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
xmb_shadows_enable,
xmb->icon_size,
xmb->textures.list[XMB_TEXTURE_CLOCK],
video_width - xmb->icon_size - x_pos,
xmb->icon_size,
video_width - xmb->margins_title_left + margin_offset - x_pos,
xmb->icon_size + xmb->margins_title_top + margin_offset,
video_width,
video_height,
1,
@ -5364,9 +5370,6 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
menu_display_timedate(&datetime);
if (percent_width)
x_pos = percent_width + (xmb->icon_size / 2.5);
xmb_draw_text(xmb_shadows_enable, xmb, settings, timedate,
video_width - xmb->margins_title_left - xmb->icon_size / 4 - x_pos,
xmb->margins_title_top, 1, 1, TEXT_ALIGN_RIGHT,
@ -5608,11 +5611,12 @@ static void xmb_layout_ps3(xmb_handle_t *xmb, int width)
{
unsigned new_font_size;
float scale_factor = xmb->last_scale_factor;
float margins_title = xmb->margins_title;
xmb->above_subitem_offset = 1.5;
xmb->above_item_offset = -1.0;
xmb->active_item_factor = 3.0;
xmb->under_item_offset = 5.0;
xmb->above_subitem_offset = 1.5;
xmb->above_item_offset = -1.0;
xmb->active_item_factor = 3.0;
xmb->under_item_offset = 5.0;
xmb->categories_active_zoom = 1.0;
xmb->categories_passive_zoom = 0.5;
@ -5626,8 +5630,8 @@ static void xmb_layout_ps3(xmb_handle_t *xmb, int width)
xmb->shadow_offset = 2.0;
new_font_size = 32.0 * scale_factor;
xmb->font2_size = 24.0 * scale_factor;
new_font_size = 32.0 * scale_factor;
xmb->font2_size = 24.0 * scale_factor;
xmb->cursor_size = 64.0 * scale_factor;
@ -5637,9 +5641,9 @@ static void xmb_layout_ps3(xmb_handle_t *xmb, int width)
xmb->margins_screen_top = (256+32) * scale_factor;
xmb->margins_screen_left = 336.0 * scale_factor;
xmb->margins_title_left = 60 * scale_factor;
xmb->margins_title_top = 60 * scale_factor + new_font_size / 3;
xmb->margins_title_bottom = 60 * scale_factor - new_font_size / 3;
xmb->margins_title_left = (margins_title * scale_factor) + (4 * scale_factor);
xmb->margins_title_top = (margins_title * scale_factor) + (new_font_size - (new_font_size / 6) * scale_factor);
xmb->margins_title_bottom = (margins_title * scale_factor) + (4 * scale_factor);
xmb->margins_label_left = 85.0 * scale_factor;
xmb->margins_label_top = new_font_size / 3.0;
@ -5657,6 +5661,7 @@ static void xmb_layout_psp(xmb_handle_t *xmb, int width)
{
unsigned new_font_size;
float scale_factor = xmb->last_scale_factor;
float margins_title = xmb->margins_title;
xmb->above_subitem_offset = 1.5;
xmb->above_item_offset = -1.0;
@ -5675,24 +5680,29 @@ static void xmb_layout_psp(xmb_handle_t *xmb, int width)
xmb->shadow_offset = 1.0;
new_font_size = 32.0 * scale_factor;
xmb->font2_size = 24.0 * scale_factor;
xmb->margins_screen_top = (256+32) * scale_factor;
new_font_size = 32.0 * scale_factor;
xmb->font2_size = 24.0 * scale_factor;
xmb->cursor_size = 64.0;
xmb->icon_spacing_horizontal = 250.0 * scale_factor;
xmb->icon_spacing_vertical = 108.0 * scale_factor;
xmb->margins_screen_top = (256+32) * scale_factor;
xmb->margins_screen_left = 136.0 * scale_factor;
xmb->margins_title_left = 60 * scale_factor;
xmb->margins_title_top = 60 * scale_factor + new_font_size / 3;
xmb->margins_title_bottom = 60 * scale_factor - new_font_size / 3;
xmb->margins_title_left = (margins_title * scale_factor) + (4 * scale_factor);
xmb->margins_title_top = (margins_title * scale_factor) + (new_font_size - (new_font_size / 6) * scale_factor);
xmb->margins_title_bottom = (margins_title * scale_factor) + (4 * scale_factor);
xmb->margins_label_left = 85.0 * scale_factor;
xmb->margins_label_top = new_font_size / 3.0;
xmb->margins_setting_left = 600.0 * scale_factor;
xmb->margins_dialog = 48 * scale_factor;
xmb->margins_slice = 16 * scale_factor;
xmb->icon_size = 128.0 * scale_factor;
xmb->font_size = new_font_size;
}

View File

@ -9962,6 +9962,7 @@ unsigned menu_displaylist_build_list(
{MENU_ENUM_LABEL_MENU_RGUI_PARTICLE_EFFECT_SPEED, PARSE_ONLY_FLOAT, false},
{MENU_ENUM_LABEL_MENU_RGUI_PARTICLE_EFFECT_SCREENSAVER, PARSE_ONLY_BOOL, false},
{MENU_ENUM_LABEL_MENU_XMB_VERTICAL_FADE_FACTOR, PARSE_ONLY_UINT, true},
{MENU_ENUM_LABEL_MENU_XMB_TITLE_MARGIN, PARSE_ONLY_UINT, true},
{MENU_ENUM_LABEL_XMB_ALPHA_FACTOR, PARSE_ONLY_UINT, true},
{MENU_ENUM_LABEL_XMB_FONT, PARSE_ONLY_PATH, true},
{MENU_ENUM_LABEL_MENU_FONT_COLOR_RED, PARSE_ONLY_UINT, true},

View File

@ -16175,6 +16175,20 @@ static bool setting_append_list(
menu_settings_list_current_add_range(list, list_info, 0, 500, 1, true, true);
SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_LAKKA_ADVANCED);
CONFIG_UINT(
list, list_info,
&settings->uints.menu_xmb_title_margin,
MENU_ENUM_LABEL_MENU_XMB_TITLE_MARGIN,
MENU_ENUM_LABEL_VALUE_MENU_XMB_TITLE_MARGIN,
DEFAULT_XMB_TITLE_MARGIN,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler);
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint;
menu_settings_list_current_add_range(list, list_info, 0, 12, 1, true, true);
CONFIG_PATH(
list, list_info,
settings->paths.path_menu_xmb_font,

View File

@ -1250,6 +1250,7 @@ enum msg_hash_enums
MENU_LABEL(XMB_VERTICAL_THUMBNAILS),
MENU_LABEL(MENU_XMB_THUMBNAIL_SCALE_FACTOR),
MENU_LABEL(MENU_XMB_VERTICAL_FADE_FACTOR),
MENU_LABEL(MENU_XMB_TITLE_MARGIN),
MENU_LABEL(MENU_THUMBNAIL_UPSCALE_THRESHOLD),
MENU_LABEL(MENU_RGUI_INLINE_THUMBNAILS),
MENU_LABEL(MENU_RGUI_SWAP_THUMBNAILS),