Fixed crash if no visualizations present
This commit is contained in:
@@ -237,11 +237,19 @@ void Background::LoadFromSong( Song* pSong )
|
|||||||
GetDirListing( VISUALIZATIONS_DIR + "*.mpg", arrayPossibleMovies, false, true );
|
GetDirListing( VISUALIZATIONS_DIR + "*.mpg", arrayPossibleMovies, false, true );
|
||||||
GetDirListing( VISUALIZATIONS_DIR + "*.mpeg", arrayPossibleMovies, false, true );
|
GetDirListing( VISUALIZATIONS_DIR + "*.mpeg", arrayPossibleMovies, false, true );
|
||||||
|
|
||||||
int index = rand() % arrayPossibleMovies.GetSize();
|
if( arrayPossibleMovies.GetSize() > 0 )
|
||||||
pTempBGA = new BGAnimation;
|
{
|
||||||
pTempBGA->LoadFromVisualization( arrayPossibleMovies[index], sSongBackgroundPath );
|
int index = rand() % arrayPossibleMovies.GetSize();
|
||||||
m_BGAnimations.Add( pTempBGA );
|
pTempBGA = new BGAnimation;
|
||||||
arrayPossibleMovies.RemoveAt( index );
|
pTempBGA->LoadFromVisualization( arrayPossibleMovies[index], sSongBackgroundPath );
|
||||||
|
m_BGAnimations.Add( pTempBGA );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pTempBGA = new BGAnimation;
|
||||||
|
pTempBGA->LoadFromStaticGraphic( sSongBackgroundPath );
|
||||||
|
m_BGAnimations.Add( pTempBGA );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MODE_ANIMATIONS:
|
case MODE_ANIMATIONS:
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ enum
|
|||||||
TRACK_8,
|
TRACK_8,
|
||||||
TRACK_9,
|
TRACK_9,
|
||||||
TRACK_10,
|
TRACK_10,
|
||||||
|
TRACK_11,
|
||||||
|
TRACK_12,
|
||||||
|
TRACK_13, // BMS reader needs 13 tracks
|
||||||
MAX_NOTE_TRACKS // leave this at the end
|
MAX_NOTE_TRACKS // leave this at the end
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -970,28 +970,48 @@ void ApplyGraphicOptions()
|
|||||||
if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) )
|
if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) )
|
||||||
goto success;
|
goto success;
|
||||||
|
|
||||||
// We failed. Using default refresh rate.
|
LOG->Trace( "We failed. Using default refresh rate." );
|
||||||
iRefreshRate = RageDisplay::REFRESH_DEFAULT;
|
iRefreshRate = RageDisplay::REFRESH_DEFAULT;
|
||||||
if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) )
|
if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) )
|
||||||
goto success;
|
goto success;
|
||||||
|
|
||||||
// We failed. Try full screen with same params.
|
LOG->Trace( "We failed. Try full screen with same params." );
|
||||||
bWindowed = false;
|
bWindowed = false;
|
||||||
if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) )
|
if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) )
|
||||||
goto success;
|
goto success;
|
||||||
|
|
||||||
// Failed again. Try 16 BPP
|
LOG->Trace( "Failed again. Try 16 BPP." );
|
||||||
iDisplayBPP = 16;
|
iDisplayBPP = 16;
|
||||||
if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) )
|
if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) )
|
||||||
goto success;
|
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;
|
iDisplayWidth = 640;
|
||||||
iDisplayHeight = 480;
|
iDisplayHeight = 480;
|
||||||
if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) )
|
if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) )
|
||||||
goto success;
|
goto success;
|
||||||
|
|
||||||
// Failed again. Try 320x240
|
LOG->Trace( "Failed again. Try 320x240." );
|
||||||
iDisplayWidth = 320;
|
iDisplayWidth = 320;
|
||||||
iDisplayHeight = 240;
|
iDisplayHeight = 240;
|
||||||
if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) )
|
if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) )
|
||||||
|
|||||||
Reference in New Issue
Block a user