Fixed crash if no visualizations present

This commit is contained in:
Chris Danford
2002-10-09 16:21:35 +00:00
parent 6bc7b349fb
commit 812a93d732
3 changed files with 41 additions and 10 deletions
+25 -5
View File
@@ -970,28 +970,48 @@ void ApplyGraphicOptions()
if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) )
goto success;
// We failed. Using default refresh rate.
LOG->Trace( "We failed. Using default refresh rate." );
iRefreshRate = RageDisplay::REFRESH_DEFAULT;
if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) )
goto success;
// We failed. Try full screen with same params.
LOG->Trace( "We failed. Try full screen with same params." );
bWindowed = false;
if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) )
goto success;
// Failed again. Try 16 BPP
LOG->Trace( "Failed again. Try 16 BPP." );
iDisplayBPP = 16;
if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) )
goto success;
// Failed again. Try 640x480
LOG->Trace( "Failed again. Try 32 BPP." );
iDisplayBPP = 32;
if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) )
goto success;
LOG->Trace( "We failed. Try windowed with same params." );
bWindowed = false;
if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) )
goto success;
LOG->Trace( "Failed again. Try 16 BPP." );
iDisplayBPP = 16;
if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) )
goto success;
LOG->Trace( "Failed again. Try 32 BPP." );
iDisplayBPP = 32;
if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) )
goto success;
LOG->Trace( "Failed again. Try 640x480." );
iDisplayWidth = 640;
iDisplayHeight = 480;
if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) )
goto success;
// Failed again. Try 320x240
LOG->Trace( "Failed again. Try 320x240." );
iDisplayWidth = 320;
iDisplayHeight = 240;
if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) )