diff --git a/config.def.h b/config.def.h index 4306c00caa..8d92f3a815 100644 --- a/config.def.h +++ b/config.def.h @@ -109,8 +109,9 @@ //////////////// // Windowed -static const float xscale = 3.0; // Real x res = 296 * xscale -static const float yscale = 3.0; // Real y res = 224 * yscale +static const float xscale = 3.0; // Real x res = aspect * base_size * xscale +static const float yscale = 3.0; // Real y res = base_size * yscale +static const unsigned base_size = 224; // Base size for windowed mode. // Fullscreen static const bool fullscreen = false; // To start in Fullscreen or not diff --git a/driver.c b/driver.c index ba089026db..07054fdeba 100644 --- a/driver.c +++ b/driver.c @@ -432,13 +432,13 @@ void init_video_input(void) { if (g_settings.video.force_aspect) { - width = 224 * g_settings.video.xscale * g_settings.video.aspect_ratio; - height = 224 * g_settings.video.yscale; + width = roundf(g_settings.video.base_size * g_settings.video.xscale * g_settings.video.aspect_ratio); + height = roundf(g_settings.video.base_size * g_settings.video.yscale); } else { - width = 256 * g_settings.video.xscale; - height = 224 * g_settings.video.yscale; + width = roundf(8.0f / 7.0f * g_settings.video.base_size * g_settings.video.xscale); // Assume 8:7 aspect. + height = roundf(g_settings.video.base_size * g_settings.video.yscale); } } diff --git a/general.h b/general.h index 1dd230ad51..90823531c1 100644 --- a/general.h +++ b/general.h @@ -70,6 +70,7 @@ struct settings char driver[32]; float xscale; float yscale; + unsigned base_size; bool fullscreen; unsigned fullscreen_x; unsigned fullscreen_y; diff --git a/settings.c b/settings.c index 5267a5c56e..3bf6a6b758 100644 --- a/settings.c +++ b/settings.c @@ -120,6 +120,7 @@ static void set_defaults(void) g_settings.video.xscale = xscale; g_settings.video.yscale = yscale; + g_settings.video.base_size = base_size; g_settings.video.fullscreen = g_extern.force_fullscreen ? true : fullscreen; g_settings.video.fullscreen_x = fullscreen_x; g_settings.video.fullscreen_y = fullscreen_y; @@ -297,6 +298,7 @@ static void parse_config_file(void) CONFIG_GET_DOUBLE(video.xscale, "video_xscale"); CONFIG_GET_DOUBLE(video.yscale, "video_yscale"); + CONFIG_GET_INT(video.base_size, "video_base_size"); CONFIG_GET_INT(video.fullscreen_x, "video_fullscreen_x"); CONFIG_GET_INT(video.fullscreen_y, "video_fullscreen_y"); diff --git a/ssnes.cfg b/ssnes.cfg index 5928b479e0..3b209d728b 100644 --- a/ssnes.cfg +++ b/ssnes.cfg @@ -23,6 +23,9 @@ # video_xscale = 3.0 # video_yscale = 3.0 +# Base size for windowed mode calculations. Generally 224 for SNES, but can be modified. +# video_base_size = 224 + # Fullscreen resolution. Resolution of 0 uses the resolution of the desktop. # video_fullscreen_x = 0 # video_fullscreen_y = 0