Move debugging options into a separate INI section, since I use them
very frequently, and they're mostly not available in the menus. Add LogCheckpoints. Move checkpoint code into a namespace.
This commit is contained in:
@@ -106,7 +106,6 @@ PrefsManager::PrefsManager()
|
|||||||
m_ShowSongOptions = YES;
|
m_ShowSongOptions = YES;
|
||||||
m_bDancePointsForOni = false;
|
m_bDancePointsForOni = false;
|
||||||
m_bPercentageScoring = false;
|
m_bPercentageScoring = false;
|
||||||
m_bTimestamping = false;
|
|
||||||
m_bShowLyrics = true;
|
m_bShowLyrics = true;
|
||||||
m_bAutogenMissingTypes = true;
|
m_bAutogenMissingTypes = true;
|
||||||
m_bAutogenGroupCourses = true;
|
m_bAutogenGroupCourses = true;
|
||||||
@@ -116,17 +115,10 @@ PrefsManager::PrefsManager()
|
|||||||
m_bFirstRun = true;
|
m_bFirstRun = true;
|
||||||
m_bAutoMapOnJoyChange = true;
|
m_bAutoMapOnJoyChange = true;
|
||||||
m_fGlobalOffsetSeconds = 0;
|
m_fGlobalOffsetSeconds = 0;
|
||||||
m_bForceLogFlush = false;
|
|
||||||
m_bLogging = true;
|
|
||||||
m_bShowBeginnerHelper = false;
|
m_bShowBeginnerHelper = false;
|
||||||
m_bEndlessBreakEnabled = true;
|
m_bEndlessBreakEnabled = true;
|
||||||
m_iEndlessNumStagesUntilBreak = 5;
|
m_iEndlessNumStagesUntilBreak = 5;
|
||||||
m_iEndlessBreakLength = 5;
|
m_iEndlessBreakLength = 5;
|
||||||
#ifdef DEBUG
|
|
||||||
m_bShowLogOutput = true;
|
|
||||||
#else
|
|
||||||
m_bShowLogOutput = false;
|
|
||||||
#endif
|
|
||||||
m_bTenFooterInRed = true;
|
m_bTenFooterInRed = true;
|
||||||
|
|
||||||
// set to 0 so people aren't shocked at first
|
// set to 0 so people aren't shocked at first
|
||||||
@@ -200,6 +192,16 @@ PrefsManager::PrefsManager()
|
|||||||
|
|
||||||
m_sCoursesToShowRanking = "";
|
m_sCoursesToShowRanking = "";
|
||||||
|
|
||||||
|
m_bLogging = true;
|
||||||
|
m_bForceLogFlush = false;
|
||||||
|
#ifdef DEBUG
|
||||||
|
m_bShowLogOutput = true;
|
||||||
|
#else
|
||||||
|
m_bShowLogOutput = false;
|
||||||
|
#endif
|
||||||
|
m_bTimestamping = false;
|
||||||
|
m_bLogCheckpoints = false;
|
||||||
|
|
||||||
ReadGlobalPrefsFromDisk();
|
ReadGlobalPrefsFromDisk();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -310,7 +312,6 @@ void PrefsManager::ReadGlobalPrefsFromDisk()
|
|||||||
ini.GetValue( "Options", "ShowLyrics", m_bShowLyrics );
|
ini.GetValue( "Options", "ShowLyrics", m_bShowLyrics );
|
||||||
ini.GetValue( "Options", "AutogenMissingTypes", m_bAutogenMissingTypes );
|
ini.GetValue( "Options", "AutogenMissingTypes", m_bAutogenMissingTypes );
|
||||||
ini.GetValue( "Options", "AutogenGroupCourses", m_bAutogenGroupCourses );
|
ini.GetValue( "Options", "AutogenGroupCourses", m_bAutogenGroupCourses );
|
||||||
ini.GetValue( "Options", "Timestamping", m_bTimestamping );
|
|
||||||
ini.GetValue( "Options", "BreakComboToGetItem", m_bBreakComboToGetItem );
|
ini.GetValue( "Options", "BreakComboToGetItem", m_bBreakComboToGetItem );
|
||||||
ini.GetValue( "Options", "ShowDancingCharacters", (int&)m_ShowDancingCharacters );
|
ini.GetValue( "Options", "ShowDancingCharacters", (int&)m_ShowDancingCharacters );
|
||||||
ini.GetValue( "Options", "TenFooterInRed", m_bTenFooterInRed );
|
ini.GetValue( "Options", "TenFooterInRed", m_bTenFooterInRed );
|
||||||
@@ -338,9 +339,6 @@ void PrefsManager::ReadGlobalPrefsFromDisk()
|
|||||||
ini.GetValue( "Options", "GetRankingName", (int&)m_iGetRankingName);
|
ini.GetValue( "Options", "GetRankingName", (int&)m_iGetRankingName);
|
||||||
ini.GetValue( "Options", "AntiAliasing", m_bAntiAliasing );
|
ini.GetValue( "Options", "AntiAliasing", m_bAntiAliasing );
|
||||||
ini.GetValue( "Options", "GlobalOffsetSeconds", m_fGlobalOffsetSeconds );
|
ini.GetValue( "Options", "GlobalOffsetSeconds", m_fGlobalOffsetSeconds );
|
||||||
ini.GetValue( "Options", "ForceLogFlush", m_bForceLogFlush );
|
|
||||||
ini.GetValue( "Options", "Logging", m_bLogging );
|
|
||||||
ini.GetValue( "Options", "ShowLogOutput", m_bShowLogOutput );
|
|
||||||
ini.GetValue( "Options", "ShowBeginnerHelper", m_bShowBeginnerHelper );
|
ini.GetValue( "Options", "ShowBeginnerHelper", m_bShowBeginnerHelper );
|
||||||
ini.GetValue( "Options", "Language", m_sLanguage );
|
ini.GetValue( "Options", "Language", m_sLanguage );
|
||||||
ini.GetValue( "Options", "EndlessBreakEnabled", m_bEndlessBreakEnabled );
|
ini.GetValue( "Options", "EndlessBreakEnabled", m_bEndlessBreakEnabled );
|
||||||
@@ -371,6 +369,12 @@ void PrefsManager::ReadGlobalPrefsFromDisk()
|
|||||||
m_asAdditionalSongFolders.clear();
|
m_asAdditionalSongFolders.clear();
|
||||||
split( sAdditionalSongFolders, ",", m_asAdditionalSongFolders, true );
|
split( sAdditionalSongFolders, ",", m_asAdditionalSongFolders, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ini.GetValue( "Debug", "Logging", m_bLogging );
|
||||||
|
ini.GetValue( "Debug", "ForceLogFlush", m_bForceLogFlush );
|
||||||
|
ini.GetValue( "Debug", "ShowLogOutput", m_bShowLogOutput );
|
||||||
|
ini.GetValue( "Debug", "Timestamping", m_bTimestamping );
|
||||||
|
ini.GetValue( "Debug", "LogCheckpoints", m_bLogCheckpoints );
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrefsManager::SaveGlobalPrefsToDisk() const
|
void PrefsManager::SaveGlobalPrefsToDisk() const
|
||||||
@@ -466,7 +470,6 @@ void PrefsManager::SaveGlobalPrefsToDisk() const
|
|||||||
ini.SetValue( "Options", "ShowLyrics", m_bShowLyrics );
|
ini.SetValue( "Options", "ShowLyrics", m_bShowLyrics );
|
||||||
ini.SetValue( "Options", "AutogenMissingTypes", m_bAutogenMissingTypes );
|
ini.SetValue( "Options", "AutogenMissingTypes", m_bAutogenMissingTypes );
|
||||||
ini.SetValue( "Options", "AutogenGroupCourses", m_bAutogenGroupCourses );
|
ini.SetValue( "Options", "AutogenGroupCourses", m_bAutogenGroupCourses );
|
||||||
ini.SetValue( "Options", "Timestamping", m_bTimestamping );
|
|
||||||
ini.SetValue( "Options", "BreakComboToGetItem", m_bBreakComboToGetItem );
|
ini.SetValue( "Options", "BreakComboToGetItem", m_bBreakComboToGetItem );
|
||||||
ini.SetValue( "Options", "ShowDancingCharacters", m_ShowDancingCharacters );
|
ini.SetValue( "Options", "ShowDancingCharacters", m_ShowDancingCharacters );
|
||||||
ini.SetValue( "Options", "UseUnlockSystem", m_bUseUnlockSystem );
|
ini.SetValue( "Options", "UseUnlockSystem", m_bUseUnlockSystem );
|
||||||
@@ -482,9 +485,6 @@ void PrefsManager::SaveGlobalPrefsToDisk() const
|
|||||||
ini.SetValue( "Options", "GetRankingName", m_iGetRankingName);
|
ini.SetValue( "Options", "GetRankingName", m_iGetRankingName);
|
||||||
ini.SetValue( "Options", "AntiAliasing", m_bAntiAliasing );
|
ini.SetValue( "Options", "AntiAliasing", m_bAntiAliasing );
|
||||||
ini.SetValue( "Options", "GlobalOffsetSeconds", m_fGlobalOffsetSeconds );
|
ini.SetValue( "Options", "GlobalOffsetSeconds", m_fGlobalOffsetSeconds );
|
||||||
ini.SetValue( "Options", "ForceLogFlush", m_bForceLogFlush );
|
|
||||||
ini.SetValue( "Options", "Logging", m_bLogging );
|
|
||||||
ini.SetValue( "Options", "ShowLogOutput", m_bShowLogOutput );
|
|
||||||
|
|
||||||
ini.SetValue( "Options", "TenFooterInRed", m_bTenFooterInRed );
|
ini.SetValue( "Options", "TenFooterInRed", m_bTenFooterInRed );
|
||||||
ini.SetValue( "Options", "CourseSortOrder", m_iCourseSortOrder );
|
ini.SetValue( "Options", "CourseSortOrder", m_iCourseSortOrder );
|
||||||
@@ -529,9 +529,13 @@ void PrefsManager::SaveGlobalPrefsToDisk() const
|
|||||||
if(m_sMovieDrivers != DEFAULT_MOVIE_DRIVER_LIST)
|
if(m_sMovieDrivers != DEFAULT_MOVIE_DRIVER_LIST)
|
||||||
ini.SetValue ( "Options", "MovieDrivers", m_sMovieDrivers );
|
ini.SetValue ( "Options", "MovieDrivers", m_sMovieDrivers );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ini.SetValue ( "Options", "AdditionalSongFolders", join(",", m_asAdditionalSongFolders) );
|
ini.SetValue ( "Options", "AdditionalSongFolders", join(",", m_asAdditionalSongFolders) );
|
||||||
|
|
||||||
|
ini.SetValue( "Debug", "Logging", m_bLogging );
|
||||||
|
ini.SetValue( "Debug", "ForceLogFlush", m_bForceLogFlush );
|
||||||
|
ini.SetValue( "Debug", "ShowLogOutput", m_bShowLogOutput );
|
||||||
|
ini.SetValue( "Debug", "Timestamping", m_bTimestamping );
|
||||||
|
ini.SetValue( "Debug", "LogCheckpoints", m_bLogCheckpoints );
|
||||||
|
|
||||||
ini.WriteFile();
|
ini.WriteFile();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,7 +99,6 @@ public:
|
|||||||
bool m_bSoloSingle;
|
bool m_bSoloSingle;
|
||||||
bool m_bDancePointsForOni; //DDR-Extreme style dance points instead of max2 percent
|
bool m_bDancePointsForOni; //DDR-Extreme style dance points instead of max2 percent
|
||||||
bool m_bPercentageScoring;
|
bool m_bPercentageScoring;
|
||||||
bool m_bTimestamping;
|
|
||||||
bool m_bShowLyrics;
|
bool m_bShowLyrics;
|
||||||
bool m_bAutogenMissingTypes;
|
bool m_bAutogenMissingTypes;
|
||||||
bool m_bAutogenGroupCourses;
|
bool m_bAutogenGroupCourses;
|
||||||
@@ -110,9 +109,6 @@ public:
|
|||||||
bool m_bFirstRun;
|
bool m_bFirstRun;
|
||||||
bool m_bAutoMapOnJoyChange;
|
bool m_bAutoMapOnJoyChange;
|
||||||
float m_fGlobalOffsetSeconds;
|
float m_fGlobalOffsetSeconds;
|
||||||
bool m_bForceLogFlush;
|
|
||||||
bool m_bLogging;
|
|
||||||
bool m_bShowLogOutput;
|
|
||||||
bool m_bTenFooterInRed;
|
bool m_bTenFooterInRed;
|
||||||
int m_iProgressiveLifebar;
|
int m_iProgressiveLifebar;
|
||||||
int m_iProgressiveStageLifebar;
|
int m_iProgressiveStageLifebar;
|
||||||
@@ -167,6 +163,13 @@ public:
|
|||||||
|
|
||||||
CString m_sCoursesToShowRanking;
|
CString m_sCoursesToShowRanking;
|
||||||
|
|
||||||
|
/* Debug: */
|
||||||
|
bool m_bLogging;
|
||||||
|
bool m_bForceLogFlush;
|
||||||
|
bool m_bShowLogOutput;
|
||||||
|
bool m_bTimestamping;
|
||||||
|
bool m_bLogCheckpoints;
|
||||||
|
|
||||||
/* Game-specific prefs: */
|
/* Game-specific prefs: */
|
||||||
CString m_sDefaultModifiers;
|
CString m_sDefaultModifiers;
|
||||||
|
|
||||||
|
|||||||
@@ -302,8 +302,15 @@ void RageThread::HaltAllThreads( bool Kill )
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Normally, checkpoints are only seen in crash logs. It's occasionally useful
|
||||||
|
* to see them in logs, but this outputs a huge amount of text. */
|
||||||
|
static bool g_LogCheckpoints = false;
|
||||||
|
void Checkpoints::LogCheckpoints( bool on )
|
||||||
|
{
|
||||||
|
g_LogCheckpoints = on;
|
||||||
|
}
|
||||||
|
|
||||||
void SetCheckpoint( const char *file, int line, const char *message )
|
void Checkpoints::SetCheckpoint( const char *file, int line, const char *message )
|
||||||
{
|
{
|
||||||
int slotno = GetCurThreadSlot();
|
int slotno = GetCurThreadSlot();
|
||||||
ASSERT( slotno != -1 );
|
ASSERT( slotno != -1 );
|
||||||
@@ -312,13 +319,16 @@ void SetCheckpoint( const char *file, int line, const char *message )
|
|||||||
|
|
||||||
slot.Checkpoints[slot.CurCheckpoint].Set( file, line, message );
|
slot.Checkpoints[slot.CurCheckpoint].Set( file, line, message );
|
||||||
|
|
||||||
|
if( g_LogCheckpoints )
|
||||||
|
LOG->Trace( "%s", slot.Checkpoints[slot.CurCheckpoint].FormattedBuf );
|
||||||
|
|
||||||
++slot.CurCheckpoint;
|
++slot.CurCheckpoint;
|
||||||
slot.NumCheckpoints = max( slot.NumCheckpoints, slot.CurCheckpoint );
|
slot.NumCheckpoints = max( slot.NumCheckpoints, slot.CurCheckpoint );
|
||||||
slot.CurCheckpoint %= CHECKPOINT_COUNT;
|
slot.CurCheckpoint %= CHECKPOINT_COUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is called under crash conditions. Be careful. */
|
/* This is called under crash conditions. Be careful. */
|
||||||
const char *GetCheckpointLog( int slotno, int lineno )
|
static const char *GetCheckpointLog( int slotno, int lineno )
|
||||||
{
|
{
|
||||||
static char ret[1024*32];
|
static char ret[1024*32];
|
||||||
ret[0] = 0;
|
ret[0] = 0;
|
||||||
@@ -335,7 +345,7 @@ const char *GetCheckpointLog( int slotno, int lineno )
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *GetCheckpointLogs( const char *delim )
|
const char *Checkpoints::GetLogs( const char *delim )
|
||||||
{
|
{
|
||||||
static char ret[1024*32];
|
static char ret[1024*32];
|
||||||
ret[0] = 0;
|
ret[0] = 0;
|
||||||
@@ -431,16 +441,16 @@ LockMutex::~LockMutex()
|
|||||||
|
|
||||||
void LockMutex::Unlock()
|
void LockMutex::Unlock()
|
||||||
{
|
{
|
||||||
ASSERT(locked);
|
ASSERT( locked );
|
||||||
locked = false;
|
locked = false;
|
||||||
|
|
||||||
mutex.Unlock();
|
mutex.Unlock();
|
||||||
|
|
||||||
if(file && locked_at != -1)
|
if( file && locked_at != -1 )
|
||||||
{
|
{
|
||||||
float dur = RageTimer::GetTimeSinceStart() - locked_at;
|
const float dur = RageTimer::GetTimeSinceStart() - locked_at;
|
||||||
if(dur > 0.015)
|
if( dur > 0.015f )
|
||||||
LOG->Trace(ssprintf("Lock at %s:%i took %f", file, line, dur));
|
LOG->Trace( "Lock at %s:%i took %f", file, line, dur );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,11 +27,15 @@ public:
|
|||||||
bool IsCreated() const { return thr != NULL; }
|
bool IsCreated() const { return thr != NULL; }
|
||||||
};
|
};
|
||||||
|
|
||||||
void SetCheckpoint( const char *file, int line, const char *message );
|
namespace Checkpoints
|
||||||
const char *GetCheckpointLogs( const char *delim );
|
{
|
||||||
|
void LogCheckpoints( bool yes=true );
|
||||||
|
void SetCheckpoint( const char *file, int line, const char *message );
|
||||||
|
const char *GetLogs( const char *delim );
|
||||||
|
};
|
||||||
|
|
||||||
#define CHECKPOINT (SetCheckpoint(__FILE__, __LINE__, NULL))
|
#define CHECKPOINT (Checkpoints::SetCheckpoint(__FILE__, __LINE__, NULL))
|
||||||
#define CHECKPOINT_M(m) (SetCheckpoint(__FILE__, __LINE__, m))
|
#define CHECKPOINT_M(m) (Checkpoints::SetCheckpoint(__FILE__, __LINE__, m))
|
||||||
|
|
||||||
/* Mutex class that follows the behavior of Windows mutexes: if the same
|
/* Mutex class that follows the behavior of Windows mutexes: if the same
|
||||||
* thread locks the same mutex twice, we just increase a refcount; a mutex
|
* thread locks the same mutex twice, we just increase a refcount; a mutex
|
||||||
|
|||||||
@@ -716,7 +716,7 @@ static void DoSave(const EXCEPTION_POINTERS *pExc)
|
|||||||
Report(NULL, hFile, "");
|
Report(NULL, hFile, "");
|
||||||
|
|
||||||
// Dump thread stacks
|
// Dump thread stacks
|
||||||
WriteBuf( hFile, GetCheckpointLogs("\r\n") );
|
WriteBuf( hFile, Checkpoints::GetLogs("\r\n") );
|
||||||
Report(NULL, hFile, "");
|
Report(NULL, hFile, "");
|
||||||
|
|
||||||
ReportCrashCallStack(NULL, hFile, pExc);
|
ReportCrashCallStack(NULL, hFile, pExc);
|
||||||
|
|||||||
@@ -58,9 +58,12 @@ using namespace std;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* RageThreads defines (don't pull in all of RageThreads.h here) */
|
/* RageThreads defines (don't pull in all of RageThreads.h here) */
|
||||||
void SetCheckpoint( const char *file, int line, const char *message );
|
namespace Checkpoints
|
||||||
#define CHECKPOINT (SetCheckpoint(__FILE__, __LINE__, NULL))
|
{
|
||||||
#define CHECKPOINT_M(m) (SetCheckpoint(__FILE__, __LINE__, m))
|
void SetCheckpoint( const char *file, int line, const char *message );
|
||||||
|
};
|
||||||
|
#define CHECKPOINT (Checkpoints::SetCheckpoint(__FILE__, __LINE__, NULL))
|
||||||
|
#define CHECKPOINT_M(m) (Checkpoints::SetCheckpoint(__FILE__, __LINE__, m))
|
||||||
|
|
||||||
/* Assertion that sets an optional message and brings up the crash handler, so
|
/* Assertion that sets an optional message and brings up the crash handler, so
|
||||||
* we get a backtrace. This should probably be used instead of throwing an
|
* we get a backtrace. This should probably be used instead of throwing an
|
||||||
|
|||||||
Reference in New Issue
Block a user