Merge pull request #4061 from fr500/master

Fixed window size for desktop users
This commit is contained in:
Twinaphex 2016-11-25 02:06:33 +01:00 committed by GitHub
commit 3bd4739cee
10 changed files with 72 additions and 8 deletions

View File

@ -421,6 +421,12 @@ static const bool windowed_fullscreen = true;
* specific monitors, 1 being the first monitor. */
static const unsigned monitor_index = 0;
/* Window */
/* Window size. A value of 0 uses window scale
* multiplied by the core framebuffer size. */
static const unsigned window_x = 0;
static const unsigned window_y = 0;
/* Fullscreen resolution. A value of 0 uses the desktop
* resolution. */
static const unsigned fullscreen_x = 0;

View File

@ -887,6 +887,8 @@ static int populate_settings_int(settings_t *settings, struct config_int_setting
SETTING_INT("video_monitor_index", &settings->video.monitor_index, true, monitor_index, false);
SETTING_INT("video_fullscreen_x", &settings->video.fullscreen_x, true, fullscreen_x, false);
SETTING_INT("video_fullscreen_y", &settings->video.fullscreen_y, true, fullscreen_y, false);
SETTING_INT("video_window_x", &settings->video.window_x, true, fullscreen_x, false);
SETTING_INT("video_window_y", &settings->video.window_y, true, fullscreen_y, false);
#ifdef HAVE_COMMAND
SETTING_INT("network_cmd_port", &settings->network_cmd_port, true, network_cmd_port, false);
#endif

View File

@ -54,6 +54,8 @@ typedef struct settings
char driver[32];
char context_driver[32];
float scale;
unsigned window_x;
unsigned window_y;
bool fullscreen;
bool windowed_fullscreen;
unsigned monitor_index;

View File

@ -674,16 +674,24 @@ static bool init_video(void)
}
else
{
if (settings->video.force_aspect)
if(settings->video.window_x || settings->video.window_y)
{
/* Do rounding here to simplify integer scale correctness. */
unsigned base_width =
roundf(geom->base_height * video_driver_get_aspect_ratio());
width = roundf(base_width * settings->video.scale);
width = settings->video.window_x;
height = settings->video.window_y;
}
else
width = roundf(geom->base_width * settings->video.scale);
height = roundf(geom->base_height * settings->video.scale);
{
if (settings->video.force_aspect)
{
/* Do rounding here to simplify integer scale correctness. */
unsigned base_width =
roundf(geom->base_height * video_driver_get_aspect_ratio());
width = roundf(base_width * settings->video.scale);
}
else
width = roundf(geom->base_width * settings->video.scale);
height = roundf(geom->base_height * settings->video.scale);
}
}
if (width && height)

View File

@ -1042,6 +1042,10 @@ MSG_HASH(MENU_ENUM_LABEL_VIDEO_VSYNC,
"video_vsync")
MSG_HASH(MENU_ENUM_LABEL_VIDEO_WINDOWED_FULLSCREEN,
"video_windowed_fullscreen")
MSG_HASH(MENU_ENUM_LABEL_VIDEO_WINDOW_WIDTH,
"video_window_width")
MSG_HASH(MENU_ENUM_LABEL_VIDEO_WINDOW_HEIGHT,
"video_window_height")
MSG_HASH(MENU_ENUM_LABEL_WIFI_DRIVER,
"wifi_driver")
MSG_HASH(MENU_ENUM_LABEL_WIFI_SETTINGS,

View File

@ -1552,6 +1552,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_VSYNC,
"Vertical Sync (Vsync)")
MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOWED_FULLSCREEN,
"Windowed Fullscreen Mode")
MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_WIDTH,
"Window Width")
MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_HEIGHT,
"Window Height")
MSG_HASH(MENU_ENUM_LABEL_VALUE_WIFI_DRIVER,
"Wi-Fi Driver")
MSG_HASH(MENU_ENUM_LABEL_VALUE_WIFI_SETTINGS,
@ -1686,6 +1690,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_SSH_ENABLE,
"Enable or disable remote command line access.")
MSG_HASH(MENU_ENUM_SUBLABEL_SUSPEND_SCREENSAVER_ENABLE,
"Prevents your system's screensaver from becoming active.")
MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_SCALE,
"Sets the window size relative to the core viewport size. Alternatively you can set a window width and height below for a fixed window size")
MSG_HASH(MENU_ENUM_SUBLABEL_USER_LANGUAGE,
"Sets the language of the interface.")
MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_BLACK_FRAME_INSERTION,

