From 7d276bc796ec8d5d4d88e4b91728662b7bc1e63b Mon Sep 17 00:00:00 2001 From: avolkov Date: Mon, 26 Oct 2009 20:59:14 +0000 Subject: [PATCH] Revert graphics settings entirely when a mode switch fails; bug #1056 git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3256 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/ChangeLog | 1 + sc2/src/libs/graphics/sdl/sdl_common.c | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/sc2/ChangeLog b/sc2/ChangeLog index 21c1bdc45..b95df910b 100644 --- a/sc2/ChangeLog +++ b/sc2/ChangeLog @@ -1,4 +1,5 @@ Changes towards version 0.7: +- Revert gfx settings entirely when a mode switch fails (bug #1056) - Alex - Fixed the Syreen lights-out scene timing (bug #1011) - Alex - Added a native error box for MacOSX (like we have for Windows) - Alex - Fix for weird colors problem on MacOSX w/ SDL 1.2.14; also improves diff --git a/sc2/src/libs/graphics/sdl/sdl_common.c b/sc2/src/libs/graphics/sdl/sdl_common.c index 8a9d5c758..ba634f3e5 100644 --- a/sc2/src/libs/graphics/sdl/sdl_common.c +++ b/sc2/src/libs/graphics/sdl/sdl_common.c @@ -860,16 +860,18 @@ TFB_FlushGraphics (void) // Only call from main thread!! case TFB_DRAWCOMMANDTYPE_REINITVIDEO: { int oldDriver = GraphicsDriver; + int oldFlags = GfxFlags; + int oldWidth = ScreenWidthActual; + int oldHeight = ScreenHeightActual; if (TFB_ReInitGraphics (DC.data.reinitvideo.driver, DC.data.reinitvideo.flags, DC.data.reinitvideo.width, DC.data.reinitvideo.height)) { log_add (log_Error, "Could not provide requested mode: " "reverting to last known driver."); - if (TFB_ReInitGraphics (oldDriver, - DC.data.reinitvideo.flags, - DC.data.reinitvideo.width, - DC.data.reinitvideo.height)) + // We don't know what exactly failed, so roll it all back + if (TFB_ReInitGraphics (oldDriver, oldFlags, + oldWidth, oldHeight)) { log_add (log_Fatal, "Couldn't reinit at that point either. "