Add facility to cap maximum window size in windowed mode

This commit is contained in:
jdgleaver 2021-08-16 17:48:09 +01:00
parent 0f142d531a
commit fa7dd0f6d9
10 changed files with 289 additions and 62 deletions

View File

@ -222,16 +222,51 @@
#define DEFAULT_MONITOR_INDEX 0
/* Window */
/* Window size. A value of 0 uses window scale
* multiplied by the core framebuffer size. */
/* DEFAULT_WINDOW_DECORATIONS:
Whether to show the usual window decorations like border, titlebar etc. */
#ifdef WEBOS
#define DEFAULT_WINDOW_DECORATIONS false
#else
#define DEFAULT_WINDOW_DECORATIONS true
#endif
/* Amount of transparency to use for the main window.
* 1 is the most transparent while 100 is opaque. */
#define DEFAULT_WINDOW_OPACITY 100
/* DEFAULT_WINDOW_SAVE_POSITIONS:
* Whether to remember window positions
* NOTE: Only enabled for desktop Windows
* at present. */
#define DEFAULT_WINDOW_SAVE_POSITIONS false
/* Whether to use custom (fixed size)
* window dimensions in windowed mode. */
#ifdef WEBOS
#define DEFAULT_WINDOW_CUSTOM_SIZE_ENABLE true
#else
#define DEFAULT_WINDOW_CUSTOM_SIZE_ENABLE false
#endif
/* Window dimensions when using a fixed size
* window. A value of 0 disables fixed size
* windows, using nominal dimensions of
* window scale multiplied by the core
* framebuffer size. */
#if defined(WEBOS)
#define DEFAULT_WINDOW_WIDTH 1920
#define DEFAULT_WINDOW_WIDTH 1920
#define DEFAULT_WINDOW_HEIGHT 1080
#else
#define DEFAULT_WINDOW_WIDTH 1280
#define DEFAULT_WINDOW_WIDTH 1280
#define DEFAULT_WINDOW_HEIGHT 720
#endif
/* Maximum auto-set window dimensions
* when not using a fixed size window */
#define DEFAULT_WINDOW_AUTO_WIDTH_MAX 1920
#define DEFAULT_WINDOW_AUTO_HEIGHT_MAX 1080
/* Fullscreen resolution. A value of 0 uses the desktop
* resolution. */
#if defined(DINGUX)
@ -251,24 +286,6 @@
/* Number of threads to use for video recording */
#define DEFAULT_VIDEO_RECORD_THREADS 2
/* Amount of transparency to use for the main window.
* 1 is the most transparent while 100 is opaque.
*/
#define DEFAULT_WINDOW_OPACITY 100
/* DEFAULT_WINDOW_DECORATIONS:
Whether to show the usual window decorations like border, titlebar etc. */
/* DEFAULT_WINDOW_SAVE_POSITIONS:
Whether to remember window positions
*/
#ifdef WEBOS
#define DEFAULT_WINDOW_DECORATIONS false
#define DEFAULT_WINDOW_SAVE_POSITIONS true
#else
#define DEFAULT_WINDOW_DECORATIONS true
#define DEFAULT_WINDOW_SAVE_POSITIONS false
#endif
#if defined(RARCH_CONSOLE) || defined(__APPLE__)
#define DEFAULT_LOAD_DUMMY_ON_CORE_SHUTDOWN false
#else

View File

