diff --git a/sc2/ChangeLog b/sc2/ChangeLog index e1a4e5694..5e1e8bc2a 100644 --- a/sc2/ChangeLog +++ b/sc2/ChangeLog @@ -1,6 +1,8 @@ Changes towards version 0.4: +- Attempting to set to a mode that Doesn't Work in Setup no longer ends + the program (bug #695) - Michael - Fixed segfault when shutting down because video could not be initialized - (bug #683), - Michael + (bug #683) - Michael - Fixed crash when restarting Sa-Matra battle after abort (bug #700) -Alex - Some cleanups, enabling successful build with GCC 4 (bug #710), mostly from Ville Skyttà - SvdB diff --git a/sc2/src/sc2code/libs/graphics/sdl/sdl_common.c b/sc2/src/sc2code/libs/graphics/sdl/sdl_common.c index 58bd87cdb..bdd389936 100644 --- a/sc2/src/sc2code/libs/graphics/sdl/sdl_common.c +++ b/sc2/src/sc2code/libs/graphics/sdl/sdl_common.c @@ -732,10 +732,24 @@ TFB_FlushGraphics () // Only call from main thread!! ClearSemaphore (DC.data.sendsignal.sem); break; case TFB_DRAWCOMMANDTYPE_REINITVIDEO: - TFB_ReInitGraphics (DC.data.reinitvideo.driver, DC.data.reinitvideo.flags, - DC.data.reinitvideo.width, DC.data.reinitvideo.height, - DC.data.reinitvideo.bpp); - break; + { + int oldDriver = GraphicsDriver; + int oldBpp = ScreenColorDepth; + if (TFB_ReInitGraphics (DC.data.reinitvideo.driver, DC.data.reinitvideo.flags, + DC.data.reinitvideo.width, DC.data.reinitvideo.height, + DC.data.reinitvideo.bpp)) + { + fprintf (stderr, "Could not provide requested mode: reverting to last known driver and bpp.\n"); + if (TFB_ReInitGraphics (oldDriver, DC.data.reinitvideo.flags, + DC.data.reinitvideo.width, DC.data.reinitvideo.height, + oldBpp)) + { + fprintf (stderr, "Couldn't reinit at that point either. Your video has been somehow tied in knots.\n"); + exit (-1); + } + } + break; + } } }