From cfbd136989af8f20b9d2f489c0fcaa92b03a617a Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 19 Oct 2003 07:30:06 +0000 Subject: [PATCH] ShowLogWindow -> ShowLogOutput, now also affects stdout output in *nix (unimplemented, possibly temporary TexturePreload tags along to avoid more recompiling ...) --- stepmania/src/PrefsManager.cpp | 11 +++++++---- stepmania/src/PrefsManager.h | 3 ++- stepmania/src/RageLog.cpp | 30 +++++++++++++++++------------- stepmania/src/RageLog.h | 4 ++-- stepmania/src/StepMania.cpp | 3 +-- 5 files changed, 29 insertions(+), 22 deletions(-) diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index 2ab2a836e5..4fe25f6192 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -77,6 +77,7 @@ PrefsManager::PrefsManager() m_bArcadeOptionsNavigation = false; m_bSoloSingle = false; m_bDelayedTextureDelete = true; + m_bTexturePreload = false; m_bDelayedScreenLoad = false; m_bBannerCache = true; m_MusicWheelUsesSections = ALWAYS; @@ -108,9 +109,9 @@ PrefsManager::PrefsManager() m_iEndlessNumStagesUntilBreak = 5; m_iEndlessBreakLength = 5; #ifdef DEBUG - m_bShowLogWindow = true; + m_bShowLogOutput = true; #else - m_bShowLogWindow = false; + m_bShowLogOutput = false; #endif m_bTenFooterInRed = true; @@ -240,6 +241,7 @@ void PrefsManager::ReadGlobalPrefsFromDisk() ini.GetValue( "Options", "ArcadeOptionsNavigation", m_bArcadeOptionsNavigation ); ini.GetValue( "Options", "DWIPath", m_DWIPath ); ini.GetValue( "Options", "DelayedTextureDelete", m_bDelayedTextureDelete ); + ini.GetValue( "Options", "TexturePreload", m_bTexturePreload ); ini.GetValue( "Options", "DelayedScreenLoad", m_bDelayedScreenLoad ); ini.GetValue( "Options", "BannerCache", m_bBannerCache ); ini.GetValue( "Options", "MusicWheelUsesSections", (int&)m_MusicWheelUsesSections ); @@ -298,7 +300,7 @@ void PrefsManager::ReadGlobalPrefsFromDisk() ini.GetValue( "Options", "GlobalOffsetSeconds", m_fGlobalOffsetSeconds ); ini.GetValue( "Options", "ForceLogFlush", m_bForceLogFlush ); ini.GetValue( "Options", "Logging", m_bLogging ); - ini.GetValue( "Options", "ShowLogWindow", m_bShowLogWindow ); + ini.GetValue( "Options", "ShowLogOutput", m_bShowLogOutput ); ini.GetValue( "Options", "ShowBeginnerHelper", m_bShowBeginnerHelper ); ini.GetValue( "Options", "Language", m_sLanguage ); ini.GetValue( "Options", "EndlessBreakEnabled", m_bEndlessBreakEnabled ); @@ -374,6 +376,7 @@ void PrefsManager::SaveGlobalPrefsToDisk() const ini.SetValue( "Options", "ArcadeOptionsNavigation", m_bArcadeOptionsNavigation ); ini.SetValue( "Options", "DWIPath", m_DWIPath ); ini.SetValue( "Options", "DelayedTextureDelete", m_bDelayedTextureDelete ); + ini.SetValue( "Options", "TexturePreload", m_bTexturePreload ); ini.SetValue( "Options", "DelayedScreenLoad", m_bDelayedScreenLoad ); ini.SetValue( "Options", "BannerCache", m_bBannerCache ); ini.SetValue( "Options", "MusicWheelUsesSections", m_MusicWheelUsesSections ); @@ -417,7 +420,7 @@ void PrefsManager::SaveGlobalPrefsToDisk() const ini.SetValue( "Options", "GlobalOffsetSeconds", m_fGlobalOffsetSeconds ); ini.SetValue( "Options", "ForceLogFlush", m_bForceLogFlush ); ini.SetValue( "Options", "Logging", m_bLogging ); - ini.SetValue( "Options", "ShowLogWindow", m_bShowLogWindow ); + ini.SetValue( "Options", "ShowLogOutput", m_bShowLogOutput ); ini.SetValue( "Options", "TenFooterInRed", m_bTenFooterInRed ); ini.SetValue( "Options", "CourseSortOrder", m_iCourseSortOrder ); diff --git a/stepmania/src/PrefsManager.h b/stepmania/src/PrefsManager.h index 7eb3d9a09d..ded720bec3 100644 --- a/stepmania/src/PrefsManager.h +++ b/stepmania/src/PrefsManager.h @@ -39,6 +39,7 @@ public: bool m_bPAL; #endif bool m_bDelayedTextureDelete; + bool m_bTexturePreload; bool m_bDelayedScreenLoad; bool m_bBannerCache; @@ -94,7 +95,7 @@ public: float m_fGlobalOffsetSeconds; bool m_bForceLogFlush; bool m_bLogging; - bool m_bShowLogWindow; + bool m_bShowLogOutput; bool m_bTenFooterInRed; int m_iProgressiveLifebar; int m_iProgressiveStageLifebar; diff --git a/stepmania/src/RageLog.cpp b/stepmania/src/RageLog.cpp index ac06597d7c..f3a1d34a11 100644 --- a/stepmania/src/RageLog.cpp +++ b/stepmania/src/RageLog.cpp @@ -131,7 +131,7 @@ RageLog::~RageLog() this->Info( "%s", GetAdditionalLog() ); Flush(); - HideConsole(); + ShowLogOutput( false ); if(m_fileLog) fclose( m_fileLog ); if(m_fileInfo) fclose( m_fileInfo ); } @@ -151,20 +151,23 @@ void RageLog::SetTimestamping( bool b ) m_bTimestamping = b; } -void RageLog::ShowConsole() +/* Enable or disable display of output to stdout, or a console window in Windows. */ +void RageLog::ShowLogOutput( bool show ) { -#if defined(WIN32) && !defined(_XBOX) - // create a new console window and attach standard handles - AllocConsole(); - freopen("CONOUT$","wb",stdout); - freopen("CONOUT$","wb",stderr); -#endif -} + m_bShowLogOutput = show; -void RageLog::HideConsole() -{ #if defined(WIN32) && !defined(_XBOX) - FreeConsole(); + if( m_bShowLogOutput ) + { + // create a new console window and attach standard handles + AllocConsole(); + freopen("CONOUT$","wb",stdout); + freopen("CONOUT$","wb",stderr); + } + else + { + FreeConsole(); + } #endif } @@ -239,7 +242,8 @@ void RageLog::Write( int where, CString str) if( m_fileLog ) fprintf(m_fileLog, "%s\n", str.c_str() ); - printf("%s\n", str.c_str() ); + if( m_bShowLogOutput || where != 0 ) + printf("%s\n", str.c_str() ); if( m_bFlush || (where & WRITE_TO_INFO) ) Flush(); diff --git a/stepmania/src/RageLog.h b/stepmania/src/RageLog.h index 35566634dc..1527b4019b 100644 --- a/stepmania/src/RageLog.h +++ b/stepmania/src/RageLog.h @@ -23,8 +23,7 @@ public: void Info( const char *fmt, ...) PRINTF(2,3); void Flush(); - void ShowConsole(); - void HideConsole(); + void ShowLogOutput( bool show ); void MapLog(const CString &key, const char *fmt, ...) PRINTF(3,4); void UnmapLog(const CString &key); @@ -42,6 +41,7 @@ private: bool m_bEnabled; bool m_bFlush; bool m_bTimestamping; + bool m_bShowLogOutput; FILE *m_fileLog, *m_fileInfo; void Write( int, CString ); void UpdateMappedLog(); diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 6f655d160d..5478151f26 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -781,8 +781,7 @@ int main(int argc, char* argv[]) GAMESTATE = new GameState; PREFSMAN = new PrefsManager; - if( PREFSMAN->m_bShowLogWindow ) - LOG->ShowConsole(); + LOG->ShowLogOutput( PREFSMAN->m_bShowLogOutput ); CheckSDLVersion( 1,2,6 );