@ -1851,6 +1851,7 @@ static struct config_bool_setting *populate_settings_bool(
SETTING_BOOL("video_msg_bgcolor_enable", &settings->bools.video_msg_bgcolor_enable, true, message_bgcolor_enable, false);
SETTING_BOOL("video_window_show_decorations", &settings->bools.video_window_show_decorations, true, DEFAULT_WINDOW_DECORATIONS, false);
SETTING_BOOL("video_window_save_positions", &settings->bools.video_window_save_positions, true, DEFAULT_WINDOW_SAVE_POSITIONS, false);
SETTING_BOOL("video_window_custom_size_enable", &settings->bools.video_window_custom_size_enable, true, DEFAULT_WINDOW_CUSTOM_SIZE_ENABLE, false);
SETTING_BOOL("sustained_performance_mode", &settings->bools.sustained_performance_mode, true, sustained_performance_mode, false);
@ -2135,8 +2136,10 @@ static struct config_uint_setting *populate_settings_uint(
SETTING_UINT("video_stream_scale_factor", &settings->uints.video_stream_scale_factor, true, 1, false);
SETTING_UINT("video_windowed_position_x", &settings->uints.window_position_x, true, 0, false);
SETTING_UINT("video_windowed_position_y", &settings->uints.window_position_y, true, 0, false);
SETTING_UINT("video_windowed_position_width", &settings->uints.window_position_width, true, DEFAULT_WINDOW_WIDTH, false);
SETTING_UINT("video_windowed_position_height", &settings->uints.window_position_height, true, DEFAULT_WINDOW_HEIGHT, false);
SETTING_UINT("video_windowed_position_width", &settings->uints.window_position_width, true, DEFAULT_WINDOW_WIDTH, false);
SETTING_UINT("video_windowed_position_height", &settings->uints.window_position_height, true, DEFAULT_WINDOW_HEIGHT, false);
SETTING_UINT("video_window_auto_width_max", &settings->uints.window_auto_width_max, true, DEFAULT_WINDOW_AUTO_WIDTH_MAX, false);
SETTING_UINT("video_window_auto_height_max", &settings->uints.window_auto_height_max, true, DEFAULT_WINDOW_AUTO_HEIGHT_MAX, false);
SETTING_UINT("ai_service_mode", &settings->uints.ai_service_mode, true, DEFAULT_AI_SERVICE_MODE, false);
SETTING_UINT("ai_service_target_lang", &settings->uints.ai_service_target_lang, true, 0, false);
SETTING_UINT("ai_service_source_lang", &settings->uints.ai_service_source_lang, true, 0, false);

View File

@ -282,6 +282,8 @@ typedef struct settings
unsigned window_position_y;
unsigned window_position_width;
unsigned window_position_height;
unsigned window_auto_width_max;
unsigned window_auto_height_max;
unsigned video_record_threads;
@ -826,6 +828,7 @@ typedef struct settings
bool video_window_show_decorations;
bool video_window_save_positions;
bool video_window_custom_size_enable;
bool sustained_performance_mode;
bool playlist_use_old_format;

View File

@ -3528,6 +3528,14 @@ MSG_HASH(
MENU_ENUM_LABEL_VIDEO_WINDOW_HEIGHT,
"video_window_height"
)
MSG_HASH(
MENU_ENUM_LABEL_VIDEO_WINDOW_AUTO_WIDTH_MAX,
"video_window_auto_width_max"
)
MSG_HASH(
MENU_ENUM_LABEL_VIDEO_WINDOW_AUTO_HEIGHT_MAX,
"video_window_auto_height_max"
)
MSG_HASH(
MENU_ENUM_LABEL_VIDEO_FULLSCREEN_X,
"video_fullscreen_x"
@ -4174,6 +4182,10 @@ MSG_HASH(
MENU_ENUM_LABEL_VIDEO_WINDOW_SAVE_POSITION,
"video_window_save_position"
)
MSG_HASH(
MENU_ENUM_LABEL_VIDEO_WINDOW_CUSTOM_SIZE_ENABLE,
"video_window_custom_size_enable"
)
MSG_HASH(
MENU_ENUM_LABEL_MENU_RGUI_BORDER_FILLER_ENABLE,
"menu_rgui_border_filler_enable"

View File

@ -1604,7 +1604,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_WINDOW_SCALE,
"Set the window size relative to the core viewport size. Alternatively, a window width and height can be set below for a fixed window size."
"Set the window size to the specified multiple of the core viewport size."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_OPACITY,
@ -1620,7 +1620,15 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_WINDOW_SAVE_POSITION,
"Remember window size and position, enabling this has precedence over Windowed Scale."
"Show all content in a fixed size window of dimensions specified by 'Window Width' and 'Window Height', and save current window size and position upon closing RetroArch. When disabled, window size will be set dynamically based on 'Windowed Scale'."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_CUSTOM_SIZE_ENABLE,
"Use Custom Window Size"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_WINDOW_CUSTOM_SIZE_ENABLE,
"Show all content in a fixed size window of dimensions specified by 'Window Width' and 'Window Height'. When disabled, window size will be set dynamically based on 'Windowed Scale'."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_WIDTH,
@ -1638,6 +1646,22 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_WINDOW_HEIGHT,
"Set the custom height for the display window."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_AUTO_WIDTH_MAX,
"Maximum Window Width"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_WINDOW_AUTO_WIDTH_MAX,
"Set the maximum width of the display window when automatically resizing based on 'Windowed Scale'."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_AUTO_HEIGHT_MAX,
"Maximum Window Height"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_WINDOW_AUTO_HEIGHT_MAX,
"Set the maximum height of the display window when automatically resizing based on 'Windowed Scale'."
)
/* Settings > Video > Scaling */

View File

@ -435,10 +435,13 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_notification_show_screenshot_flash,
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_notification_show_refresh_rate, MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_REFRESH_RATE)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_window_width, MENU_ENUM_SUBLABEL_VIDEO_WINDOW_WIDTH)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_window_height, MENU_ENUM_SUBLABEL_VIDEO_WINDOW_HEIGHT)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_window_auto_width_max, MENU_ENUM_SUBLABEL_VIDEO_WINDOW_AUTO_WIDTH_MAX)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_window_auto_height_max, MENU_ENUM_SUBLABEL_VIDEO_WINDOW_AUTO_HEIGHT_MAX)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_fullscreen_x, MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_X)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_fullscreen_y, MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_Y)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_force_resolution, MENU_ENUM_SUBLABEL_VIDEO_FORCE_RESOLUTION)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_save_window_position, MENU_ENUM_SUBLABEL_VIDEO_WINDOW_SAVE_POSITION)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_window_custom_size_enable, MENU_ENUM_SUBLABEL_VIDEO_WINDOW_CUSTOM_SIZE_ENABLE)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_message_pos_x, MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_X)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_message_pos_y, MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_Y)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_font_size, MENU_ENUM_SUBLABEL_VIDEO_FONT_SIZE)
@ -3374,6 +3377,12 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_VIDEO_WINDOW_HEIGHT:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_window_height);
break;
case MENU_ENUM_LABEL_VIDEO_WINDOW_AUTO_WIDTH_MAX:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_window_auto_width_max);
break;
case MENU_ENUM_LABEL_VIDEO_WINDOW_AUTO_HEIGHT_MAX:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_window_auto_height_max);
break;
case MENU_ENUM_LABEL_VIDEO_FULLSCREEN_X:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_fullscreen_x);
break;
@ -3386,6 +3395,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_VIDEO_WINDOW_SAVE_POSITION:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_save_window_position);
break;
case MENU_ENUM_LABEL_VIDEO_WINDOW_CUSTOM_SIZE_ENABLE:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_window_custom_size_enable);
break;
case MENU_ENUM_LABEL_QUIT_RETROARCH:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_quit_retroarch);
break;

