From 04c86ea6d385877009e2c8a38782c312f87c6be8 Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Thu, 5 Nov 2009 19:32:27 +0000 Subject: [PATCH] Console logging performance tweaks, disable the unused GIFtag register log (it's been tested enough and documented), and add extra calls to GSchangeSaveState (affects zerogs/zzogl only). git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2134 96395faa-99c1-11dd-bbfe-3dabce05a288 --- common/include/Utilities/Console.h | 33 ++++++++++---------- common/src/Utilities/Console.cpp | 48 ++++++++++++++++++++++-------- pcsx2/PluginManager.cpp | 3 +- pcsx2/RecoverySystem.cpp | 2 -- pcsx2/gui/ConsoleLogger.cpp | 5 ++-- pcsx2/gui/Saveslots.cpp | 2 ++ pcsx2/ps2/GIFpath.cpp | 8 +++-- 7 files changed, 66 insertions(+), 35 deletions(-) diff --git a/common/include/Utilities/Console.h b/common/include/Utilities/Console.h index f55fffb6e9..a780ac5f65 100644 --- a/common/include/Utilities/Console.h +++ b/common/include/Utilities/Console.h @@ -75,22 +75,23 @@ struct IConsoleWriter // ---------------------------------------------------------------------------- // Public members; call these to print stuff to console! + // + // All functions always return false. Return value is provided only so that we can easily + // disable logs at compile time using the "0&&action" macro trick. + bool Write( ConsoleColors color, const char* fmt, ... ) const; + bool WriteLn( ConsoleColors color, const char* fmt, ... ) const; + bool Write( const char* fmt, ... ) const; + bool WriteLn( const char* fmt, ... ) const; + bool Error( const char* fmt, ... ) const; + bool Warning( const char* fmt, ... ) const; - void Write( ConsoleColors color, const char* fmt, ... ) const; - void WriteLn( ConsoleColors color, const char* fmt, ... ) const; - void Write( const char* fmt, ... ) const; - void WriteLn( const char* fmt, ... ) const; - void Error( const char* fmt, ... ) const; - void Warning( const char* fmt, ... ) const; - - void Write( ConsoleColors color, const wxChar* fmt, ... ) const; - void WriteLn( ConsoleColors color, const wxChar* fmt, ... ) const; - void Write( const wxChar* fmt, ... ) const; - void WriteLn( const wxChar* fmt, ... ) const; - void Error( const wxChar* fmt, ... ) const; - void Warning( const wxChar* fmt, ... ) const; - + bool Write( ConsoleColors color, const wxChar* fmt, ... ) const; + bool WriteLn( ConsoleColors color, const wxChar* fmt, ... ) const; + bool Write( const wxChar* fmt, ... ) const; + bool WriteLn( const wxChar* fmt, ... ) const; + bool Error( const wxChar* fmt, ... ) const; + bool Warning( const wxChar* fmt, ... ) const; }; extern void Console_SetActiveHandler( const IConsoleWriter& writer, FILE* flushfp=NULL ); @@ -110,13 +111,13 @@ extern IConsoleWriter Console; extern IConsoleWriter DevConWriter; # define DevCon DevConWriter #else -# define DevCon ConsoleWriter_Null +# define DevCon 0&&ConsoleWriter_Null #endif #ifdef PCSX2_DEBUG extern IConsoleWriter DbgConWriter; # define DbgCon DbgConWriter #else -# define DbgCon ConsoleWriter_Null +# define DbgCon 0&&ConsoleWriter_Null #endif diff --git a/common/src/Utilities/Console.cpp b/common/src/Utilities/Console.cpp index 383691712e..384c303049 100644 --- a/common/src/Utilities/Console.cpp +++ b/common/src/Utilities/Console.cpp @@ -331,15 +331,17 @@ static wxString unicode_format_string(const wxChar* fmt, va_list argptr) // ASCII/UTF8 (char*) // -------------------------------------------------------------------------------------- -void IConsoleWriter::Write( const char* fmt, ... ) const +bool IConsoleWriter::Write( const char* fmt, ... ) const { va_list args; va_start(args,fmt); DoWrite( ascii_format_string(fmt, args) ); va_end(args); + + return false; } -void IConsoleWriter::Write( ConsoleColors color, const char* fmt, ... ) const +bool IConsoleWriter::Write( ConsoleColors color, const char* fmt, ... ) const { va_list args; va_start(args,fmt); @@ -347,17 +349,21 @@ void IConsoleWriter::Write( ConsoleColors color, const char* fmt, ... ) const DoWrite( ascii_format_string(fmt, args) ); ClearColor(); va_end(args); + + return false; } -void IConsoleWriter::WriteLn( const char* fmt, ... ) const +bool IConsoleWriter::WriteLn( const char* fmt, ... ) const { va_list args; va_start(args,fmt); DoWriteLn( ascii_format_string(fmt, args) ); va_end(args); + + return false; } -void IConsoleWriter::WriteLn( ConsoleColors color, const char* fmt, ... ) const +bool IConsoleWriter::WriteLn( ConsoleColors color, const char* fmt, ... ) const { va_list args; va_start(args,fmt); @@ -365,9 +371,11 @@ void IConsoleWriter::WriteLn( ConsoleColors color, const char* fmt, ... ) const DoWriteLn( ascii_format_string(fmt, args) ); ClearColor(); va_end(args); + + return false; } -void IConsoleWriter::Error( const char* fmt, ... ) const +bool IConsoleWriter::Error( const char* fmt, ... ) const { va_list args; va_start(args,fmt); @@ -375,9 +383,11 @@ void IConsoleWriter::Error( const char* fmt, ... ) const DoWriteLn( ascii_format_string(fmt, args) ); ClearColor(); va_end(args); + + return false; } -void IConsoleWriter::Warning( const char* fmt, ... ) const +bool IConsoleWriter::Warning( const char* fmt, ... ) const { va_list args; va_start(args,fmt); @@ -385,21 +395,25 @@ void IConsoleWriter::Warning( const char* fmt, ... ) const DoWriteLn( ascii_format_string(fmt, args) ); ClearColor(); va_end(args); + + return false; } // -------------------------------------------------------------------------------------- // FmtWrite Variants - Unicode/UTF16 style // -------------------------------------------------------------------------------------- -void IConsoleWriter::Write( const wxChar* fmt, ... ) const +bool IConsoleWriter::Write( const wxChar* fmt, ... ) const { va_list args; va_start(args,fmt); DoWrite( unicode_format_string( fmt, args ) ); va_end(args); + + return false; } -void IConsoleWriter::Write( ConsoleColors color, const wxChar* fmt, ... ) const +bool IConsoleWriter::Write( ConsoleColors color, const wxChar* fmt, ... ) const { va_list args; va_start(args,fmt); @@ -407,17 +421,21 @@ void IConsoleWriter::Write( ConsoleColors color, const wxChar* fmt, ... ) const DoWrite( unicode_format_string( fmt, args ) ); ClearColor(); va_end(args); + + return false; } -void IConsoleWriter::WriteLn( const wxChar* fmt, ... ) const +bool IConsoleWriter::WriteLn( const wxChar* fmt, ... ) const { va_list args; va_start(args,fmt); DoWriteLn( unicode_format_string( fmt, args ) ); va_end(args); + + return false; } -void IConsoleWriter::WriteLn( ConsoleColors color, const wxChar* fmt, ... ) const +bool IConsoleWriter::WriteLn( ConsoleColors color, const wxChar* fmt, ... ) const { va_list args; va_start(args,fmt); @@ -425,9 +443,11 @@ void IConsoleWriter::WriteLn( ConsoleColors color, const wxChar* fmt, ... ) cons DoWriteLn( unicode_format_string( fmt, args ) ); ClearColor(); va_end(args); + + return false; } -void IConsoleWriter::Error( const wxChar* fmt, ... ) const +bool IConsoleWriter::Error( const wxChar* fmt, ... ) const { va_list args; va_start(args,fmt); @@ -435,9 +455,11 @@ void IConsoleWriter::Error( const wxChar* fmt, ... ) const DoWriteLn( unicode_format_string( fmt, args ) ); ClearColor(); va_end(args); + + return false; } -void IConsoleWriter::Warning( const wxChar* fmt, ... ) const +bool IConsoleWriter::Warning( const wxChar* fmt, ... ) const { va_list args; va_start(args,fmt); @@ -445,6 +467,8 @@ void IConsoleWriter::Warning( const wxChar* fmt, ... ) const DoWriteLn( unicode_format_string( fmt, args ) ); ClearColor(); va_end(args); + + return false; } diff --git a/pcsx2/PluginManager.cpp b/pcsx2/PluginManager.cpp index 82d4b6bfa8..30e182dd82 100644 --- a/pcsx2/PluginManager.cpp +++ b/pcsx2/PluginManager.cpp @@ -153,6 +153,7 @@ static void CALLBACK GS_makeSnapshot(const char *path) {} static void CALLBACK GS_setGameCRC(u32 crc, int gameopts) {} static void CALLBACK GS_irqCallback(void (*callback)()) {} static void CALLBACK GS_setFrameSkip(int frameskip) {} +static void CALLBACK GS_changeSaveState( int, const char* filename ) {} static void CALLBACK GS_printf(int timeout, char *fmt, ...) { va_list list; @@ -281,6 +282,7 @@ static const LegacyApi_ReqMethod s_MethMessReq_GS[] = { "GSsetGameCRC", (vMeth**)&GSsetGameCRC, (vMeth*)GS_setGameCRC }, { "GSsetFrameSkip", (vMeth**)&GSsetFrameSkip, (vMeth*)GS_setFrameSkip }, + { "GSchangeSaveState",(vMeth**)&GSchangeSaveState,(vMeth*)GS_changeSaveState }, { NULL } }; @@ -289,7 +291,6 @@ static const LegacyApi_OptMethod s_MethMessOpt_GS[] = { "GSopen2", (vMeth**)&GSopen2 }, { "GSreset", (vMeth**)&GSreset }, { "GSsetupRecording", (vMeth**)&GSsetupRecording }, - { "GSchangeSaveState",(vMeth**)&GSchangeSaveState }, { "GSmakeSnapshot2", (vMeth**)&GSmakeSnapshot2 }, { "GSgifSoftReset", (vMeth**)&GSgifSoftReset }, { "GSreadFIFO", (vMeth**)&GSreadFIFO }, diff --git a/pcsx2/RecoverySystem.cpp b/pcsx2/RecoverySystem.cpp index 4656fe5e45..c188205f75 100644 --- a/pcsx2/RecoverySystem.cpp +++ b/pcsx2/RecoverySystem.cpp @@ -195,8 +195,6 @@ protected: void ExecuteTaskInThread() { Yield( 3 ); - //if( gzwrite( m_gzfp, state_buffer.GetPtr(), state_buffer.GetSizeInBytes() ) < state_buffer.GetSizeInBytes() ) - // throw Exception::BadStream(); static const int BlockSize = 0x10000; int curidx = 0; diff --git a/pcsx2/gui/ConsoleLogger.cpp b/pcsx2/gui/ConsoleLogger.cpp index d6ce030caf..cabcb5c49b 100644 --- a/pcsx2/gui/ConsoleLogger.cpp +++ b/pcsx2/gui/ConsoleLogger.cpp @@ -360,7 +360,7 @@ void ConsoleLogFrame::Write( ConsoleColors color, const wxString& text ) ++m_pendingFlushes; - if( m_pendingFlushes > 32 && !wxThread::IsMain() ) + if( m_pendingFlushes > 24 && !wxThread::IsMain() ) { ++m_WaitingThreadsForFlush; lock.Release(); @@ -375,7 +375,8 @@ void ConsoleLogFrame::Write( ConsoleColors color, const wxString& text ) else { // give gui thread time to repaint and handle other pending messages. - // (those are prioritized lower than wxEvents, typically) + // (those are prioritized lower than wxEvents, typically, which means we + // can't post a ping event since it'll still just starve out paint msgs.) Sleep(1); } } diff --git a/pcsx2/gui/Saveslots.cpp b/pcsx2/gui/Saveslots.cpp index 395041fbe6..1f4b25e007 100644 --- a/pcsx2/gui/Saveslots.cpp +++ b/pcsx2/gui/Saveslots.cpp @@ -46,11 +46,13 @@ bool States_isSlotUsed(int num) void States_FreezeCurrentSlot() { + GSchangeSaveState( StatesC, SaveStateBase::GetFilename( StatesC ).ToUTF8() ); StateCopy_SaveToSlot( StatesC ); } void States_DefrostCurrentSlot() { + GSchangeSaveState( StatesC, SaveStateBase::GetFilename( StatesC ).ToUTF8() ); StateCopy_LoadFromSlot( StatesC ); //SysStatus( wxsFormat( _("Loaded State (slot %d)"), StatesC ) ); } diff --git a/pcsx2/ps2/GIFpath.cpp b/pcsx2/ps2/GIFpath.cpp index 533f4801a4..639605bf28 100644 --- a/pcsx2/ps2/GIFpath.cpp +++ b/pcsx2/ps2/GIFpath.cpp @@ -194,9 +194,13 @@ static void __fastcall RegHandlerUNMAPPED(const u32* data) // to work fine as usual -- The 0xEE address in common programming terms is typically // left over uninitialized data, and this might be a case of that, which is to be // silently ignored. - + // + // Guitar Hero 3+ : Massive spamming when using superVU (along with several VIF errors) + // Using microVU avoids the GIFtag errors, so probably just one of sVU's hacks conflicting + // with one of VIF's hacks, and causing corrupted packet data. + if( regidx != 0x7f && regidx != 0xee ) - Console.Warning( "Ignoring Unmapped GIFtag Register, Index = %02x", regidx ); + DbgCon.Warning( "Ignoring Unmapped GIFtag Register, Index = %02x", regidx ); } #define INSERT_UNMAPPED_4 RegHandlerUNMAPPED, RegHandlerUNMAPPED, RegHandlerUNMAPPED, RegHandlerUNMAPPED,