(XMB) Color + background adjustments (#15556)

* (XMB) Color + background adjustments

* (XMB) Improve font selector
This commit is contained in:
sonninnos 2023-08-06 10:17:38 +03:00 committed by GitHub
parent 796fa81909
commit f1c144ea50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 101 additions and 105 deletions

View File

@ -766,7 +766,7 @@
#define DEFAULT_XMB_TITLE_MARGIN 5
#define DEFAULT_XMB_TITLE_MARGIN_HORIZONTAL_OFFSET 0
#define MAXIMUM_XMB_TITLE_MARGIN 12
#define DEFAULT_XMB_ALPHA_FACTOR 75
#define DEFAULT_XMB_ALPHA_FACTOR 90
#define DEFAULT_MENU_FONT_COLOR_RED 255
#define DEFAULT_MENU_FONT_COLOR_GREEN 255

View File

@ -1897,7 +1897,7 @@ static void *d3d10_gfx_init(const video_info_t* video,
d3d10->device->lpVtbl->CreateBlendState(d3d10->device, &blend_desc,
&d3d10->blend_enable);
blend_desc.SrcBlend = D3D10_BLEND_ONE;
blend_desc.SrcBlend = D3D10_BLEND_DEST_COLOR;
blend_desc.DestBlend = D3D10_BLEND_ONE;
d3d10->device->lpVtbl->CreateBlendState(d3d10->device, &blend_desc,
&d3d10->blend_pipeline);

View File

@ -2512,9 +2512,10 @@ static void *d3d11_gfx_init(const video_info_t* video,
blend_desc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA;
blend_desc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
blend_desc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
d3d11->device->lpVtbl->CreateBlendState(d3d11->device, &blend_desc, &d3d11->blend_enable);
d3d11->device->lpVtbl->CreateBlendState(d3d11->device, &blend_desc,
&d3d11->blend_enable);
blend_desc.RenderTarget[0].SrcBlend = D3D11_BLEND_ONE;
blend_desc.RenderTarget[0].SrcBlend = D3D11_BLEND_DEST_COLOR;
blend_desc.RenderTarget[0].DestBlend = D3D11_BLEND_ONE;
d3d11->device->lpVtbl->CreateBlendState(d3d11->device, &blend_desc,
&d3d11->blend_pipeline);

View File

@ -2035,7 +2035,7 @@ static bool d3d12_gfx_init_pipelines(d3d12_video_t* d3d12)
D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 },
};
desc.BlendState.RenderTarget[0].SrcBlend = D3D12_BLEND_ONE;
desc.BlendState.RenderTarget[0].SrcBlend = D3D12_BLEND_DEST_COLOR;
desc.BlendState.RenderTarget[0].DestBlend = D3D12_BLEND_ONE;
desc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
desc.InputLayout.pInputElementDescs = inputElementDesc;

View File

@ -556,7 +556,7 @@ static void gfx_display_gl2_draw_pipeline(
{
case VIDEO_SHADER_MENU:
case VIDEO_SHADER_MENU_2:
glBlendFunc(GL_ONE, GL_ONE);
glBlendFunc(GL_DST_COLOR, GL_ONE);
break;
default:
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

View File

@ -240,7 +240,7 @@ static void gfx_display_gl3_draw(gfx_display_ctx_draw_t *draw,
{
case VIDEO_SHADER_MENU:
case VIDEO_SHADER_MENU_2:
glBlendFunc(GL_ONE, GL_ONE);
glBlendFunc(GL_DST_COLOR, GL_ONE);
break;
default:
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

View File

@ -2454,7 +2454,7 @@ static void vulkan_init_pipelines(vk_t *vk)
{
case 0:
case 1:
blend_attachment.srcColorBlendFactor = VK_BLEND_FACTOR_ONE;
blend_attachment.srcColorBlendFactor = VK_BLEND_FACTOR_DST_COLOR;
blend_attachment.dstColorBlendFactor = VK_BLEND_FACTOR_ONE;
break;
default:

View File

@ -11299,7 +11299,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME,
"Select a different background color gradient theme."
"Select a different background color theme."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_XMB_VERTICAL_THUMBNAILS,
@ -11462,7 +11462,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_PLAIN,
"Plain"
"Background Image"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_UNDERSEA,
@ -11668,7 +11668,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME,
"Select a different background color gradient theme."
"Select a different background color theme."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_TRANSITION_ANIMATION,

View File

@ -254,6 +254,19 @@ static int action_scan_video_font_path(const char *path,
return 0;
}
#ifdef HAVE_XMB
static int action_scan_video_xmb_font(const char *path,
const char *label, unsigned type, size_t idx)
{
settings_t *settings = config_get_ptr();
strlcpy(settings->paths.path_menu_xmb_font, "null", sizeof(settings->paths.path_menu_xmb_font));
command_event(CMD_EVENT_REINIT, NULL);
return 0;
}
#endif
static int menu_cbs_init_bind_scan_compare_type(menu_file_list_cbs_t *cbs,
unsigned type)
{
@ -312,6 +325,13 @@ int menu_cbs_init_bind_scan(menu_file_list_cbs_t *cbs,
BIND_ACTION_SCAN(cbs, action_scan_video_font_path);
return 0;
}
#ifdef HAVE_XMB
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_XMB_FONT)))
{
BIND_ACTION_SCAN(cbs, action_scan_video_xmb_font);
return 0;
}
#endif
break;
default:
case ST_NONE:

View File

@ -690,30 +690,30 @@ static float *xmb_gradient_ident(unsigned xmb_color_theme)
};
static float gradient_dark[16] = {
0.1, 0.1, 0.1, 1.00,
0.1, 0.1, 0.1, 1.00,
0.0, 0.0, 0.0, 1.00,
0.0, 0.0, 0.0, 1.00,
0.05, 0.05, 0.05, 1.00,
0.05, 0.05, 0.05, 1.00,
0.05, 0.05, 0.05, 1.00,
0.05, 0.05, 0.05, 1.00,
};
static float gradient_light[16] = {
1.0, 1.0, 1.0, 1.00,
1.0, 1.0, 1.0, 1.00,
1.0, 1.0, 1.0, 1.00,
1.0, 1.0, 1.0, 1.00,
0.5, 0.5, 0.5, 1.00,
0.5, 0.5, 0.5, 1.00,
0.5, 0.5, 0.5, 1.00,
0.5, 0.5, 0.5, 1.00,
};
static float gradient_morning_blue[16] = {
221/255.0, 241/255.0, 254/255.0, 1.00,
135/255.0, 206/255.0, 250/255.0, 1.00,
1.0, 1.0, 1.0, 1.00,
0.7, 0.7, 0.7, 1.00,
170/255.0, 200/255.0, 252/255.0, 1.00,
};
static float gradient_sunbeam[16] = {
20/255.0, 13/255.0, 20/255.0, 1.0,
30/255.0, 72/255.0, 114/255.0, 1.0,
1.0, 1.0, 1.0, 1.00,
0.7, 0.7, 0.7, 1.00,
0.1, 0.0, 0.1, 1.00,
};
@ -5055,109 +5055,78 @@ static void xmb_draw_bg(
draw.pipeline_id = 0;
draw.pipeline_active = (menu_shader_pipeline == XMB_SHADER_PIPELINE_WALLPAPER) ? false : true;
if (!video_width || !video_height)
return;
if (dispctx->blend_begin)
dispctx->blend_begin(userdata);
#ifdef HAVE_SHADERPIPELINE
if (menu_shader_pipeline > XMB_SHADER_PIPELINE_WALLPAPER
&&
(xmb_color_theme != XMB_THEME_WALLPAPER))
/* Draw background wallpaper */
if (xmb_color_theme == XMB_THEME_WALLPAPER)
{
draw.color = xmb_gradient_ident(xmb_color_theme);
if (draw.texture)
draw.color = &coord_white[0];
if (libretro_running)
gfx_display_set_alpha(draw.color, coord_black[3]);
else
gfx_display_set_alpha(draw.color, coord_white[3]);
gfx_display_set_alpha(draw.color, coord_white[3]);
gfx_display_draw_bg(p_disp, &draw, userdata, true, menu_wallpaper_opacity);
/* Draw gradient */
draw.texture = 0;
draw.x = 0;
draw.y = 0;
if (dispctx->draw)
dispctx->draw(&draw, userdata, video_width, video_height);
}
/* Draw empty color theme gradient */
else
{
draw.color = xmb_gradient_ident(xmb_color_theme);
draw.texture = 0;
gfx_display_draw_bg(p_disp, &draw, userdata, false,
menu_wallpaper_opacity);
if (draw.height > 0 && draw.width > 0)
if (dispctx->draw)
dispctx->draw(&draw, userdata, video_width, video_height);
gfx_display_set_alpha(draw.color, coord_white[3]);
gfx_display_draw_bg(p_disp, &draw, userdata, true, alpha);
draw.pipeline_id = VIDEO_SHADER_MENU_2;
if (dispctx && dispctx->draw)
dispctx->draw(&draw, userdata, video_width, video_height);
}
#ifdef HAVE_SHADERPIPELINE
/* Draw pipeline */
if (menu_shader_pipeline > XMB_SHADER_PIPELINE_WALLPAPER)
{
switch (menu_shader_pipeline)
{
default:
case XMB_SHADER_PIPELINE_WALLPAPER:
draw.pipeline_id = VIDEO_SHADER_STOCK_BLEND;
break;
case XMB_SHADER_PIPELINE_RIBBON:
draw.pipeline_id = VIDEO_SHADER_MENU;
draw.pipeline_id = VIDEO_SHADER_MENU;
break;
case XMB_SHADER_PIPELINE_SIMPLE_RIBBON:
draw.pipeline_id = VIDEO_SHADER_MENU_2;
break;
#if !defined(VITA)
case XMB_SHADER_PIPELINE_SIMPLE_SNOW:
draw.pipeline_id = VIDEO_SHADER_MENU_3;
draw.pipeline_id = VIDEO_SHADER_MENU_3;
break;
case XMB_SHADER_PIPELINE_SNOW:
draw.pipeline_id = VIDEO_SHADER_MENU_4;
draw.pipeline_id = VIDEO_SHADER_MENU_4;
break;
case XMB_SHADER_PIPELINE_BOKEH:
draw.pipeline_id = VIDEO_SHADER_MENU_5;
draw.pipeline_id = VIDEO_SHADER_MENU_5;
break;
case XMB_SHADER_PIPELINE_SNOWFLAKE:
draw.pipeline_id = VIDEO_SHADER_MENU_6;
draw.pipeline_id = VIDEO_SHADER_MENU_6;
break;
#endif
default:
break;
}
if (dispctx->draw_pipeline)
dispctx->draw_pipeline(&draw, p_disp,
userdata, video_width, video_height);
}
else
#endif
{
uintptr_t texture = draw.texture;
if (xmb_color_theme != XMB_THEME_WALLPAPER)
draw.color = xmb_gradient_ident(xmb_color_theme);
if (libretro_running)
gfx_display_set_alpha(draw.color, coord_black[3]);
else
gfx_display_set_alpha(draw.color, coord_white[3]);
if (xmb_color_theme != XMB_THEME_WALLPAPER)
{
/* Draw gradient */
draw.texture = 0;
draw.x = 0;
draw.y = 0;
gfx_display_draw_bg(p_disp, &draw, userdata, true,
menu_wallpaper_opacity);
if (draw.height > 0 && draw.width > 0)
if (dispctx && dispctx->draw)
dispctx->draw(&draw, userdata, video_width, video_height);
}
{
bool add_opacity = false;
draw.texture = texture;
gfx_display_set_alpha(draw.color, coord_white[3]);
if (draw.texture)
draw.color = &coord_white[0];
if ( libretro_running
|| xmb_color_theme == XMB_THEME_WALLPAPER)
add_opacity = true;
gfx_display_draw_bg(p_disp, &draw, userdata,
add_opacity, menu_wallpaper_opacity);
}
}
if (dispctx->draw)
if (draw.height > 0 && draw.width > 0)
if (dispctx->draw)
dispctx->draw(&draw, userdata, video_width, video_height);
}
#endif
if (dispctx->blend_end)
dispctx->blend_end(userdata);
}
@ -5767,7 +5736,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
xmb_color_theme,
menu_wallpaper_opacity,
libretro_running,
xmb->alpha,
xmb_alpha_factor / 100,
xmb->textures.bg,
xmb_coord_black,
xmb_coord_white);
@ -6451,9 +6420,9 @@ static void xmb_layout_ps3(xmb_handle_t *xmb, int width)
xmb->items_active_alpha = 1.0;
xmb->items_passive_alpha = 0.85;
xmb->shadow_offset = 2.0;
if (scale_factor < 1)
xmb->shadow_offset *= scale_factor * 1.5;
xmb->shadow_offset = 3.0 * scale_factor;
if (xmb->shadow_offset < 1.0)
xmb->shadow_offset = 1.0;
if (xmb->shadow_offset > 2.0)
xmb->shadow_offset = 2.0;
@ -6501,7 +6470,12 @@ static void xmb_layout_psp(xmb_handle_t *xmb, int width)
xmb->items_active_alpha = 1.0;
xmb->items_passive_alpha = 0.85;
xmb->shadow_offset = 1.0;
xmb->shadow_offset = 3.0 * scale_factor;
if (xmb->shadow_offset < 1.0)
xmb->shadow_offset = 1.0;
if (xmb->shadow_offset > 2.0)
xmb->shadow_offset = 2.0;
xmb->font_size = new_font_size;
xmb->font2_size = 22.0 * scale_factor;
xmb->cursor_size = 64.0;

View File

@ -15643,16 +15643,16 @@ static bool setting_append_list(
sizeof(settings->paths.path_font),
MENU_ENUM_LABEL_VIDEO_FONT_PATH,
MENU_ENUM_LABEL_VALUE_VIDEO_FONT_PATH,
"",
settings->paths.directory_assets,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler);
(*list)[list_info->index - 1].get_string_representation = &setting_get_string_representation_video_font_path;
(*list)[list_info->index - 1].ui_type = ST_UI_TYPE_FONT_SELECTOR;
MENU_SETTINGS_LIST_CURRENT_ADD_VALUES(list, list_info, "ttf");
MENU_SETTINGS_LIST_CURRENT_ADD_CMD(list, list_info, CMD_EVENT_REINIT);
(*list)[list_info->index - 1].ui_type = ST_UI_TYPE_FONT_SELECTOR;
(*list)[list_info->index - 1].get_string_representation = &setting_get_string_representation_video_font_path;
CONFIG_FLOAT(
list, list_info,
@ -17603,10 +17603,11 @@ static bool setting_append_list(
parent_group,
general_write_handler,
general_read_handler);
SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_LAKKA_ADVANCED);
MENU_SETTINGS_LIST_CURRENT_ADD_CMD(list, list_info, CMD_EVENT_REINIT);
MENU_SETTINGS_LIST_CURRENT_ADD_VALUES(list, list_info, "ttf");
(*list)[list_info->index - 1].get_string_representation = &setting_get_string_representation_video_font_path;
(*list)[list_info->index - 1].ui_type = ST_UI_TYPE_FONT_SELECTOR;
MENU_SETTINGS_LIST_CURRENT_ADD_VALUES(list, list_info, "ttf");
MENU_SETTINGS_LIST_CURRENT_ADD_CMD(list, list_info, CMD_EVENT_REINIT);
SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_LAKKA_ADVANCED);
CONFIG_UINT(
list, list_info,