add XMB settings for scale and opacity

This commit is contained in:
radius 2016-02-08 00:34:13 -05:00
parent 14cd4af752
commit 5c4ab83d98
7 changed files with 87 additions and 28 deletions

View File

@ -508,6 +508,9 @@ static const bool overlay_hide_in_menu = true;
#ifdef HAVE_MENU
static bool default_block_config_read = true;
static unsigned xmb_scale_factor = 100;
static unsigned xmb_alpha_factor = 75;
static bool show_advanced_settings = true;
static const uint32_t menu_entry_normal_color = 0xffffffff;
static const uint32_t menu_entry_hover_color = 0xff64ff64;

View File

@ -475,6 +475,8 @@ static void config_set_defaults(void)
if (def_menu)
strlcpy(settings->menu.driver,
def_menu, sizeof(settings->menu.driver));
settings->menu.xmb_scale_factor = xmb_scale_factor;
settings->menu.xmb_alpha_factor = xmb_alpha_factor;
#endif
settings->history_list_enable = def_history_list_enable;
@ -1513,6 +1515,8 @@ static bool config_load_file(const char *path, bool set_defaults)
config_get_array(conf, "location_driver", settings->location.driver, sizeof(settings->location.driver));
#ifdef HAVE_MENU
config_get_array(conf, "menu_driver", settings->menu.driver, sizeof(settings->menu.driver));
CONFIG_GET_INT_BASE(conf, settings, menu.xmb_scale_factor, "xmb_scale_factor");
CONFIG_GET_INT_BASE(conf, settings, menu.xmb_alpha_factor, "xmb_alpha_factor");
#endif
config_get_array(conf, "video_context_driver", settings->video.context_driver, sizeof(settings->video.context_driver));
config_get_array(conf, "audio_driver", settings->audio.driver, sizeof(settings->audio.driver));
@ -2724,6 +2728,8 @@ bool config_save_file(const char *path)
*settings->playlist_directory ?
settings->playlist_directory : "default");
#ifdef HAVE_MENU
config_set_int(conf, "xmb_scale_factor", settings->menu.xmb_scale_factor);
config_set_int(conf, "xmb_alpha_factor", settings->menu.xmb_alpha_factor);
config_set_path(conf, "rgui_browser_directory",
*settings->menu_content_directory ?
settings->menu_content_directory : "default");

View File

@ -164,6 +164,9 @@ typedef struct settings
unsigned entry_normal_color;
unsigned entry_hover_color;
unsigned title_color;
unsigned xmb_scale_factor;
unsigned xmb_alpha_factor;
} menu;
#endif

View File

@ -1728,7 +1728,8 @@ static void xmb_frame(void *data)
/* set alpha components of colors */
coord_color[3] = coord_color[7] = coord_color[11] = coord_color[15] =
(0.75f > xmb->alpha) ? xmb->alpha : 0.75f;
((float)settings->menu.xmb_alpha_factor/100 > xmb->alpha) ?
xmb->alpha : (float)settings->menu.xmb_alpha_factor/100;
coord_color2[3] = coord_color2[7] = coord_color2[11] = coord_color2[15] =
xmb->alpha;
@ -1890,13 +1891,14 @@ static void xmb_layout(xmb_handle_t *xmb)
float scale_factor;
unsigned width, height, i, current, end, new_header_height;
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
settings_t *settings = config_get_ptr();
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
return;
video_driver_get_size(&width, &height);
scale_factor = width / 1920.0;
scale_factor = (settings->menu.xmb_scale_factor * width) / (1920.0 * 100);
new_font_size = 32.0 * scale_factor;
new_header_height = 128.0 * scale_factor;

View File

@ -284,6 +284,10 @@ static const char *menu_hash_to_str_us_label(uint32_t hash)
return "dpi_override_enable";
case MENU_LABEL_DPI_OVERRIDE_VALUE:
return "dpi_override_value";
case MENU_LABEL_XMB_SCALE_FACTOR:
return "xmb_scale_factor";
case MENU_LABEL_XMB_ALPHA_FACTOR:
return "xmb_alpha_factor";
case MENU_LABEL_SUSPEND_SCREENSAVER_ENABLE:
return "suspend_screensaver_enable";
case MENU_LABEL_VIDEO_DISABLE_COMPOSITION:
@ -1014,6 +1018,10 @@ const char *menu_hash_to_str_us(uint32_t hash)
return "DPI Override Enable";
case MENU_LABEL_VALUE_DPI_OVERRIDE_VALUE:
return "DPI Override";
case MENU_LABEL_VALUE_XMB_SCALE_FACTOR:
return "XMB Scale Factor";
case MENU_LABEL_VALUE_XMB_ALPHA_FACTOR:
return "XMB Alpha Factor";
case MENU_LABEL_VALUE_SUSPEND_SCREENSAVER_ENABLE:
return "Suspend Screensaver";
case MENU_LABEL_VALUE_VIDEO_DISABLE_COMPOSITION:

View File

@ -373,6 +373,10 @@ extern "C" {
#define MENU_LABEL_VALUE_DPI_OVERRIDE_ENABLE 0xd535f449U
#define MENU_LABEL_DPI_OVERRIDE_VALUE 0x543a3efdU
#define MENU_LABEL_VALUE_DPI_OVERRIDE_VALUE 0x1462aba2U
#define MENU_LABEL_XMB_SCALE_FACTOR 0x0177E8DF1
#define MENU_LABEL_VALUE_XMB_SCALE_FACTOR 0x0DCDBDB13
#define MENU_LABEL_XMB_ALPHA_FACTOR 0x01049C5CF
#define MENU_LABEL_VALUE_XMB_ALPHA_FACTOR 0x0D5A712F1
#define MENU_LABEL_VOLUME_UP 0xa66e9681U
#define MENU_LABEL_VOLUME_DOWN 0xfc64f3d4U
#define MENU_LABEL_LOG_VERBOSITY 0x6648c96dU

View File

@ -5815,6 +5815,9 @@ static bool setting_append_list_menu_options(
START_SUB_GROUP(list, list_info, "Display", &group_info, &subgroup_info, parent_group);
/* only glui uses these values, don't show them on other drivers */
if (!strcmp(settings->menu.driver,"glui"))
{
CONFIG_BOOL(
list, list_info,
&settings->menu.dpi.override_enable,
@ -5841,6 +5844,36 @@ static bool setting_append_list_menu_options(
general_write_handler,
general_read_handler);
menu_settings_list_current_add_range(list, list_info, 72, 999, 1, true, true);
}
/* only XMB uses these values, don't show them on other drivers */
if (!strcmp(settings->menu.driver,"xmb"))
{
CONFIG_UINT(
list, list_info,
&settings->menu.xmb_alpha_factor,
menu_hash_to_str(MENU_LABEL_XMB_ALPHA_FACTOR),
menu_hash_to_str(MENU_LABEL_VALUE_XMB_ALPHA_FACTOR),
xmb_alpha_factor,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler);
menu_settings_list_current_add_range(list, list_info, 0, 100, 1, true, true);
CONFIG_UINT(
list, list_info,
&settings->menu.xmb_scale_factor,
menu_hash_to_str(MENU_LABEL_XMB_SCALE_FACTOR),
menu_hash_to_str(MENU_LABEL_VALUE_XMB_SCALE_FACTOR),
xmb_scale_factor,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler);
menu_settings_list_current_add_range(list, list_info, 0, 100, 1, true, true);
}
CONFIG_BOOL(
list, list_info,