Fixed program crash when trying to switch to a

video mode that isn't supported (such as going
to fullscreen under COMI with a 3x scaler and
a video card that doesn't like 1920x1440 LOL).

The program still terminates when this happens,
due to the suboptimal way we make the switch to
another video mode. (By the time we find out
that we can't make the switch, it's too late to
revert back). But at least it doesn't crash.

svn-id: r10449
This commit is contained in:
Jamieson Christian 2003-09-27 23:41:57 +00:00
parent b2b9a7cb07
commit 072bf0f476

View file

@ -134,8 +134,19 @@ void OSystem_SDL::load_gfx_mode() {
_hwscreen = SDL_SetVideoMode(_screenWidth * _scaleFactor, (_adjustAspectRatio ? 240 : _screenHeight) * _scaleFactor, 16,
_full_screen ? (SDL_FULLSCREEN|SDL_SWSURFACE) : SDL_SWSURFACE
);
if (_hwscreen == NULL)
error("_hwscreen failed");
if (_hwscreen == NULL) {
// DON'T use error(), as this tries to bring up the debug
// console, which WON'T WORK now that _hwscreen is hosed.
// FIXME: We should be able to continue the game without
// shutting down or bringing up the debug console, but at
// this point we've already screwed up all our member vars.
// We need to find a way to call SDL_VideoModeOK *before*
// that happens and revert to all the old settings if we
// can't pull off the switch to the new settings.
warning("SDL_SetVideoMode says we can't switch to that mode");
quit();
}
//
// Create the surface used for the graphics in 16 bit before scaling, and also the overlay