View File

@ -7682,30 +7682,61 @@ unsigned menu_displaylist_build_list(
}
break;
case DISPLAYLIST_VIDEO_WINDOWED_MODE_SETTINGS_LIST:
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
MENU_ENUM_LABEL_VIDEO_SCALE,
PARSE_ONLY_FLOAT, false) == 0)
count++;
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
MENU_ENUM_LABEL_VIDEO_WINDOW_OPACITY,
PARSE_ONLY_UINT, false) == 0)
count++;
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
MENU_ENUM_LABEL_VIDEO_WINDOW_SHOW_DECORATIONS,
PARSE_ONLY_BOOL, false) == 0)
count++;
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
MENU_ENUM_LABEL_VIDEO_WINDOW_SAVE_POSITION,
PARSE_ONLY_BOOL, false) == 0)
count++;
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
MENU_ENUM_LABEL_VIDEO_WINDOW_WIDTH,
PARSE_ONLY_UINT, false) == 0)
count++;
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
MENU_ENUM_LABEL_VIDEO_WINDOW_HEIGHT,
PARSE_ONLY_UINT, false) == 0)
count++;
{
#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__)
bool window_custom_size_enable = settings->bools.video_window_save_positions;
#else
bool window_custom_size_enable = settings->bools.video_window_custom_size_enable;
#endif
menu_displaylist_build_info_selective_t build_list[] = {
#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__)
{MENU_ENUM_LABEL_VIDEO_WINDOW_SAVE_POSITION, PARSE_ONLY_BOOL, true },
#else
{MENU_ENUM_LABEL_VIDEO_WINDOW_CUSTOM_SIZE_ENABLE, PARSE_ONLY_BOOL, true },
#endif
{MENU_ENUM_LABEL_VIDEO_SCALE, PARSE_ONLY_FLOAT, false},
{MENU_ENUM_LABEL_VIDEO_WINDOW_WIDTH, PARSE_ONLY_UINT, false},
{MENU_ENUM_LABEL_VIDEO_WINDOW_HEIGHT, PARSE_ONLY_UINT, false},
{MENU_ENUM_LABEL_VIDEO_WINDOW_AUTO_WIDTH_MAX, PARSE_ONLY_UINT, false},
{MENU_ENUM_LABEL_VIDEO_WINDOW_AUTO_HEIGHT_MAX, PARSE_ONLY_UINT, false},
{MENU_ENUM_LABEL_VIDEO_WINDOW_OPACITY, PARSE_ONLY_UINT, true },
{MENU_ENUM_LABEL_VIDEO_WINDOW_SHOW_DECORATIONS, PARSE_ONLY_BOOL, true },
};
for (i = 0; i < ARRAY_SIZE(build_list); i++)
{
switch (build_list[i].enum_idx)
{
case MENU_ENUM_LABEL_VIDEO_SCALE:
if (!window_custom_size_enable)
build_list[i].checked = true;
break;
case MENU_ENUM_LABEL_VIDEO_WINDOW_WIDTH:
case MENU_ENUM_LABEL_VIDEO_WINDOW_HEIGHT:
if (window_custom_size_enable)
build_list[i].checked = true;
break;
case MENU_ENUM_LABEL_VIDEO_WINDOW_AUTO_WIDTH_MAX:
case MENU_ENUM_LABEL_VIDEO_WINDOW_AUTO_HEIGHT_MAX:
if (!window_custom_size_enable)
build_list[i].checked = true;
break;
default:
break;
}
}
for (i = 0; i < ARRAY_SIZE(build_list); i++)
{
if (!build_list[i].checked && !include_everything)
continue;
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
build_list[i].enum_idx, build_list[i].parse_type,
false) == 0)
count++;
}
}
break;
case DISPLAYLIST_VIDEO_FULLSCREEN_MODE_SETTINGS_LIST:
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,

