Fixed crash in demo if no songs.

This commit is contained in:
Chris Danford
2003-01-19 21:05:03 +00:00
parent 2e10cb86df
commit d84e10f9d2
4 changed files with 23 additions and 5 deletions
+7
View File
@@ -77,6 +77,13 @@ RageDisplay::RageDisplay( bool windowed, int width, int height, int bpp, int rat
SetupOpenGL();
// Log driver details
LOG->Trace("OpenGL driver:");
LOG->Trace(" Vendor: %s", glGetString(GL_VENDOR));
LOG->Trace(" Renderer: %s", glGetString(GL_RENDERER));
LOG->Trace(" Version: %s", glGetString(GL_VERSION));
/* Log this, so if people complain that the radar looks bad on their
* system we can compare them: */
glGetFloatv(GL_LINE_WIDTH_RANGE, m_oglspecs->line_range);
+7 -5
View File
@@ -54,11 +54,7 @@ bool SetUpSongOptions() // always return true.
{
Song* pSong = SONGMAN->GetRandomSong();
if( pSong == NULL ) // returns NULL there are no songs
{
// we didn't find a song. Abort demonstration.
SCREENMAN->SendMessageToTopScreen( SM_GoToNextScreen, 0 );
return true;
}
return true; // we need to detect this and abort demonstration later
if( pSong->m_apNotes.empty() )
continue; // skip
@@ -141,6 +137,12 @@ ScreenDemonstration::ScreenDemonstration() : ScreenGameplay(SetUpSongOptions())
LOG->Trace( "ScreenDemonstration::ScreenDemonstration()" );
GAMESTATE->m_bDemonstration = true;
if( GAMESTATE->m_pCurSong == NULL ) // we didn't find a song.
{
this->SendScreenMessage( SM_GoToNextScreen, 0 ); // Abort demonstration.
return;
}
m_sprDemonstrationOverlay.Load( THEME->GetPathTo("Graphics","demonstration overlay") );
m_sprDemonstrationOverlay.SetXY( CENTER_X, CENTER_Y );
+3
View File
@@ -100,6 +100,9 @@ ScreenGameplay::ScreenGameplay( bool bDemonstration )
{
LOG->Trace( "ScreenGameplay::ScreenGameplay()" );
if( GAMESTATE->m_pCurSong == NULL )
return; // ScreenDemonstration will move us to the next scren. We just need to survive for one update without crashing.
int p;
for( p=0; p<NUM_PLAYERS; p++ )
+6
View File
@@ -199,10 +199,16 @@ static void BoostAppPri()
return;
}
#ifndef ABOVE_NORMAL_PRIORITY_CLASS
#define ABOVE_NORMAL_PRIORITY_CLASS 0x00008000
#endif
DWORD pri = HIGH_PRIORITY_CLASS;
if(version.dwMajorVersion >= 5)
pri = ABOVE_NORMAL_PRIORITY_CLASS;
#include <winbase.h>
/* Be sure to boost the app, not the thread, to make sure the
* sound thread stays higher priority than the main thread. */
SetPriorityClass(GetCurrentProcess(), pri);