From 072bf0f47626bfb4122b95605426eff3c8d23eb0 Mon Sep 17 00:00:00 2001 From: Jamieson Christian Date: Sat, 27 Sep 2003 23:41:57 +0000 Subject: 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 --- backends/sdl/sdl.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'backends') diff --git a/backends/sdl/sdl.cpp b/backends/sdl/sdl.cpp index 9118830a39..c4eed72bc3 100644 --- a/backends/sdl/sdl.cpp +++ b/backends/sdl/sdl.cpp @@ -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 -- cgit v1.2.3