sdl: dynamically set fullscreen resolution when SDL.[x/y]Resolution is set to 0
sdl: new default values for SDL.[X/Y]Resolution to dynamically set fullscreen resolution
This commit is contained in:
parent
517ad65bdc
commit
ed03db8497
|
@ -156,20 +156,14 @@ InitConfig()
|
||||||
config->addOption("slstart", "SDL.ScanLineStart", 0);
|
config->addOption("slstart", "SDL.ScanLineStart", 0);
|
||||||
config->addOption("slend", "SDL.ScanLineEnd", 239);
|
config->addOption("slend", "SDL.ScanLineEnd", 239);
|
||||||
|
|
||||||
const SDL_VideoInfo* vid_info = SDL_GetVideoInfo();
|
|
||||||
// video controls
|
// video controls
|
||||||
config->addOption('f', "fullscreen", "SDL.Fullscreen", 0);
|
config->addOption('f', "fullscreen", "SDL.Fullscreen", 0);
|
||||||
// if we can detect the screen resolultion, use that for the default fullscreen res
|
|
||||||
if(vid_info != NULL)
|
// set x/y res to 0 for automatic fullscreen resolution detection (no change)
|
||||||
{
|
config->addOption('x', "xres", "SDL.XResolution", 0);
|
||||||
config->addOption('x', "xres", "SDL.XResolution", vid_info->current_w);
|
config->addOption('y', "yres", "SDL.YResolution", 0);
|
||||||
config->addOption('y', "yres", "SDL.YResolution", vid_info->current_h);
|
config->addOption("SDL.LastXRes", 0);
|
||||||
}
|
config->addOption("SDL.LastYRes", 0);
|
||||||
else
|
|
||||||
{
|
|
||||||
config->addOption('x', "xres", "SDL.XResolution", 512);
|
|
||||||
config->addOption('y', "yres", "SDL.YResolution", 448);
|
|
||||||
}
|
|
||||||
config->addOption('b', "bpp", "SDL.BitsPerPixel", 32);
|
config->addOption('b', "bpp", "SDL.BitsPerPixel", 32);
|
||||||
config->addOption("doublebuf", "SDL.DoubleBuffering", 0);
|
config->addOption("doublebuf", "SDL.DoubleBuffering", 0);
|
||||||
config->addOption("autoscale", "SDL.AutoScale", 1);
|
config->addOption("autoscale", "SDL.AutoScale", 1);
|
||||||
|
|
|
@ -170,8 +170,8 @@ InitVideo(FCEUGI *gi)
|
||||||
g_config->getOption("SDL.SpecialFilter", &s_sponge);
|
g_config->getOption("SDL.SpecialFilter", &s_sponge);
|
||||||
g_config->getOption("SDL.XStretch", &xstretch);
|
g_config->getOption("SDL.XStretch", &xstretch);
|
||||||
g_config->getOption("SDL.YStretch", &ystretch);
|
g_config->getOption("SDL.YStretch", &ystretch);
|
||||||
g_config->getOption("SDL.XResolution", &xres);
|
g_config->getOption("SDL.LastXRes", &xres);
|
||||||
g_config->getOption("SDL.YResolution", &yres);
|
g_config->getOption("SDL.LastYRes", &yres);
|
||||||
g_config->getOption("SDL.ClipSides", &s_clipSides);
|
g_config->getOption("SDL.ClipSides", &s_clipSides);
|
||||||
g_config->getOption("SDL.NoFrame", &noframe);
|
g_config->getOption("SDL.NoFrame", &noframe);
|
||||||
g_config->getOption("SDL.ShowFPS", &show_fps);
|
g_config->getOption("SDL.ShowFPS", &show_fps);
|
||||||
|
@ -179,7 +179,9 @@ InitVideo(FCEUGI *gi)
|
||||||
// check the starting, ending, and total scan lines
|
// check the starting, ending, and total scan lines
|
||||||
FCEUI_GetCurrentVidSystem(&s_srendline, &s_erendline);
|
FCEUI_GetCurrentVidSystem(&s_srendline, &s_erendline);
|
||||||
s_tlines = s_erendline - s_srendline + 1;
|
s_tlines = s_erendline - s_srendline + 1;
|
||||||
|
|
||||||
|
// check if we should auto-set x/y resolution
|
||||||
|
|
||||||
// check for OpenGL and set the global flags
|
// check for OpenGL and set the global flags
|
||||||
#if OPENGL
|
#if OPENGL
|
||||||
if(s_useOpenGL && !s_sponge) {
|
if(s_useOpenGL && !s_sponge) {
|
||||||
|
|
|
@ -615,9 +615,44 @@ int main(int argc, char *argv[])
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If x/y res set to 0, store current display res in SDL.LastX/YRes
|
||||||
|
int yres, xres;
|
||||||
|
g_config->getOption("SDL.XResolution", &xres);
|
||||||
|
g_config->getOption("SDL.YResolution", &yres);
|
||||||
|
const SDL_VideoInfo* vid_info = SDL_GetVideoInfo();
|
||||||
|
if(xres == 0)
|
||||||
|
{
|
||||||
|
if(vid_info != NULL)
|
||||||
|
{
|
||||||
|
g_config->setOption("SDL.LastXRes", vid_info->current_w);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_config->setOption("SDL.LastXRes", 512);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_config->setOption("SDL.LastXRes", xres);
|
||||||
|
}
|
||||||
|
if(yres == 0)
|
||||||
|
{
|
||||||
|
if(vid_info != NULL)
|
||||||
|
{
|
||||||
|
g_config->setOption("SDL.LastYRes", vid_info->current_h);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_config->setOption("SDL.LastYRes", 448);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_config->setOption("SDL.LastYRes", yres);
|
||||||
|
}
|
||||||
|
|
||||||
int autoResume;
|
int autoResume;
|
||||||
|
|
||||||
g_config->getOption("SDL.AutoResume", &autoResume);
|
g_config->getOption("SDL.AutoResume", &autoResume);
|
||||||
if(autoResume)
|
if(autoResume)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue