mirror of
https://github.com/libretro/RetroArch
synced 2025-02-20 15:40:44 +00:00
add menu options for OSD background color
This commit is contained in:
parent
7aadb0ee13
commit
a4bc1c9768
@ -373,6 +373,12 @@ static const float message_pos_offset_y = 0.05;
|
||||
* RGB hex value. */
|
||||
static const uint32_t message_color = 0xffff00;
|
||||
|
||||
static const bool message_bgcolor_enable = false;
|
||||
static const uint32_t message_bgcolor_red = 0;
|
||||
static const uint32_t message_bgcolor_green = 0;
|
||||
static const uint32_t message_bgcolor_blue = 0;
|
||||
static const float message_bgcolor_opacity = 1.0f;
|
||||
|
||||
/* Record post-filtered (CPU filter) video,
|
||||
* rather than raw game output. */
|
||||
static const bool post_filter_record = false;
|
||||
|
@ -1293,6 +1293,8 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
|
||||
SETTING_BOOL("systemfiles_in_content_dir", &settings->bools.systemfiles_in_content_dir, true, default_systemfiles_in_content_dir, false);
|
||||
SETTING_BOOL("screenshots_in_content_dir", &settings->bools.screenshots_in_content_dir, true, default_screenshots_in_content_dir, false);
|
||||
|
||||
SETTING_BOOL("video_msg_bgcolor_enable", &settings->bools.video_msg_bgcolor_enable, true, message_bgcolor_enable, false);
|
||||
|
||||
if (global)
|
||||
{
|
||||
SETTING_BOOL("custom_bgm_enable", &global->console.sound.system_bgm_enable, true, false, false);
|
||||
@ -1331,6 +1333,7 @@ static struct config_float_setting *populate_settings_float(settings_t *settings
|
||||
SETTING_FLOAT("fastforward_ratio", &settings->floats.fastforward_ratio, true, fastforward_ratio, false);
|
||||
SETTING_FLOAT("slowmotion_ratio", &settings->floats.slowmotion_ratio, true, slowmotion_ratio, false);
|
||||
SETTING_FLOAT("input_axis_threshold", input_driver_get_float(INPUT_ACTION_AXIS_THRESHOLD), true, axis_threshold, false);
|
||||
SETTING_FLOAT("video_msg_bgcolor_opacity", &settings->floats.video_msg_bgcolor_opacity, true, message_bgcolor_opacity, false);
|
||||
|
||||
*size = count;
|
||||
|
||||
@ -1406,6 +1409,9 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings,
|
||||
SETTING_UINT("bundle_assets_extract_version_current", &settings->uints.bundle_assets_extract_version_current, true, 0, false);
|
||||
SETTING_UINT("bundle_assets_extract_last_version", &settings->uints.bundle_assets_extract_last_version, true, 0, false);
|
||||
SETTING_UINT("input_overlay_show_physical_inputs_port", &settings->uints.input_overlay_show_physical_inputs_port, true, 0, false);
|
||||
SETTING_UINT("video_msg_bgcolor_red", &settings->uints.video_msg_bgcolor_red, true, message_bgcolor_red, false);
|
||||
SETTING_UINT("video_msg_bgcolor_green", &settings->uints.video_msg_bgcolor_green, true, message_bgcolor_green, false);
|
||||
SETTING_UINT("video_msg_bgcolor_blue", &settings->uints.video_msg_bgcolor_blue, true, message_bgcolor_blue, false);
|
||||
|
||||
*size = count;
|
||||
|
||||
|
@ -83,6 +83,7 @@ typedef struct settings
|
||||
bool video_shared_context;
|
||||
bool video_force_srgb_disable;
|
||||
bool video_fps_show;
|
||||
bool video_msg_bgcolor_enable;
|
||||
|
||||
/* Audio */
|
||||
bool audio_enable;
|
||||
@ -252,6 +253,7 @@ typedef struct settings
|
||||
float video_msg_color_r;
|
||||
float video_msg_color_g;
|
||||
float video_msg_color_b;
|
||||
float video_msg_bgcolor_opacity;
|
||||
|
||||
float menu_wallpaper_opacity;
|
||||
float menu_framebuffer_opacity;
|
||||
@ -320,6 +322,9 @@ typedef struct settings
|
||||
unsigned video_viwidth;
|
||||
unsigned video_aspect_ratio_idx;
|
||||
unsigned video_rotation;
|
||||
unsigned video_msg_bgcolor_red;
|
||||
unsigned video_msg_bgcolor_green;
|
||||
unsigned video_msg_bgcolor_blue;
|
||||
|
||||
unsigned menu_thumbnails;
|
||||
unsigned menu_dpi_override_value;
|
||||
|
@ -945,23 +945,23 @@ static void gl_render_osd_background(
|
||||
gl_t *gl, video_frame_info_t *video_info,
|
||||
const char *msg)
|
||||
{
|
||||
if (!gl)
|
||||
return;
|
||||
|
||||
video_shader_ctx_mvp_t mvp;
|
||||
video_shader_ctx_coords_t coords_data;
|
||||
video_coords_t coords;
|
||||
video_coord_array_t ca;
|
||||
video_shader_ctx_info_t shader_info;
|
||||
struct uniform_info uniform_param;
|
||||
unsigned vertices_total = 6;
|
||||
float *dummy = (float*)calloc(4 * vertices_total, sizeof(float));
|
||||
const unsigned vertices_total = 6;
|
||||
float colors[4];
|
||||
float *dummy = (float*)calloc(4 * vertices_total, sizeof(float));
|
||||
float *verts = (float*)malloc(2 * vertices_total * sizeof(float));
|
||||
int msg_width;
|
||||
float x, x2, y, y2, width, height;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!gl || !settings)
|
||||
goto end;
|
||||
|
||||
msg_width = font_driver_get_message_width(NULL, msg, strlen(msg), 1.0f);
|
||||
|
||||
/* shader driver expects vertex coords as 0..1 */
|
||||
@ -978,10 +978,10 @@ static void gl_render_osd_background(
|
||||
width += x2;
|
||||
height += y2;
|
||||
|
||||
colors[0] = 0.0f;
|
||||
colors[1] = 0.0f;
|
||||
colors[2] = 1.0f;
|
||||
colors[3] = 0.5f;
|
||||
colors[0] = settings->uints.video_msg_bgcolor_red / 255.0f;
|
||||
colors[1] = settings->uints.video_msg_bgcolor_green / 255.0f;
|
||||
colors[2] = settings->uints.video_msg_bgcolor_blue / 255.0f;
|
||||
colors[3] = settings->floats.video_msg_bgcolor_opacity;
|
||||
|
||||
verts[0] = x;
|
||||
verts[1] = y; // BL
|
||||
@ -1047,7 +1047,7 @@ static void gl_render_osd_background(
|
||||
video_shader_driver_set_parameter(uniform_param);
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, coords.vertices);
|
||||
|
||||
end:
|
||||
uniform_param.result.f.v0 = 0.0f;
|
||||
uniform_param.result.f.v1 = 0.0f;
|
||||
uniform_param.result.f.v2 = 0.0f;
|
||||
@ -1188,8 +1188,9 @@ static bool gl_frame(void *data, const void *frame,
|
||||
gl_t *gl = (gl_t*)data;
|
||||
unsigned width = video_info->width;
|
||||
unsigned height = video_info->height;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!gl)
|
||||
if (!gl || !settings)
|
||||
return false;
|
||||
|
||||
context_bind_hw_render(false);
|
||||
@ -1365,7 +1366,8 @@ static bool gl_frame(void *data, const void *frame,
|
||||
|
||||
if (!string_is_empty(msg))
|
||||
{
|
||||
gl_render_osd_background(gl, video_info, msg);
|
||||
if (settings->bools.video_msg_bgcolor_enable)
|
||||
gl_render_osd_background(gl, video_info, msg);
|
||||
font_driver_render_msg(video_info, NULL, msg, NULL);
|
||||
}
|
||||
|
||||
|
@ -1343,3 +1343,13 @@ MSG_HASH(MENU_ENUM_LABEL_QUICK_MENU_SHOW_SAVE_GAME_OVERRIDES,
|
||||
"quick_menu_show_save_game_overrides")
|
||||
MSG_HASH(MENU_ENUM_LABEL_QUICK_MENU_SHOW_INFORMATION,
|
||||
"quick_menu_show_information")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_ENABLE,
|
||||
"video_msg_bgcolor_enable")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_RED,
|
||||
"video_msg_bgcolor_red")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_GREEN,
|
||||
"video_msg_bgcolor_green")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_BLUE,
|
||||
"video_msg_bgcolor_blue")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_OPACITY,
|
||||
"video_msg_bgcolor_opacity")
|
||||
|
@ -1991,6 +1991,26 @@ int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len)
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_HIDE_IN_MENU)
|
||||
);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_ENABLE:
|
||||
snprintf(s, len,
|
||||
"Enables a background color for the OSD.");
|
||||
break;
|
||||
case MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_RED:
|
||||
snprintf(s, len,
|
||||
"Sets the red value of the OSD background color. Valid values are between 0 and 255.");
|
||||
break;
|
||||
case MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_GREEN:
|
||||
snprintf(s, len,
|
||||
"Sets the green value of the OSD background color. Valid values are between 0 and 255.");
|
||||
break;
|
||||
case MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_BLUE:
|
||||
snprintf(s, len,
|
||||
"Sets the blue value of the OSD background color. Valid values are between 0 and 255.");
|
||||
break;
|
||||
case MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_OPACITY:
|
||||
snprintf(s, len,
|
||||
"Sets the opacity of the OSD background color. Valid values are between 0.0 and 1.0.");
|
||||
break;
|
||||
default:
|
||||
if (string_is_empty(s))
|
||||
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len);
|
||||
|
@ -3227,3 +3227,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_INFORMATION,
|
||||
"Show Information")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_INFORMATION,
|
||||
"Show/hide the 'Information' option.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_ENABLE,
|
||||
"Onscreen Notification Background Enable")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_RED,
|
||||
"Onscreen Notification Background Red Color")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_GREEN,
|
||||
"Onscreen Notification Background Green Color")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_BLUE,
|
||||
"Onscreen Notification Background Blue Color")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_OPACITY,
|
||||
"Onscreen Notification Background Opacity")
|
||||
|
@ -5258,6 +5258,21 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
menu_displaylist_parse_settings_enum(menu, info,
|
||||
MENU_ENUM_LABEL_VIDEO_MESSAGE_POS_Y,
|
||||
PARSE_ONLY_FLOAT, false);
|
||||
menu_displaylist_parse_settings_enum(menu, info,
|
||||
MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_ENABLE,
|
||||
PARSE_ONLY_BOOL, false);
|
||||
menu_displaylist_parse_settings_enum(menu, info,
|
||||
MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_RED,
|
||||
PARSE_ONLY_UINT, false);
|
||||
menu_displaylist_parse_settings_enum(menu, info,
|
||||
MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_GREEN,
|
||||
PARSE_ONLY_UINT, false);
|
||||
menu_displaylist_parse_settings_enum(menu, info,
|
||||
MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_BLUE,
|
||||
PARSE_ONLY_UINT, false);
|
||||
menu_displaylist_parse_settings_enum(menu, info,
|
||||
MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_OPACITY,
|
||||
PARSE_ONLY_FLOAT, false);
|
||||
|
||||
info->need_refresh = true;
|
||||
info->need_push = true;
|
||||
|
@ -4832,6 +4832,75 @@ static bool setting_append_list(
|
||||
general_read_handler);
|
||||
menu_settings_list_current_add_range(list, list_info, 0, 1, 0.01, true, true);
|
||||
|
||||
CONFIG_BOOL(
|
||||
list, list_info,
|
||||
&settings->bools.video_msg_bgcolor_enable,
|
||||
MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_ENABLE,
|
||||
MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_ENABLE,
|
||||
message_bgcolor_enable,
|
||||
MENU_ENUM_LABEL_VALUE_OFF,
|
||||
MENU_ENUM_LABEL_VALUE_ON,
|
||||
&group_info,
|
||||
&subgroup_info,
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler,
|
||||
SD_FLAG_NONE
|
||||
);
|
||||
|
||||
CONFIG_UINT(
|
||||
list, list_info,
|
||||
&settings->uints.video_msg_bgcolor_red,
|
||||
MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_RED,
|
||||
MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_RED,
|
||||
message_bgcolor_red,
|
||||
&group_info,
|
||||
&subgroup_info,
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
menu_settings_list_current_add_range(list, list_info, 0, 255, 1, true, true);
|
||||
|
||||
CONFIG_UINT(
|
||||
list, list_info,
|
||||
&settings->uints.video_msg_bgcolor_green,
|
||||
MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_GREEN,
|
||||
MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_GREEN,
|
||||
message_bgcolor_green,
|
||||
&group_info,
|
||||
&subgroup_info,
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
menu_settings_list_current_add_range(list, list_info, 0, 255, 1, true, true);
|
||||
|
||||
CONFIG_UINT(
|
||||
list, list_info,
|
||||
&settings->uints.video_msg_bgcolor_blue,
|
||||
MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_BLUE,
|
||||
MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_BLUE,
|
||||
message_bgcolor_blue,
|
||||
&group_info,
|
||||
&subgroup_info,
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
menu_settings_list_current_add_range(list, list_info, 0, 255, 1, true, true);
|
||||
|
||||
CONFIG_FLOAT(
|
||||
list, list_info,
|
||||
&settings->floats.video_msg_bgcolor_opacity,
|
||||
MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_OPACITY,
|
||||
MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_OPACITY,
|
||||
message_bgcolor_opacity,
|
||||
"%.2f",
|
||||
&group_info,
|
||||
&subgroup_info,
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
menu_settings_list_current_add_range(list, list_info, 0, 1, 0.01, true, true);
|
||||
|
||||
END_SUB_GROUP(list, list_info, parent_group);
|
||||
END_GROUP(list, list_info, parent_group);
|
||||
break;
|
||||
|
@ -625,6 +625,11 @@ enum msg_hash_enums
|
||||
MENU_LABEL(VIDEO_FONT_SIZE),
|
||||
MENU_LABEL(VIDEO_MESSAGE_POS_X),
|
||||
MENU_LABEL(VIDEO_MESSAGE_POS_Y),
|
||||
MENU_LABEL(VIDEO_MESSAGE_BGCOLOR_ENABLE),
|
||||
MENU_LABEL(VIDEO_MESSAGE_BGCOLOR_RED),
|
||||
MENU_LABEL(VIDEO_MESSAGE_BGCOLOR_GREEN),
|
||||
MENU_LABEL(VIDEO_MESSAGE_BGCOLOR_BLUE),
|
||||
MENU_LABEL(VIDEO_MESSAGE_BGCOLOR_OPACITY),
|
||||
MENU_LABEL(VIDEO_FILTER_FLICKER),
|
||||
MENU_LABEL(VIDEO_SOFT_FILTER),
|
||||
MENU_LABEL(VIDEO_MAX_SWAPCHAIN_IMAGES),
|
||||
|
@ -262,6 +262,13 @@
|
||||
# It is a regular RGB hex number, i.e. red is "ff0000".
|
||||
# video_message_color = ffffff
|
||||
|
||||
# Background color for OSD messages. Red/Green/Blue values are from 0 to 255 and opacity is 0.0 to 1.0.
|
||||
video_message_bgcolor_enable = false
|
||||
video_message_bgcolor_red = 0
|
||||
video_message_bgcolor_green = 0
|
||||
video_message_bgcolor_blue = 0
|
||||
video_message_bgcolor_opacity = 1.0
|
||||
|
||||
# Video refresh rate of your monitor.
|
||||
# Used to calculate a suitable audio input rate.
|
||||
# video_refresh_rate = 59.94
|
||||
|
Loading…
x
Reference in New Issue
Block a user