mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 16:09:47 +00:00
Add independent widget scale override settings for fullscreen/windowed modes
This commit is contained in:
parent
e10ae3dca1
commit
29f8189d0e
@ -979,8 +979,11 @@ static const unsigned playlist_entry_remove_enable = PLAYLIST_ENTRY_REMOVE_ENABL
|
||||
* automatically using the default menu scale factor */
|
||||
#define DEFAULT_MENU_WIDGET_SCALE_AUTO true
|
||||
/* Default scale factor for menu widgets when widget
|
||||
* auto scaling is disabled */
|
||||
* auto scaling is disabled (fullscreen mode) */
|
||||
#define DEFAULT_MENU_WIDGET_SCALE_FACTOR 1.0f
|
||||
/* Default scale factor for menu widgets when widget
|
||||
* auto scaling is disabled (windowed mode) */
|
||||
#define DEFAULT_MENU_WIDGET_SCALE_FACTOR_WINDOWED 1.0f
|
||||
|
||||
/* Log level for the frontend */
|
||||
#define DEFAULT_FRONTEND_LOG_LEVEL 1
|
||||
|
@ -1698,6 +1698,7 @@ static struct config_float_setting *populate_settings_float(settings_t *settings
|
||||
#ifdef HAVE_MENU
|
||||
SETTING_FLOAT("menu_scale_factor", &settings->floats.menu_scale_factor, true, DEFAULT_MENU_SCALE_FACTOR, false);
|
||||
SETTING_FLOAT("menu_widget_scale_factor", &settings->floats.menu_widget_scale_factor, true, DEFAULT_MENU_WIDGET_SCALE_FACTOR, false);
|
||||
SETTING_FLOAT("menu_widget_scale_factor_windowed", &settings->floats.menu_widget_scale_factor_windowed, true, DEFAULT_MENU_WIDGET_SCALE_FACTOR_WINDOWED, false);
|
||||
SETTING_FLOAT("menu_wallpaper_opacity", &settings->floats.menu_wallpaper_opacity, true, menu_wallpaper_opacity, false);
|
||||
SETTING_FLOAT("menu_framebuffer_opacity", &settings->floats.menu_framebuffer_opacity, true, menu_framebuffer_opacity, false);
|
||||
SETTING_FLOAT("menu_footer_opacity", &settings->floats.menu_footer_opacity, true, menu_footer_opacity, false);
|
||||
|
@ -409,6 +409,7 @@ typedef struct settings
|
||||
|
||||
float menu_scale_factor;
|
||||
float menu_widget_scale_factor;
|
||||
float menu_widget_scale_factor_windowed;
|
||||
float menu_wallpaper_opacity;
|
||||
float menu_framebuffer_opacity;
|
||||
float menu_footer_opacity;
|
||||
|
@ -391,7 +391,8 @@ float gfx_display_get_dpi_scale(unsigned width, unsigned height)
|
||||
return adjusted_scale;
|
||||
}
|
||||
|
||||
float gfx_display_get_widget_dpi_scale(unsigned width, unsigned height)
|
||||
float gfx_display_get_widget_dpi_scale(
|
||||
unsigned width, unsigned height, bool fullscreen)
|
||||
{
|
||||
static unsigned last_width = 0;
|
||||
static unsigned last_height = 0;
|
||||
@ -404,7 +405,9 @@ float gfx_display_get_widget_dpi_scale(unsigned width, unsigned height)
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool gfx_widget_scale_auto = settings->bools.menu_widget_scale_auto;
|
||||
float _menu_scale_factor = settings->floats.menu_scale_factor;
|
||||
float menu_widget_scale_factor = settings->floats.menu_widget_scale_factor;
|
||||
float menu_widget_scale_factor = fullscreen ?
|
||||
settings->floats.menu_widget_scale_factor :
|
||||
settings->floats.menu_widget_scale_factor_windowed;
|
||||
|
||||
/* When using RGUI, _menu_scale_factor
|
||||
* is ignored
|
||||
@ -446,7 +449,8 @@ float gfx_display_get_widget_dpi_scale(unsigned width, unsigned height)
|
||||
return adjusted_scale;
|
||||
}
|
||||
|
||||
float gfx_display_get_widget_pixel_scale(unsigned width, unsigned height)
|
||||
float gfx_display_get_widget_pixel_scale(
|
||||
unsigned width, unsigned height, bool fullscreen)
|
||||
{
|
||||
static unsigned last_width = 0;
|
||||
static unsigned last_height = 0;
|
||||
@ -457,9 +461,11 @@ float gfx_display_get_widget_pixel_scale(unsigned width, unsigned height)
|
||||
static enum menu_driver_id_type last_menu_driver_id = MENU_DRIVER_ID_UNKNOWN;
|
||||
static float adjusted_scale = 1.0f;
|
||||
settings_t *settings = config_get_ptr();
|
||||
float _menu_scale_factor = settings->floats.menu_scale_factor;
|
||||
float menu_widget_scale_factor = settings->floats.menu_widget_scale_factor;
|
||||
bool gfx_widget_scale_auto = settings->bools.menu_widget_scale_auto;
|
||||
float _menu_scale_factor = settings->floats.menu_scale_factor;
|
||||
float menu_widget_scale_factor = fullscreen ?
|
||||
settings->floats.menu_widget_scale_factor :
|
||||
settings->floats.menu_widget_scale_factor_windowed;
|
||||
|
||||
/* When using RGUI, _menu_scale_factor is ignored
|
||||
* > If we are not using a widget scale factor override,
|
||||
|
@ -331,9 +331,11 @@ void gfx_display_set_driver_id(enum menu_driver_id_type type);
|
||||
|
||||
float gfx_display_get_dpi_scale(unsigned width, unsigned height);
|
||||
|
||||
float gfx_display_get_widget_dpi_scale(unsigned width, unsigned height);
|
||||
float gfx_display_get_widget_dpi_scale(
|
||||
unsigned width, unsigned height, bool fullscreen);
|
||||
|
||||
float gfx_display_get_widget_pixel_scale(unsigned width, unsigned height);
|
||||
float gfx_display_get_widget_pixel_scale(
|
||||
unsigned width, unsigned height, bool fullscreen);
|
||||
|
||||
void gfx_display_allocate_white_texture(void);
|
||||
|
||||
|
@ -923,7 +923,7 @@ bool menu_driver_get_load_content_animation_data(
|
||||
#endif
|
||||
|
||||
void gfx_widgets_iterate(
|
||||
unsigned width, unsigned height,
|
||||
unsigned width, unsigned height, bool fullscreen,
|
||||
const char *dir_assets, char *font_path,
|
||||
bool is_threaded)
|
||||
{
|
||||
@ -931,9 +931,9 @@ void gfx_widgets_iterate(
|
||||
|
||||
/* Check whether screen dimensions or menu scale
|
||||
* factor have changed */
|
||||
float scale_factor = (gfx_display_get_driver_id() == MENU_DRIVER_ID_XMB)
|
||||
? gfx_display_get_widget_pixel_scale(width, height)
|
||||
: gfx_display_get_widget_dpi_scale(width, height);
|
||||
float scale_factor = (gfx_display_get_driver_id() == MENU_DRIVER_ID_XMB) ?
|
||||
gfx_display_get_widget_pixel_scale(width, height, fullscreen) :
|
||||
gfx_display_get_widget_dpi_scale(width, height, fullscreen);
|
||||
|
||||
if ((scale_factor != last_scale_factor) ||
|
||||
(width != last_video_width) ||
|
||||
@ -1933,7 +1933,7 @@ void gfx_widgets_frame(void *data)
|
||||
gfx_display_unset_viewport(video_info->width, video_info->height);
|
||||
}
|
||||
|
||||
bool gfx_widgets_init(bool video_is_threaded)
|
||||
bool gfx_widgets_init(bool video_is_threaded, bool fullscreen)
|
||||
{
|
||||
if (!gfx_display_init_first_driver(video_is_threaded))
|
||||
goto error;
|
||||
@ -1959,9 +1959,9 @@ bool gfx_widgets_init(bool video_is_threaded)
|
||||
* > XMB uses pixel based scaling - all other drivers
|
||||
* use DPI based scaling */
|
||||
video_driver_get_size(&last_video_width, &last_video_height);
|
||||
last_scale_factor = (gfx_display_get_driver_id() == MENU_DRIVER_ID_XMB)
|
||||
? gfx_display_get_widget_pixel_scale(last_video_width, last_video_height)
|
||||
: gfx_display_get_widget_dpi_scale(last_video_width, last_video_height);
|
||||
last_scale_factor = (gfx_display_get_driver_id() == MENU_DRIVER_ID_XMB) ?
|
||||
gfx_display_get_widget_pixel_scale(last_video_width, last_video_height, fullscreen) :
|
||||
gfx_display_get_widget_dpi_scale(last_video_width, last_video_height, fullscreen);
|
||||
|
||||
return true;
|
||||
|
||||
@ -2097,7 +2097,7 @@ static void gfx_widgets_layout(
|
||||
}
|
||||
|
||||
void gfx_widgets_context_reset(bool is_threaded,
|
||||
unsigned width, unsigned height,
|
||||
unsigned width, unsigned height, bool fullscreen,
|
||||
const char *dir_assets, char *font_path)
|
||||
{
|
||||
int i;
|
||||
@ -2158,9 +2158,9 @@ void gfx_widgets_context_reset(bool is_threaded,
|
||||
/* Update scaling/dimensions */
|
||||
last_video_width = width;
|
||||
last_video_height = height;
|
||||
last_scale_factor = (gfx_display_get_driver_id() == MENU_DRIVER_ID_XMB)
|
||||
? gfx_display_get_widget_pixel_scale(last_video_width, last_video_height)
|
||||
: gfx_display_get_widget_dpi_scale(last_video_width, last_video_height);
|
||||
last_scale_factor = (gfx_display_get_driver_id() == MENU_DRIVER_ID_XMB) ?
|
||||
gfx_display_get_widget_pixel_scale(last_video_width, last_video_height, fullscreen) :
|
||||
gfx_display_get_widget_dpi_scale(last_video_width, last_video_height, fullscreen);
|
||||
|
||||
gfx_widgets_layout(is_threaded, dir_assets, font_path);
|
||||
video_driver_monitor_reset();
|
||||
|
@ -40,7 +40,7 @@
|
||||
#define HOURGLASS_DURATION 1000
|
||||
#define GENERIC_MESSAGE_DURATION 3000
|
||||
|
||||
bool gfx_widgets_init(bool video_is_threaded);
|
||||
bool gfx_widgets_init(bool video_is_threaded, bool fullscreen);
|
||||
|
||||
void gfx_widgets_free(void);
|
||||
|
||||
@ -57,7 +57,7 @@ void gfx_widgets_volume_update_and_show(float new_volume,
|
||||
bool mute);
|
||||
|
||||
void gfx_widgets_iterate(
|
||||
unsigned width, unsigned height,
|
||||
unsigned width, unsigned height, bool fullscreen,
|
||||
const char *dir_assets, char *font_path,
|
||||
bool is_threaded);
|
||||
|
||||
@ -81,7 +81,7 @@ void gfx_widgets_start_load_content_animation(
|
||||
void gfx_widgets_cleanup_load_content_animation(void);
|
||||
|
||||
void gfx_widgets_context_reset(bool is_threaded,
|
||||
unsigned width, unsigned height,
|
||||
unsigned width, unsigned height, bool fullscreen,
|
||||
const char *dir_assets, char *font_path);
|
||||
|
||||
void gfx_widgets_push_achievement(const char *title, const char *badge);
|
||||
|
@ -934,11 +934,11 @@ MSG_HASH(
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_MENU_WIDGET_SCALE_FACTOR,
|
||||
"Remplacement de l'échelle des widgets graphiques"
|
||||
"Remplacement de l'échelle des widgets graphiques (plein écran)"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_MENU_WIDGET_SCALE_FACTOR,
|
||||
"Applique une valeur manuelle de remplacement du facteur d'échelle pour l'affichage des widgets graphiques. Cette valeur est appliquée uniquement si l'option 'Mise à l'échelle automatique des widgets graphiques' est désactivée. Peut être utile pour augmenter ou réduire la taille des notifications améliorées, indicateurs et commandes indépendamment du menu lui-même."
|
||||
"Applique une valeur manuelle de remplacement du facteur d'échelle pour l'affichage des widgets graphiques en mode plein écran. Cette valeur est appliquée uniquement si l'option 'Mise à l'échelle automatique des widgets graphiques' est désactivée. Peut être utile pour augmenter ou réduire la taille des notifications améliorées, indicateurs et commandes indépendamment du menu lui-même."
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_DRIVER_SETTINGS,
|
||||
|
@ -508,6 +508,8 @@ MSG_HASH(MENU_ENUM_LABEL_MENU_WIDGET_SCALE_AUTO,
|
||||
"menu_widget_scale_auto")
|
||||
MSG_HASH(MENU_ENUM_LABEL_MENU_WIDGET_SCALE_FACTOR,
|
||||
"menu_widget_scale_factor")
|
||||
MSG_HASH(MENU_ENUM_LABEL_MENU_WIDGET_SCALE_FACTOR_WINDOWED,
|
||||
"menu_widget_scale_factor_windowed")
|
||||
MSG_HASH(MENU_ENUM_LABEL_DRIVER_SETTINGS,
|
||||
"driver_settings")
|
||||
MSG_HASH(MENU_ENUM_LABEL_CHECK_FOR_MISSING_FIRMWARE,
|
||||
|
@ -934,11 +934,11 @@ MSG_HASH(
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_MENU_WIDGET_SCALE_FACTOR,
|
||||
"Substituição da escala dos widgets gráficos"
|
||||
"Substituição da escala dos widgets gráficos (tela cheia)"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_MENU_WIDGET_SCALE_FACTOR,
|
||||
"Aplica uma substituição manual da escala ao desenhar os widgets do menu. Aplica-se apenas quando 'Escala automática nos widgets gráficos' está desativado. Pode ser usado para aumentar ou diminuir o tamanho das notificações, indicadores e controles decorados independentemente do próprio menu."
|
||||
"Aplica uma substituição manual da escala ao desenhar os widgets do menu no modo de tela cheia. Aplica-se apenas quando 'Escala automática nos widgets gráficos' está desativado. Pode ser usado para aumentar ou diminuir o tamanho das notificações, indicadores e controles decorados independentemente do próprio menu."
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_DRIVER_SETTINGS,
|
||||
|
@ -938,11 +938,19 @@ MSG_HASH(
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_MENU_WIDGET_SCALE_FACTOR,
|
||||
"Graphics Widgets Scale Override"
|
||||
"Graphics Widgets Scale Override (Fullscreen)"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_MENU_WIDGET_SCALE_FACTOR,
|
||||
"Applies a manual scaling factor override when drawing menu widgets. Only applies when 'Auto Scale Graphics Widgets' is disabled. Can be used to increase or decrease the size of decorated notifications, indicators and controls independently from the menu itself."
|
||||
"Applies a manual scaling factor override when drawing menu widgets in fullscreen mode. Only applies when 'Auto Scale Graphics Widgets' is disabled. Can be used to increase or decrease the size of decorated notifications, indicators and controls independently from the menu itself."
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_MENU_WIDGET_SCALE_FACTOR_WINDOWED,
|
||||
"Graphics Widgets Scale Override (Windowed)"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_MENU_WIDGET_SCALE_FACTOR_WINDOWED,
|
||||
"Applies a manual scaling factor override when drawing menu widgets in windowed mode. Only applies when 'Auto Scale Graphics Widgets' is disabled. Can be used to increase or decrease the size of decorated notifications, indicators and controls independently from the menu itself."
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_DRIVER_SETTINGS,
|
||||
|
@ -547,6 +547,7 @@ default_sublabel_macro(action_bind_sublabel_menu_use_preferred_system_color_them
|
||||
default_sublabel_macro(action_bind_sublabel_menu_scale_factor, MENU_ENUM_SUBLABEL_MENU_SCALE_FACTOR)
|
||||
default_sublabel_macro(action_bind_sublabel_menu_widget_scale_auto, MENU_ENUM_SUBLABEL_MENU_WIDGET_SCALE_AUTO)
|
||||
default_sublabel_macro(action_bind_sublabel_menu_widget_scale_factor, MENU_ENUM_SUBLABEL_MENU_WIDGET_SCALE_FACTOR)
|
||||
default_sublabel_macro(action_bind_sublabel_menu_widget_scale_factor_windowed, MENU_ENUM_SUBLABEL_MENU_WIDGET_SCALE_FACTOR_WINDOWED)
|
||||
default_sublabel_macro(action_bind_sublabel_menu_wallpaper_opacity, MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY)
|
||||
default_sublabel_macro(action_bind_sublabel_menu_framebuffer_opacity, MENU_ENUM_SUBLABEL_MENU_FRAMEBUFFER_OPACITY)
|
||||
default_sublabel_macro(action_bind_sublabel_menu_horizontal_animation, MENU_ENUM_SUBLABEL_MENU_HORIZONTAL_ANIMATION)
|
||||
@ -1797,6 +1798,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
|
||||
case MENU_ENUM_LABEL_MENU_WIDGET_SCALE_FACTOR:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_widget_scale_factor);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_MENU_WIDGET_SCALE_FACTOR_WINDOWED:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_widget_scale_factor_windowed);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_MENU_WALLPAPER_OPACITY:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_wallpaper_opacity);
|
||||
break;
|
||||
|
@ -6595,6 +6595,7 @@ unsigned menu_displaylist_build_list(
|
||||
{MENU_ENUM_LABEL_MENU_WIDGETS_ENABLE, PARSE_ONLY_BOOL, true },
|
||||
{MENU_ENUM_LABEL_MENU_WIDGET_SCALE_AUTO, PARSE_ONLY_BOOL, false },
|
||||
{MENU_ENUM_LABEL_MENU_WIDGET_SCALE_FACTOR, PARSE_ONLY_FLOAT, false },
|
||||
{MENU_ENUM_LABEL_MENU_WIDGET_SCALE_FACTOR_WINDOWED, PARSE_ONLY_FLOAT, false },
|
||||
{MENU_ENUM_LABEL_FPS_SHOW, PARSE_ONLY_BOOL, false },
|
||||
{MENU_ENUM_LABEL_FPS_UPDATE_INTERVAL, PARSE_ONLY_UINT, false },
|
||||
{MENU_ENUM_LABEL_FRAMECOUNT_SHOW, PARSE_ONLY_BOOL, false },
|
||||
@ -6642,6 +6643,13 @@ unsigned menu_displaylist_build_list(
|
||||
if (menu_enable_widgets)
|
||||
if (!menu_widget_scale_auto)
|
||||
build_list[i].checked = true;
|
||||
#endif
|
||||
break;
|
||||
case MENU_ENUM_LABEL_MENU_WIDGET_SCALE_FACTOR_WINDOWED:
|
||||
#ifdef HAVE_GFX_WIDGETS
|
||||
if (menu_enable_widgets)
|
||||
if (!menu_widget_scale_auto)
|
||||
build_list[i].checked = true;
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
|
@ -11906,6 +11906,21 @@ static bool setting_append_list(
|
||||
general_read_handler);
|
||||
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint;
|
||||
menu_settings_list_current_add_range(list, list_info, 0.2, 5.0, 0.01, true, true);
|
||||
|
||||
CONFIG_FLOAT(
|
||||
list, list_info,
|
||||
&settings->floats.menu_widget_scale_factor_windowed,
|
||||
MENU_ENUM_LABEL_MENU_WIDGET_SCALE_FACTOR_WINDOWED,
|
||||
MENU_ENUM_LABEL_VALUE_MENU_WIDGET_SCALE_FACTOR_WINDOWED,
|
||||
DEFAULT_MENU_WIDGET_SCALE_FACTOR_WINDOWED,
|
||||
"%.2fx",
|
||||
&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.2, 5.0, 0.01, true, true);
|
||||
#endif
|
||||
|
||||
CONFIG_BOOL(
|
||||
|
@ -519,6 +519,7 @@ enum msg_hash_enums
|
||||
MENU_LABEL(MENU_SCALE_FACTOR),
|
||||
MENU_LABEL(MENU_WIDGET_SCALE_AUTO),
|
||||
MENU_LABEL(MENU_WIDGET_SCALE_FACTOR),
|
||||
MENU_LABEL(MENU_WIDGET_SCALE_FACTOR_WINDOWED),
|
||||
MENU_LABEL(MENU_WALLPAPER_OPACITY),
|
||||
MENU_LABEL(MENU_FRAMEBUFFER_OPACITY),
|
||||
MENU_LABEL(MENU_USE_PREFERRED_SYSTEM_COLOR_THEME),
|
||||
|
13
retroarch.c
13
retroarch.c
@ -25100,12 +25100,16 @@ static void drivers_init(int flags)
|
||||
if (settings->bools.menu_enable_widgets
|
||||
&& video_driver_has_widgets())
|
||||
{
|
||||
bool video_is_fullscreen = settings->bools.video_fullscreen ||
|
||||
rarch_force_fullscreen;
|
||||
|
||||
if (!gfx_widgets_inited)
|
||||
gfx_widgets_inited = gfx_widgets_init(video_is_threaded);
|
||||
gfx_widgets_inited = gfx_widgets_init(
|
||||
video_is_threaded, video_is_fullscreen);
|
||||
|
||||
if (gfx_widgets_inited)
|
||||
gfx_widgets_context_reset(video_is_threaded,
|
||||
video_driver_width, video_driver_height,
|
||||
video_driver_width, video_driver_height, video_is_fullscreen,
|
||||
settings->paths.directory_assets,
|
||||
settings->paths.path_font);
|
||||
else
|
||||
@ -29044,9 +29048,12 @@ static enum runloop_state runloop_check_state(retro_time_t current_time)
|
||||
#if defined(HAVE_GFX_WIDGETS)
|
||||
if (gfx_widgets_inited)
|
||||
{
|
||||
bool video_is_fullscreen = settings->bools.video_fullscreen ||
|
||||
rarch_force_fullscreen;
|
||||
|
||||
runloop_msg_queue_lock();
|
||||
gfx_widgets_iterate(
|
||||
video_driver_width, video_driver_height,
|
||||
video_driver_width, video_driver_height, video_is_fullscreen,
|
||||
settings->paths.directory_assets,
|
||||
settings->paths.path_font,
|
||||
video_driver_is_threaded_internal());
|
||||
|
Loading…
Reference in New Issue
Block a user