View File

@ -54,6 +54,7 @@ default_sublabel_macro(action_bind_sublabel_cheevos_hardcore_mode_enable, MENU_
default_sublabel_macro(action_bind_sublabel_menu_settings_list, MENU_ENUM_SUBLABEL_MENU_SETTINGS)
default_sublabel_macro(action_bind_sublabel_video_settings_list, MENU_ENUM_SUBLABEL_VIDEO_SETTINGS)
default_sublabel_macro(action_bind_sublabel_suspend_screensaver_enable, MENU_ENUM_SUBLABEL_SUSPEND_SCREENSAVER_ENABLE)
default_sublabel_macro(action_bind_sublabel_video_window_scale, MENU_ENUM_SUBLABEL_VIDEO_WINDOW_SCALE)
default_sublabel_macro(action_bind_sublabel_audio_settings_list, MENU_ENUM_SUBLABEL_AUDIO_SETTINGS)
default_sublabel_macro(action_bind_sublabel_input_settings_list, MENU_ENUM_SUBLABEL_INPUT_SETTINGS)
default_sublabel_macro(action_bind_sublabel_wifi_settings_list, MENU_ENUM_SUBLABEL_WIFI_SETTINGS)
@ -367,6 +368,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_SUSPEND_SCREENSAVER_ENABLE:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_suspend_screensaver_enable);
break;
case MENU_ENUM_LABEL_VIDEO_SCALE:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_window_scale);
break;
default:
case MSG_UNKNOWN:
return -1;

View File

@ -5187,6 +5187,12 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_VIDEO_SCALE,
PARSE_ONLY_FLOAT, false);
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_VIDEO_WINDOW_WIDTH,
PARSE_ONLY_UINT, false);
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_VIDEO_WINDOW_HEIGHT,
PARSE_ONLY_UINT, false);
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER,
PARSE_ONLY_BOOL, false);

View File

@ -3153,7 +3153,6 @@ static bool setting_append_list(
general_read_handler,
SD_FLAG_NONE);
}
CONFIG_FLOAT(
list, list_info,
&settings->video.refresh_rate,
@ -3331,6 +3330,30 @@ static bool setting_append_list(
general_write_handler,
general_read_handler);
menu_settings_list_current_add_range(list, list_info, 1.0, 10.0, 1.0, true, true);
CONFIG_UINT(
list, list_info,
&settings->video.window_x,
MENU_ENUM_LABEL_VIDEO_WINDOW_WIDTH,
MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_WIDTH,
0,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler);
menu_settings_list_current_add_range(list, list_info, 0, 7680, 8, true, true);
CONFIG_UINT(
list, list_info,
&settings->video.window_y,
MENU_ENUM_LABEL_VIDEO_WINDOW_HEIGHT,
MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_HEIGHT,
0,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler);
menu_settings_list_current_add_range(list, list_info, 0, 4320, 8, true, true);
}
CONFIG_BOOL(

View File

@ -574,6 +574,8 @@ enum msg_hash_enums
MENU_LABEL(VIDEO_HARD_SYNC),
MENU_LABEL(VIDEO_HARD_SYNC_FRAMES),
MENU_LABEL(VIDEO_WINDOWED_FULLSCREEN),
MENU_LABEL(VIDEO_WINDOW_WIDTH),
MENU_LABEL(VIDEO_WINDOW_HEIGHT),
MENU_LABEL(VIDEO_FORCE_SRGB_DISABLE),
MENU_LABEL(VIDEO_ROTATION),
MENU_LABEL(VIDEO_SCALE),
@ -595,6 +597,7 @@ enum msg_hash_enums
MENU_LABEL(VIDEO_SWAP_INTERVAL),
MENU_LABEL(VIDEO_FULLSCREEN),
MENU_LABEL(VIDEO_MONITOR_INDEX),
MENU_LABEL(VIDEO_WINDOW_SCALE),
MENU_LABEL(VIDEO_REFRESH_RATE),
MENU_LABEL(VIDEO_REFRESH_RATE_AUTO),