cleaned up the new autoscale code a bit
This commit is contained in:
parent
4f0fed301e
commit
1fb1c4b150
|
@ -110,6 +110,9 @@ KillVideo()
|
|||
|
||||
static int s_sponge;
|
||||
|
||||
/**
|
||||
* These functions determine an appropriate scale factor for fullscreen/
|
||||
*/
|
||||
inline double GetXScale(int xres)
|
||||
{
|
||||
return ((double)xres) / NWIDTH;
|
||||
|
@ -117,11 +120,8 @@ inline double GetXScale(int xres)
|
|||
inline double GetYScale(int yres)
|
||||
{
|
||||
return ((double)yres) / s_tlines;
|
||||
//if(_integerscalefs)
|
||||
// scale = (int)scale;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Attempts to initialize the graphical video display. Returns 0 on
|
||||
* success, -1 on failure.
|
||||
|
@ -184,37 +184,9 @@ InitVideo(FCEUGI *gi)
|
|||
flags |= SDL_HWSURFACE;
|
||||
}
|
||||
|
||||
double auto_xscale = 0;
|
||||
double auto_yscale = 0;
|
||||
int autoscale;
|
||||
// check if we are rendering fullscreen
|
||||
if(s_fullscreen) {
|
||||
flags |= SDL_FULLSCREEN;
|
||||
g_config->getOption("SDL.AutoScale", &autoscale);
|
||||
if(autoscale)
|
||||
{
|
||||
auto_xscale = GetXScale(xres);
|
||||
auto_yscale = GetYScale(yres);
|
||||
double native_ratio = ((double)NWIDTH) / s_tlines;
|
||||
double screen_ratio = ((double)xres) / yres;
|
||||
int keep_aspect;
|
||||
g_config->getOption("SDL.KeepAspect", &keep_aspect);
|
||||
// Try to choose resolution
|
||||
|
||||
if (screen_ratio < native_ratio)
|
||||
{
|
||||
// The screen is narrower than the original. Maximizing width will not clip
|
||||
auto_xscale = auto_yscale = GetXScale(xres);
|
||||
if (keep_aspect)
|
||||
auto_yscale = GetYScale(yres);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto_yscale = auto_xscale = GetYScale(yres);
|
||||
if (keep_aspect)
|
||||
auto_xscale = GetXScale(xres);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(noframe) {
|
||||
|
@ -239,11 +211,33 @@ InitVideo(FCEUGI *gi)
|
|||
}
|
||||
|
||||
if(s_fullscreen) {
|
||||
int desbpp;
|
||||
int desbpp, autoscale;
|
||||
g_config->getOption("SDL.BitsPerPixel", &desbpp);
|
||||
|
||||
g_config->getOption("SDL.AutoScale", &autoscale);
|
||||
if (autoscale)
|
||||
{
|
||||
double auto_xscale = GetXScale(xres);
|
||||
double auto_yscale = GetYScale(yres);
|
||||
double native_ratio = ((double)NWIDTH) / s_tlines;
|
||||
double screen_ratio = ((double)xres) / yres;
|
||||
int keep_aspect;
|
||||
|
||||
g_config->getOption("SDL.KeepAspect", &keep_aspect);
|
||||
|
||||
// Try to choose resolution
|
||||
if (screen_ratio < native_ratio)
|
||||
{
|
||||
// The screen is narrower than the original. Maximizing width will not clip
|
||||
auto_xscale = auto_yscale = GetXScale(xres);
|
||||
if (keep_aspect)
|
||||
auto_yscale = GetYScale(yres);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto_yscale = auto_xscale = GetYScale(yres);
|
||||
if (keep_aspect)
|
||||
auto_xscale = GetXScale(xres);
|
||||
}
|
||||
s_exs = auto_xscale;
|
||||
s_eys = auto_yscale;
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ char *DriverUsage=
|
|||
--nothrottle x Disables artificial speed throttling, if x is nonzero.\n\
|
||||
--frameskip x Sets # of frames to skip per emulated frame.\n\
|
||||
--(x/y)res x, -(x/y) x Sets horizontal/vertical resolution to x for full screen mode.\n\
|
||||
--autoscale x Enables autoscaling if x is nonzero. \n\
|
||||
--autoscale x Enables autoscaling in fullscreen if x in nonzero. \n\
|
||||
--keepratio x Keeps native NES ratio when autoscaling if x is nonzero. \n\
|
||||
--(x/y)scale x Multiplies width/height by x (Real numbers >0 with OpenGL, otherwise integers >0).\n\
|
||||
--(x/y)stretch x Stretchess to fill surface on x/y axis (fullscreen, only with OpenGL).\n\
|
||||
|
|
Loading…
Reference in New Issue