Require reasons for checkpoints.

This commit is contained in:
Jason Felds
2015-06-08 18:37:13 -04:00
parent 8b7370ee10
commit 80542a5a7d
16 changed files with 103 additions and 95 deletions
+1 -1
View File
@@ -353,7 +353,7 @@ static void StartQueuedSounds()
StartMusic( aMusicsToPlay[i] );
else
{
CHECKPOINT;
CHECKPOINT_M( ssprintf("Removing old sound at index %d", i));
/* StopPlaying() can take a while, so don't hold the lock while we stop the sound. */
g_Mutex->Lock();
RageSound *pOldSound = g_Playing->m_Music;
+8 -8
View File
@@ -1992,15 +1992,16 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeat> &asFeatsOu
// Check for feats even if the PlayMode is rave or battle because the player
// may have made high scores then switched modes.
CHECKPOINT_M( ssprintf("PlayMode %i", int(m_PlayMode)) );
switch( m_PlayMode )
PlayMode mode = m_PlayMode.Get();
char const *modeStr = PlayModeToString(mode).c_str();
CHECKPOINT_M( ssprintf("Getting the feats for %s", modeStr));
switch( mode )
{
case PLAY_MODE_REGULAR:
case PLAY_MODE_BATTLE:
case PLAY_MODE_RAVE:
{
CHECKPOINT;
StepsType st = GetCurrentStyle(pn)->m_StepsType;
// Find unique Song and Steps combinations that were played.
@@ -2021,14 +2022,14 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeat> &asFeatsOu
ASSERT( sas.pSteps != NULL );
vSongAndSteps.push_back( sas );
}
CHECKPOINT;
CHECKPOINT_M( ssprintf("All songs/steps from %s gathered", modeStr));
sort( vSongAndSteps.begin(), vSongAndSteps.end() );
vector<SongAndSteps>::iterator toDelete = unique( vSongAndSteps.begin(), vSongAndSteps.end() );
vSongAndSteps.erase(toDelete, vSongAndSteps.end());
CHECKPOINT;
CHECKPOINT_M( "About to find records from the gathered.");
for( unsigned i=0; i<vSongAndSteps.size(); i++ )
{
Song* pSong = vSongAndSteps[i].pSong;
@@ -2094,7 +2095,7 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeat> &asFeatsOu
}
}
CHECKPOINT;
CHECKPOINT_M("Getting the final evaluation stage stats.");
StageStats stats;
STATSMAN->GetFinalEvalStageStats( stats );
@@ -2154,7 +2155,6 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeat> &asFeatsOu
case PLAY_MODE_ONI:
case PLAY_MODE_ENDLESS:
{
CHECKPOINT;
Course* pCourse = m_pCurCourse;
ASSERT( pCourse != NULL );
Trail *pTrail = m_pCurTrail[pn];
+43 -9
View File
@@ -213,20 +213,54 @@ void PaneDisplay::GetPaneTextAndLevel( PaneCategory c, RString & sTextOut, float
switch( c )
{
case PaneCategory_NumSteps: fLevelOut = rv[RadarCategory_TapsAndHolds]; break;
case PaneCategory_Jumps: fLevelOut = rv[RadarCategory_Jumps]; break;
case PaneCategory_Holds: fLevelOut = rv[RadarCategory_Holds]; break;
case PaneCategory_Rolls: fLevelOut = rv[RadarCategory_Rolls]; break;
case PaneCategory_Mines: fLevelOut = rv[RadarCategory_Mines]; break;
case PaneCategory_Hands: fLevelOut = rv[RadarCategory_Hands]; break;
case PaneCategory_Lifts: fLevelOut = rv[RadarCategory_Lifts]; break;
case PaneCategory_Fakes: fLevelOut = rv[RadarCategory_Fakes]; break;
case PaneCategory_NumSteps:
{
fLevelOut = rv[RadarCategory_TapsAndHolds];
break;
}
case PaneCategory_Jumps:
{
fLevelOut = rv[RadarCategory_Jumps];
break;
}
case PaneCategory_Holds:
{
fLevelOut = rv[RadarCategory_Holds];
break;
}
case PaneCategory_Rolls:
{
fLevelOut = rv[RadarCategory_Rolls];
break;
}
case PaneCategory_Mines:
{
fLevelOut = rv[RadarCategory_Mines];
break;
}
case PaneCategory_Hands:
{
fLevelOut = rv[RadarCategory_Hands];
break;
}
case PaneCategory_Lifts:
{
fLevelOut = rv[RadarCategory_Lifts];
break;
}
case PaneCategory_Fakes:
{
fLevelOut = rv[RadarCategory_Fakes];
break;
}
case PaneCategory_ProfileHighScore:
case PaneCategory_MachineHighName: // set fLevelOut for color
case PaneCategory_MachineHighScore:
CHECKPOINT;
{
CHECKPOINT_M("Getting data from a high score instead of a radar value.");
fLevelOut = pHSL->GetTopScore().GetPercentDP();
break;
}
default: break;
};
+15 -15
View File
@@ -403,15 +403,17 @@ float Profile::GetSongsActual( StepsType st, Difficulty dc ) const
CHECKPOINT_M( ssprintf("Profile::GetSongsActual: n %s = %p", sid.ToString().c_str(), pSteps) );
if( pSteps->GetDifficulty() != dc )
{
continue; // skip
CHECKPOINT;
}
CHECKPOINT_M( ssprintf("Profile::GetSongsActual: difficulty %s is correct", DifficultyToString(dc).c_str()));
const HighScoresForASteps& h = j->second;
const HighScoreList& hsl = h.hsl;
fTotalPercents += hsl.GetTopScore().GetPercentDP();
}
CHECKPOINT;
}
return fTotalPercents;
@@ -1066,8 +1068,6 @@ void Profile::LoadCustomFunction( RString sDir )
ProfileLoadResult Profile::LoadAllFromDir( RString sDir, bool bRequireSignature )
{
CHECKPOINT;
LOG->Trace( "Profile::LoadAllFromDir( %s )", sDir.c_str() );
ASSERT( sDir.Right(1) == "/" );
@@ -1829,7 +1829,7 @@ float Profile::CalculateCaloriesFromHeartRate(float HeartRate, float Duration)
XNode* Profile::SaveSongScoresCreateNode() const
{
CHECKPOINT;
CHECKPOINT_M("Getting the node to save song scores.");
const Profile* pProfile = this;
ASSERT( pProfile != NULL );
@@ -1873,7 +1873,7 @@ XNode* Profile::SaveSongScoresCreateNode() const
void Profile::LoadSongScoresFromNode( const XNode* pSongScores )
{
CHECKPOINT;
CHECKPOINT_M("Loading the node that contains song scores.");
ASSERT( pSongScores->GetName() == "SongScores" );
@@ -1912,7 +1912,7 @@ void Profile::LoadSongScoresFromNode( const XNode* pSongScores )
XNode* Profile::SaveCourseScoresCreateNode() const
{
CHECKPOINT;
CHECKPOINT_M("Getting the node to save course scores.");
const Profile* pProfile = this;
ASSERT( pProfile != NULL );
@@ -1952,7 +1952,7 @@ XNode* Profile::SaveCourseScoresCreateNode() const
void Profile::LoadCourseScoresFromNode( const XNode* pCourseScores )
{
CHECKPOINT;
CHECKPOINT_M("Loading the node that contains course scores.");
ASSERT( pCourseScores->GetName() == "CourseScores" );
@@ -2022,7 +2022,7 @@ void Profile::LoadCourseScoresFromNode( const XNode* pCourseScores )
XNode* Profile::SaveCategoryScoresCreateNode() const
{
CHECKPOINT;
CHECKPOINT_M("Getting the node that saves category scores.");
const Profile* pProfile = this;
ASSERT( pProfile != NULL );
@@ -2058,7 +2058,7 @@ XNode* Profile::SaveCategoryScoresCreateNode() const
void Profile::LoadCategoryScoresFromNode( const XNode* pCategoryScores )
{
CHECKPOINT;
CHECKPOINT_M("Loading the node that contains category scores.");
ASSERT( pCategoryScores->GetName() == "CategoryScores" );
@@ -2113,7 +2113,7 @@ void Profile::AddScreenshot( const Screenshot &screenshot )
void Profile::LoadScreenshotDataFromNode( const XNode* pScreenshotData )
{
CHECKPOINT;
CHECKPOINT_M("Loading the node containing screenshot data.");
ASSERT( pScreenshotData->GetName() == "ScreenshotData" );
FOREACH_CONST_Child( pScreenshotData, pScreenshot )
@@ -2130,7 +2130,7 @@ void Profile::LoadScreenshotDataFromNode( const XNode* pScreenshotData )
XNode* Profile::SaveScreenshotDataCreateNode() const
{
CHECKPOINT;
CHECKPOINT_M("Getting the node containing screenshot data.");
const Profile* pProfile = this;
ASSERT( pProfile != NULL );
@@ -2147,7 +2147,7 @@ XNode* Profile::SaveScreenshotDataCreateNode() const
void Profile::LoadCalorieDataFromNode( const XNode* pCalorieData )
{
CHECKPOINT;
CHECKPOINT_M("Loading the node containing calorie data.");
ASSERT( pCalorieData->GetName() == "CalorieData" );
FOREACH_CONST_Child( pCalorieData, pCaloriesBurned )
@@ -2172,7 +2172,7 @@ void Profile::LoadCalorieDataFromNode( const XNode* pCalorieData )
XNode* Profile::SaveCalorieDataCreateNode() const
{
CHECKPOINT;
CHECKPOINT_M("Getting the node containing calorie data.");
const Profile* pProfile = this;
ASSERT( pProfile != NULL );
@@ -2295,7 +2295,7 @@ bool Profile::IsMachine() const
XNode* Profile::SaveCoinDataCreateNode() const
{
CHECKPOINT;
CHECKPOINT_M("Getting the node containing coin data.");
const Profile* pProfile = this;
ASSERT( pProfile != NULL );
+3 -3
View File
@@ -522,11 +522,11 @@ bool RageFileManager::Mount( const RString &sType, const RString &sRoot_, const
// Unmount anything that was previously mounted here.
Unmount( sType, sRoot, sMountPoint );
CHECKPOINT;
CHECKPOINT_M( ssprintf("About to make a driver with \"%s\", \"%s\"", sType.c_str(), sRoot.c_str()));
RageFileDriver *pDriver = MakeFileDriver( sType, sRoot );
if( pDriver == NULL )
{
CHECKPOINT;
CHECKPOINT_M( ssprintf("Can't mount unknown VFS type \"%s\", root \"%s\"", sType.c_str(), sRoot.c_str() ) );
if( LOG )
LOG->Warn("Can't mount unknown VFS type \"%s\", root \"%s\"", sType.c_str(), sRoot.c_str() );
@@ -535,7 +535,7 @@ bool RageFileManager::Mount( const RString &sType, const RString &sRoot_, const
return false;
}
CHECKPOINT;
CHECKPOINT_M("Driver %s successfully made.");
LoadedDriver *pLoadedDriver = new LoadedDriver;
pLoadedDriver->m_pDriver = pDriver;
+6 -12
View File
@@ -19,7 +19,7 @@ namespace
{
void RageFile_png_read( png_struct *png, png_byte *p, png_size_t size )
{
CHECKPOINT;
CHECKPOINT_M("Reading the png file.");
RageFile *f = (RageFile *) png_get_io_ptr(png);
int got = f->Read( p, size );
@@ -45,7 +45,7 @@ struct error_info
void PNG_Error( png_struct *png, const char *error )
{
CHECKPOINT;
CHECKPOINT_M(ssprintf("PNG error during processing: %s", error));
error_info *info = (error_info *) png_get_error_ptr(png);
strncpy( info->err, error, 1024 );
info->err[1023] = 0;
@@ -56,7 +56,7 @@ void PNG_Error( png_struct *png, const char *error )
void PNG_Warning( png_struct *png, const char *warning )
{
// FIXME: Mismatched libpng headers vs. library causes a segfault here on MinGW
CHECKPOINT;
CHECKPOINT_M(ssprintf("PNG warning during processing: %s", warning));
error_info *info = (error_info *) png_get_io_ptr(png);
LOG->Trace( "loading \"%s\": warning: %s", info->fn, warning );
}
@@ -86,14 +86,13 @@ static RageSurface *RageSurface_Load_PNG( RageFile *f, const char *fn, char erro
}
RageSurface *volatile img = NULL;
CHECKPOINT;
CHECKPOINT_M("Potential issue with png jump about to be analyzed.");
if( setjmp(png_jmpbuf(png) ))
{
png_destroy_read_struct( &png, &info_ptr, NULL );
delete img;
return NULL;
}
CHECKPOINT;
png_set_read_fn( png, f, RageFile_png_read );
@@ -107,15 +106,13 @@ static RageSurface *RageSurface_Load_PNG( RageFile *f, const char *fn, char erro
* the image. Just return an empty surface with only the width and height set. */
if( bHeaderOnly )
{
CHECKPOINT;
CHECKPOINT_M("Header only png about to be processed.");
img = CreateSurfaceFrom( width, height, 32, 0, 0, 0, 0, NULL, width*4 );
png_destroy_read_struct( &png, &info_ptr, NULL );
return img;
}
CHECKPOINT;
png_set_strip_16(png); /* 16bit->8bit */
png_set_packing( png ); /* 1,2,4 bit->8 bit */
@@ -161,7 +158,7 @@ static RageSurface *RageSurface_Load_PNG( RageFile *f, const char *fn, char erro
FAIL_M(ssprintf( "%i", color_type) );
}
CHECKPOINT;
CHECKPOINT_M("PNG color analysis about to begin.");
if( color_type == PNG_COLOR_TYPE_GRAY )
{
png_color_16 *trans;
@@ -205,7 +202,6 @@ static RageSurface *RageSurface_Load_PNG( RageFile *f, const char *fn, char erro
png_set_interlace_handling( png );
CHECKPOINT;
png_read_update_info( png, info_ptr );
switch( type )
@@ -241,10 +237,8 @@ static RageSurface *RageSurface_Load_PNG( RageFile *f, const char *fn, char erro
row_pointers[y] = p + img->pitch*y;
}
CHECKPOINT;
png_read_image( png, row_pointers );
CHECKPOINT;
png_read_end( png, info_ptr );
png_destroy_read_struct( &png, &info_ptr, NULL );
-1
View File
@@ -79,7 +79,6 @@ namespace Checkpoints
void GetLogs( char *pBuf, int iSize, const char *delim );
};
#define CHECKPOINT (Checkpoints::SetCheckpoint(__FILE__, __LINE__, NULL))
#define CHECKPOINT_M(m) (Checkpoints::SetCheckpoint(__FILE__, __LINE__, m))
/* Mutex class that follows the behavior of Windows mutexes: if the same
+1 -3
View File
@@ -109,7 +109,7 @@ bool RageWorkerThread::DoRequest( int iRequest )
void RageWorkerThread::WorkerMain()
{
while(1)
for(;;)
{
bool bTimeToRunHeartbeat = false;
m_WorkerEvent.Lock();
@@ -166,8 +166,6 @@ void RageWorkerThread::WorkerMain()
/* Clear the time-out flag, indicating that we can work again. */
m_bTimedOut = false;
CHECKPOINT;
}
else
{
+6 -3
View File
@@ -295,20 +295,23 @@ void ScreenOptions::RestartOptions()
}
CHECKPOINT;
CHECKPOINT_M("About to get the rows positioned right.");
PositionRows( false );
FOREACH_HumanPlayer( pn )
{
for( unsigned r=0; r<m_pRows.size(); ++r )
{
this->RefreshIcons( r, pn );
}
PositionCursor( pn );
}
FOREACH_PlayerNumber( p )
{
AfterChangeRow( p );
CHECKPOINT;
}
CHECKPOINT_M("Rows positioned.");
}
void ScreenOptions::BeginScreen()
+2 -2
View File
@@ -102,7 +102,7 @@ void ScreenOptionsMaster::HandleScreenMessage( const ScreenMessage SM )
// Override ScreenOptions's calling of ExportOptions
m_iChangeMask = 0;
CHECKPOINT;
CHECKPOINT_M("Starting the export handling.");
vector<PlayerNumber> vpns;
FOREACH_OptionsPlayer( p )
@@ -150,7 +150,7 @@ void ScreenOptionsMaster::HandleScreenMessage( const ScreenMessage SM )
if( m_iChangeMask & OPT_APPLY_SONG )
SONGMAN->SetPreferences();
CHECKPOINT;
CHECKPOINT_M("Transferring to the next screen now.");
this->HandleScreenMessage( SM_GoToNextScreen );
return;
}
+1 -4
View File
@@ -64,7 +64,7 @@ void ScrollBar::SetPercentage( float fCenterPercent, float fSizePercent )
fStartPercent = fmodf( fStartPercent+1, 1 );
fEndPercent = fmodf( fEndPercent+1, 1 );
CHECKPOINT;
CHECKPOINT_M("Percentages set.");
float fPartTopY[2], fPartBottomY[2];
if( fStartPercent < fEndPercent ) // we only need to one 1 stretch thumb part
@@ -82,8 +82,6 @@ void ScrollBar::SetPercentage( float fCenterPercent, float fSizePercent )
fPartBottomY[1] = SCALE( 1.0f, 0.0f, 1.0f, -iBarContentHeight/2.0f, +iBarContentHeight/2.0f );
}
CHECKPOINT;
for( unsigned i=0; i<ARRAYLEN(m_sprScrollStretchThumb); i++ )
{
RectF rect(
@@ -94,7 +92,6 @@ void ScrollBar::SetPercentage( float fCenterPercent, float fSizePercent )
);
m_sprScrollStretchThumb[i]->StretchTo( rect );
}
CHECKPOINT;
}
/*
+3 -5
View File
@@ -266,9 +266,10 @@ void SongUtil::AdjustDuplicateSteps( Song *pSong )
* bug in an earlier version. */
DeleteDuplicateSteps( pSong, vSteps );
CHECKPOINT;
char const *songTitle = pSong->GetDisplayFullTitle().c_str();
CHECKPOINT_M(ssprintf("Duplicate steps from %s removed.", songTitle));
StepsUtil::SortNotesArrayByDifficulty( vSteps );
CHECKPOINT;
CHECKPOINT_M(ssprintf("Charts from %s sorted.", songTitle));
for( unsigned k=1; k<vSteps.size(); k++ )
{
vSteps[k]->SetDifficulty( Difficulty_Edit );
@@ -303,15 +304,12 @@ void SongUtil::DeleteDuplicateSteps( Song *pSong, vector<Steps*> &vSteps )
{
/* vSteps have the same StepsType and Difficulty. Delete them if they have the
* same m_sDescription, m_sCredit, m_iMeter and SMNoteData. */
CHECKPOINT;
for( unsigned i=0; i<vSteps.size(); i++ )
{
CHECKPOINT;
const Steps *s1 = vSteps[i];
for( unsigned j=i+1; j<vSteps.size(); j++ )
{
CHECKPOINT;
const Steps *s2 = vSteps[j];
if( s1->GetDescription() != s2->GetDescription() )
-6
View File
@@ -107,7 +107,6 @@ void StatsManager::CalcAccumPlayedStageStats()
void AddPlayerStatsToProfile( Profile *pProfile, const StageStats &ss, PlayerNumber pn )
{
ss.AssertValid( pn );
CHECKPOINT;
StyleID sID;
sID.FromStyle( ss.m_player[pn].m_pStyle );
@@ -209,13 +208,10 @@ void StatsManager::CommitStatsToProfiles( const StageStats *pSS )
pMachineProfile->m_iTotalGameplaySeconds += iGameplaySeconds;
pMachineProfile->m_iNumTotalSongsPlayed += pSS->m_vpPlayedSongs.size();
CHECKPOINT;
if( !GAMESTATE->m_bMultiplayer ) // FIXME
{
FOREACH_HumanPlayer( pn )
{
CHECKPOINT;
Profile* pPlayerProfile = PROFILEMAN->GetProfile( pn );
if( pPlayerProfile )
{
@@ -231,8 +227,6 @@ void StatsManager::CommitStatsToProfiles( const StageStats *pSS )
LOG->Trace("Adding stats to player profile...");
AddPlayerStatsToProfile( pPlayerProfile, *pSS, pn );
}
CHECKPOINT;
}
}
@@ -208,9 +208,8 @@ int MovieDecoder_FFMpeg::ReadPacket()
if( m_iEOF > 0 )
return 0;
while( 1 )
for(;;)
{
CHECKPOINT;
if( m_iCurrentPacketOffset != -1 )
{
m_iCurrentPacketOffset = -1;
@@ -261,7 +260,6 @@ int MovieDecoder_FFMpeg::DecodePacket( float fTargetTime )
(m_pStream->codec->frame_number % 2) == 0;
int iGotFrame;
CHECKPOINT;
/* Hack: we need to send size = 0 to flush frames at the end, but we have
* to give it a buffer to read from since it tries to read anyway. */
m_Packet.data = m_Packet.size ? m_Packet.data : NULL;
@@ -269,7 +267,6 @@ int MovieDecoder_FFMpeg::DecodePacket( float fTargetTime )
m_pStream->codec,
&m_Frame, &iGotFrame,
&m_Packet );
CHECKPOINT;
if( len < 0 )
{
+12 -18
View File
@@ -65,7 +65,7 @@ RString MovieTexture_Generic::Init()
UpdateFrame();
CHECKPOINT;
CHECKPOINT_M("Generic initialization completed. No errors found.");
return RString();
}
@@ -185,7 +185,7 @@ void MovieTexture_Generic::CreateTexture()
if( m_uTexHandle || m_pRenderTarget != NULL )
return;
CHECKPOINT;
CHECKPOINT_M("About to create a generic texture.");
m_iSourceWidth = m_pDecoder->GetWidth();
m_iSourceHeight = m_pDecoder->GetHeight();
@@ -327,8 +327,6 @@ bool MovieTexture_Generic::DecodeFrame()
m_fClock = -fDelay;
}
CHECKPOINT;
/* Read a frame. */
float fTargetTime = -1;
if( m_bFrameSkipMode && m_fClock > m_pDecoder->GetTimestamp() )
@@ -433,15 +431,11 @@ void MovieTexture_Generic::DecodeSeconds( float fSeconds )
/* If we have a frame decoded, see if it's time to display it. */
float fTime = CheckFrameTime();
if( fTime > 0 )
return;
CHECKPOINT;
UpdateFrame();
m_ImageWaiting = FRAME_NONE;
if ( fTime <= 0 )
{
UpdateFrame();
m_ImageWaiting = FRAME_NONE;
}
return;
}
@@ -465,31 +459,31 @@ void MovieTexture_Generic::UpdateFrame()
if( m_pRenderTarget != NULL )
{
CHECKPOINT;
CHECKPOINT_M( "About to upload the texture.");
/* If we have no m_pTextureLock, we still have to upload the texture. */
if( m_pTextureLock == NULL )
{
DISPLAY->UpdateTexture(
m_pTextureIntermediate->GetTexHandle(),
m_pSurface,
0, 0,
m_pSurface->w, m_pSurface->h );
CHECKPOINT;
}
m_pRenderTarget->BeginRenderingTo( false );
m_pSprite->Draw();
m_pRenderTarget->FinishRenderingTo();
}
else
{
CHECKPOINT;
if( m_pTextureLock == NULL )
{
DISPLAY->UpdateTexture(
m_uTexHandle,
m_pSurface,
0, 0,
m_iImageWidth, m_iImageHeight );
CHECKPOINT;
}
}
}
@@ -201,7 +201,7 @@ void RageSoundDriver::DecodeThread()
Sound *pSound = &m_Sounds[i];
CHECKPOINT;
CHECKPOINT_M("Processing the sound while buffers are available.");
while( pSound->m_Buffer.num_writable() )
{
int iWrote = GetDataForSound( *pSound );