View File

@ -11355,6 +11355,7 @@ static bool setting_append_list(
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint;
menu_settings_list_current_add_range(list, list_info, 1.0, 10.0, 1.0, true, true);
SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_LAKKA_ADVANCED);
CONFIG_UINT(
list, list_info,
&settings->uints.window_position_width,
@ -11369,6 +11370,7 @@ static bool setting_append_list(
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint_special;
menu_settings_list_current_add_range(list, list_info, 0, 7680, 8, true, true);
SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_LAKKA_ADVANCED);
CONFIG_UINT(
list, list_info,
&settings->uints.window_position_height,
@ -11383,6 +11385,37 @@ static bool setting_append_list(
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint_special;
menu_settings_list_current_add_range(list, list_info, 0, 4320, 8, true, true);
SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_LAKKA_ADVANCED);
CONFIG_UINT(
list, list_info,
&settings->uints.window_auto_width_max,
MENU_ENUM_LABEL_VIDEO_WINDOW_AUTO_WIDTH_MAX,
MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_AUTO_WIDTH_MAX,
DEFAULT_WINDOW_AUTO_WIDTH_MAX,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler);
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint_special;
menu_settings_list_current_add_range(list, list_info, 0, 7680, 8, true, true);
SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_LAKKA_ADVANCED);
CONFIG_UINT(
list, list_info,
&settings->uints.window_auto_height_max,
MENU_ENUM_LABEL_VIDEO_WINDOW_AUTO_HEIGHT_MAX,
MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_AUTO_HEIGHT_MAX,
DEFAULT_WINDOW_AUTO_HEIGHT_MAX,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler);
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint_special;
menu_settings_list_current_add_range(list, list_info, 0, 4320, 8, true, true);
SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_LAKKA_ADVANCED);
CONFIG_UINT(
list, list_info,
&settings->uints.video_window_opacity,
@ -11416,12 +11449,13 @@ static bool setting_append_list(
SD_FLAG_NONE);
MENU_SETTINGS_LIST_CURRENT_ADD_CMD(list, list_info, CMD_EVENT_REINIT);
#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__)
CONFIG_BOOL(
list, list_info,
&settings->bools.video_window_save_positions,
MENU_ENUM_LABEL_VIDEO_WINDOW_SAVE_POSITION,
MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SAVE_POSITION,
false,
DEFAULT_WINDOW_SAVE_POSITIONS,
MENU_ENUM_LABEL_VALUE_OFF,
MENU_ENUM_LABEL_VALUE_ON,
&group_info,
@ -11430,7 +11464,30 @@ static bool setting_append_list(
general_write_handler,
general_read_handler,
SD_FLAG_NONE);
(*list)[list_info->index - 1].action_ok = setting_bool_action_left_with_refresh;
(*list)[list_info->index - 1].action_left = setting_bool_action_left_with_refresh;
(*list)[list_info->index - 1].action_right = setting_bool_action_right_with_refresh;
MENU_SETTINGS_LIST_CURRENT_ADD_CMD(list, list_info, CMD_EVENT_REINIT);
#else
CONFIG_BOOL(
list, list_info,
&settings->bools.video_window_custom_size_enable,
MENU_ENUM_LABEL_VIDEO_WINDOW_CUSTOM_SIZE_ENABLE,
MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_CUSTOM_SIZE_ENABLE,
DEFAULT_WINDOW_CUSTOM_SIZE_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);
(*list)[list_info->index - 1].action_ok = setting_bool_action_left_with_refresh;
(*list)[list_info->index - 1].action_left = setting_bool_action_left_with_refresh;
(*list)[list_info->index - 1].action_right = setting_bool_action_right_with_refresh;
MENU_SETTINGS_LIST_CURRENT_ADD_CMD(list, list_info, CMD_EVENT_REINIT);
#endif
CONFIG_BOOL(
list, list_info,
&settings->bools.video_scale_integer,

View File

@ -1054,6 +1054,8 @@ enum msg_hash_enums
MENU_LABEL(VIDEO_WINDOWED_FULLSCREEN),
MENU_LABEL(VIDEO_WINDOW_WIDTH),
MENU_LABEL(VIDEO_WINDOW_HEIGHT),
MENU_LABEL(VIDEO_WINDOW_AUTO_WIDTH_MAX),
MENU_LABEL(VIDEO_WINDOW_AUTO_HEIGHT_MAX),
MENU_LABEL(VIDEO_WINDOW_OPACITY),
MENU_LABEL(VIDEO_FULLSCREEN_X),
MENU_LABEL(VIDEO_FULLSCREEN_Y),
@ -2837,6 +2839,7 @@ enum msg_hash_enums
MENU_LABEL(NETPLAY_MITM_SERVER),
MENU_LABEL(VIDEO_WINDOW_SHOW_DECORATIONS),
MENU_LABEL(VIDEO_WINDOW_SAVE_POSITION),
MENU_LABEL(VIDEO_WINDOW_CUSTOM_SIZE_ENABLE),
MENU_ENUM_LABEL_VALUE_QT_INFO,
MENU_ENUM_LABEL_VALUE_QT_MENU_FILE,

View File

@ -30105,17 +30105,23 @@ static bool video_driver_init_internal(
aspectratio_lut[new_aspect_idx].value);
}
if (settings->bools.video_fullscreen|| p_rarch->rarch_force_fullscreen)
if (settings->bools.video_fullscreen || p_rarch->rarch_force_fullscreen)
{
width = settings->uints.video_fullscreen_x;
height = settings->uints.video_fullscreen_y;
}
else
{
#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__)
bool window_custom_size_enable = settings->bools.video_window_save_positions;
#else
bool window_custom_size_enable = settings->bools.video_window_custom_size_enable;
#endif
/* TODO: remove when the new window resizing core is hooked */
if (settings->bools.video_window_save_positions &&
(settings->uints.window_position_width ||
settings->uints.window_position_height))
if (window_custom_size_enable &&
settings->uints.window_position_width &&
settings->uints.window_position_height)
{
width = settings->uints.window_position_width;
height = settings->uints.window_position_height;
@ -30123,16 +30129,75 @@ static bool video_driver_init_internal(
else
{
float video_scale = settings->floats.video_scale;
unsigned max_win_width;
unsigned max_win_height;
/* Determine maximum allowed window dimensions
* NOTE: We cannot read the actual display
* metrics here, because the context driver
* has not yet been initialised... */
/* > Try explicitly configured values */
max_win_width = settings->uints.window_auto_width_max;
max_win_height = settings->uints.window_auto_height_max;
/* > Handle invalid settings */
if ((max_win_width == 0) || (max_win_height == 0))
{
/* > Try configured fullscreen width/height */
max_win_width = settings->uints.video_fullscreen_x;
max_win_height = settings->uints.video_fullscreen_y;
if ((max_win_width == 0) || (max_win_height == 0))
{
/* Maximum window width/size *must* be non-zero;
* if all else fails, used defined default
* maximum window size */
max_win_width = DEFAULT_WINDOW_AUTO_WIDTH_MAX;
max_win_height = DEFAULT_WINDOW_AUTO_HEIGHT_MAX;
}
}
/* Determine nominal window size based on
* core geometry */
if (settings->bools.video_force_aspect)
{
/* Do rounding here to simplify integer scale correctness. */
unsigned base_width =
roundf(geom->base_height * p_rarch->video_driver_aspect_ratio);
width = roundf(base_width * video_scale);
/* Do rounding here to simplify integer
* scale correctness. */
unsigned base_width = roundf(geom->base_height *
p_rarch->video_driver_aspect_ratio);
width = roundf(base_width * video_scale);
}
else
width = roundf(geom->base_width * video_scale);
height = roundf(geom->base_height * video_scale);
width = roundf(geom->base_width * video_scale);
height = roundf(geom->base_height * video_scale);
/* Cap window size to maximum allowed values */
if ((width > max_win_width) || (height > max_win_height))
{
unsigned geom_width = (width > 0) ? width : 1;
unsigned geom_height = (height > 0) ? height : 1;
float geom_aspect = (float)geom_width / (float)geom_height;
float max_win_aspect = (float)max_win_width / (float)max_win_height;
if (geom_aspect > max_win_aspect)
{
width = max_win_width;
height = geom_height * max_win_width / geom_width;
/* Account for any possible rounding errors... */
height = (height < 1) ? 1 : height;
height = (height > max_win_height) ? max_win_height : height;
}
else
{
height = max_win_height;
width = geom_width * max_win_height / geom_height;
/* Account for any possible rounding errors... */
width = (width < 1) ? 1 : width;
width = (width > max_win_width) ? max_win_width : width;
}
}
}
}