(win) add fixed window size mode

This commit is contained in:
radius 2016-11-23 19:43:50 -05:00
parent 19f44ecadc
commit 8cb5ed0d95
9 changed files with 78 additions and 8 deletions

View File

@ -421,6 +421,15 @@ static const bool windowed_fullscreen = true;
* specific monitors, 1 being the first monitor. */
static const unsigned monitor_index = 0;
/* Window */
#ifdef _WIN32
/* 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;
#endif
/* 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,10 @@ typedef struct settings
char driver[32];
char context_driver[32];
float scale;
#ifdef _WIN32
unsigned window_x;
unsigned window_y;
#endif
bool fullscreen;
bool windowed_fullscreen;
unsigned monitor_index;

View File

@ -674,16 +674,28 @@ static bool init_video(void)
}
else
{
if (settings->video.force_aspect)
#ifdef _WIN32
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);
{
#endif
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);
#ifdef _WIN32
}
#endif
}
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,

View File

@ -5187,6 +5187,14 @@ 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);
#ifdef _WIN32
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);
#endif
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,32 @@ 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);
#ifdef _WIN32
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);
#endif
}
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),