Reverts if you can't produce a graphics mode requested from setup menu

Fixes bug #695.


git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1600 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
mcmartin
2005-03-28 06:30:16 +00:00
parent b58bdc6e0c
commit 9ba03f7f0a
2 changed files with 21 additions and 5 deletions
+3 -1
View File
@@ -1,6 +1,8 @@
Changes towards version 0.4: 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 - 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 - Fixed crash when restarting Sa-Matra battle after abort (bug #700) -Alex
- Some cleanups, enabling successful build with GCC 4 (bug #710), - Some cleanups, enabling successful build with GCC 4 (bug #710),
mostly from Ville Skyttà - SvdB mostly from Ville Skyttà - SvdB
+16 -2
View File
@@ -732,12 +732,26 @@ TFB_FlushGraphics () // Only call from main thread!!
ClearSemaphore (DC.data.sendsignal.sem); ClearSemaphore (DC.data.sendsignal.sem);
break; break;
case TFB_DRAWCOMMANDTYPE_REINITVIDEO: case TFB_DRAWCOMMANDTYPE_REINITVIDEO:
TFB_ReInitGraphics (DC.data.reinitvideo.driver, DC.data.reinitvideo.flags, {
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.width, DC.data.reinitvideo.height,
DC.data.reinitvideo.bpp); 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; break;
} }
} }
}
if (livelock_deterrence) if (livelock_deterrence)
{ {