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
This commit is contained in:
Jake.Stine 2009-11-05 19:32:27 +00:00
parent 0ed2093e5d
commit 04c86ea6d3
7 changed files with 66 additions and 35 deletions

View File

@ -75,22 +75,23 @@ struct IConsoleWriter
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Public members; call these to print stuff to console! // 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; bool Write( ConsoleColors color, const wxChar* fmt, ... ) const;
void WriteLn( ConsoleColors color, const char* fmt, ... ) const; bool WriteLn( ConsoleColors color, const wxChar* fmt, ... ) const;
void Write( const char* fmt, ... ) const; bool Write( const wxChar* fmt, ... ) const;
void WriteLn( const char* fmt, ... ) const; bool WriteLn( const wxChar* fmt, ... ) const;
void Error( const char* fmt, ... ) const; bool Error( const wxChar* fmt, ... ) const;
void Warning( const char* fmt, ... ) const; bool Warning( const wxChar* 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;
}; };
extern void Console_SetActiveHandler( const IConsoleWriter& writer, FILE* flushfp=NULL ); extern void Console_SetActiveHandler( const IConsoleWriter& writer, FILE* flushfp=NULL );
@ -110,13 +111,13 @@ extern IConsoleWriter Console;
extern IConsoleWriter DevConWriter; extern IConsoleWriter DevConWriter;
# define DevCon DevConWriter # define DevCon DevConWriter
#else #else
# define DevCon ConsoleWriter_Null # define DevCon 0&&ConsoleWriter_Null
#endif #endif
#ifdef PCSX2_DEBUG #ifdef PCSX2_DEBUG
extern IConsoleWriter DbgConWriter; extern IConsoleWriter DbgConWriter;
# define DbgCon DbgConWriter # define DbgCon DbgConWriter
#else #else
# define DbgCon ConsoleWriter_Null # define DbgCon 0&&ConsoleWriter_Null
#endif #endif

View File

@ -331,15 +331,17 @@ static wxString unicode_format_string(const wxChar* fmt, va_list argptr)
// ASCII/UTF8 (char*) // ASCII/UTF8 (char*)
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
void IConsoleWriter::Write( const char* fmt, ... ) const bool IConsoleWriter::Write( const char* fmt, ... ) const
{ {
va_list args; va_list args;
va_start(args,fmt); va_start(args,fmt);
DoWrite( ascii_format_string(fmt, args) ); DoWrite( ascii_format_string(fmt, args) );
va_end(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_list args;
va_start(args,fmt); va_start(args,fmt);
@ -347,17 +349,21 @@ void IConsoleWriter::Write( ConsoleColors color, const char* fmt, ... ) const
DoWrite( ascii_format_string(fmt, args) ); DoWrite( ascii_format_string(fmt, args) );
ClearColor(); ClearColor();
va_end(args); va_end(args);
return false;
} }
void IConsoleWriter::WriteLn( const char* fmt, ... ) const bool IConsoleWriter::WriteLn( const char* fmt, ... ) const
{ {
va_list args; va_list args;
va_start(args,fmt); va_start(args,fmt);
DoWriteLn( ascii_format_string(fmt, args) ); DoWriteLn( ascii_format_string(fmt, args) );
va_end(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_list args;
va_start(args,fmt); va_start(args,fmt);
@ -365,9 +371,11 @@ void IConsoleWriter::WriteLn( ConsoleColors color, const char* fmt, ... ) const
DoWriteLn( ascii_format_string(fmt, args) ); DoWriteLn( ascii_format_string(fmt, args) );
ClearColor(); ClearColor();
va_end(args); va_end(args);
return false;
} }
void IConsoleWriter::Error( const char* fmt, ... ) const bool IConsoleWriter::Error( const char* fmt, ... ) const
{ {
va_list args; va_list args;
va_start(args,fmt); va_start(args,fmt);
@ -375,9 +383,11 @@ void IConsoleWriter::Error( const char* fmt, ... ) const
DoWriteLn( ascii_format_string(fmt, args) ); DoWriteLn( ascii_format_string(fmt, args) );
ClearColor(); ClearColor();
va_end(args); va_end(args);
return false;
} }
void IConsoleWriter::Warning( const char* fmt, ... ) const bool IConsoleWriter::Warning( const char* fmt, ... ) const
{ {
va_list args; va_list args;
va_start(args,fmt); va_start(args,fmt);
@ -385,21 +395,25 @@ void IConsoleWriter::Warning( const char* fmt, ... ) const
DoWriteLn( ascii_format_string(fmt, args) ); DoWriteLn( ascii_format_string(fmt, args) );
ClearColor(); ClearColor();
va_end(args); va_end(args);
return false;
} }
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
// FmtWrite Variants - Unicode/UTF16 style // FmtWrite Variants - Unicode/UTF16 style
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
void IConsoleWriter::Write( const wxChar* fmt, ... ) const bool IConsoleWriter::Write( const wxChar* fmt, ... ) const
{ {
va_list args; va_list args;
va_start(args,fmt); va_start(args,fmt);
DoWrite( unicode_format_string( fmt, args ) ); DoWrite( unicode_format_string( fmt, args ) );
va_end(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_list args;
va_start(args,fmt); va_start(args,fmt);
@ -407,17 +421,21 @@ void IConsoleWriter::Write( ConsoleColors color, const wxChar* fmt, ... ) const
DoWrite( unicode_format_string( fmt, args ) ); DoWrite( unicode_format_string( fmt, args ) );
ClearColor(); ClearColor();
va_end(args); va_end(args);
return false;
} }
void IConsoleWriter::WriteLn( const wxChar* fmt, ... ) const bool IConsoleWriter::WriteLn( const wxChar* fmt, ... ) const
{ {
va_list args; va_list args;
va_start(args,fmt); va_start(args,fmt);
DoWriteLn( unicode_format_string( fmt, args ) ); DoWriteLn( unicode_format_string( fmt, args ) );
va_end(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_list args;
va_start(args,fmt); va_start(args,fmt);
@ -425,9 +443,11 @@ void IConsoleWriter::WriteLn( ConsoleColors color, const wxChar* fmt, ... ) cons
DoWriteLn( unicode_format_string( fmt, args ) ); DoWriteLn( unicode_format_string( fmt, args ) );
ClearColor(); ClearColor();
va_end(args); va_end(args);
return false;
} }
void IConsoleWriter::Error( const wxChar* fmt, ... ) const bool IConsoleWriter::Error( const wxChar* fmt, ... ) const
{ {
va_list args; va_list args;
va_start(args,fmt); va_start(args,fmt);
@ -435,9 +455,11 @@ void IConsoleWriter::Error( const wxChar* fmt, ... ) const
DoWriteLn( unicode_format_string( fmt, args ) ); DoWriteLn( unicode_format_string( fmt, args ) );
ClearColor(); ClearColor();
va_end(args); va_end(args);
return false;
} }
void IConsoleWriter::Warning( const wxChar* fmt, ... ) const bool IConsoleWriter::Warning( const wxChar* fmt, ... ) const
{ {
va_list args; va_list args;
va_start(args,fmt); va_start(args,fmt);
@ -445,6 +467,8 @@ void IConsoleWriter::Warning( const wxChar* fmt, ... ) const
DoWriteLn( unicode_format_string( fmt, args ) ); DoWriteLn( unicode_format_string( fmt, args ) );
ClearColor(); ClearColor();
va_end(args); va_end(args);
return false;
} }

View File

@ -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_setGameCRC(u32 crc, int gameopts) {}
static void CALLBACK GS_irqCallback(void (*callback)()) {} static void CALLBACK GS_irqCallback(void (*callback)()) {}
static void CALLBACK GS_setFrameSkip(int frameskip) {} 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, ...) static void CALLBACK GS_printf(int timeout, char *fmt, ...)
{ {
va_list list; va_list list;
@ -281,6 +282,7 @@ static const LegacyApi_ReqMethod s_MethMessReq_GS[] =
{ "GSsetGameCRC", (vMeth**)&GSsetGameCRC, (vMeth*)GS_setGameCRC }, { "GSsetGameCRC", (vMeth**)&GSsetGameCRC, (vMeth*)GS_setGameCRC },
{ "GSsetFrameSkip", (vMeth**)&GSsetFrameSkip, (vMeth*)GS_setFrameSkip }, { "GSsetFrameSkip", (vMeth**)&GSsetFrameSkip, (vMeth*)GS_setFrameSkip },
{ "GSchangeSaveState",(vMeth**)&GSchangeSaveState,(vMeth*)GS_changeSaveState },
{ NULL } { NULL }
}; };
@ -289,7 +291,6 @@ static const LegacyApi_OptMethod s_MethMessOpt_GS[] =
{ "GSopen2", (vMeth**)&GSopen2 }, { "GSopen2", (vMeth**)&GSopen2 },
{ "GSreset", (vMeth**)&GSreset }, { "GSreset", (vMeth**)&GSreset },
{ "GSsetupRecording", (vMeth**)&GSsetupRecording }, { "GSsetupRecording", (vMeth**)&GSsetupRecording },
{ "GSchangeSaveState",(vMeth**)&GSchangeSaveState },
{ "GSmakeSnapshot2", (vMeth**)&GSmakeSnapshot2 }, { "GSmakeSnapshot2", (vMeth**)&GSmakeSnapshot2 },
{ "GSgifSoftReset", (vMeth**)&GSgifSoftReset }, { "GSgifSoftReset", (vMeth**)&GSgifSoftReset },
{ "GSreadFIFO", (vMeth**)&GSreadFIFO }, { "GSreadFIFO", (vMeth**)&GSreadFIFO },

View File

@ -195,8 +195,6 @@ protected:
void ExecuteTaskInThread() void ExecuteTaskInThread()
{ {
Yield( 3 ); Yield( 3 );
//if( gzwrite( m_gzfp, state_buffer.GetPtr(), state_buffer.GetSizeInBytes() ) < state_buffer.GetSizeInBytes() )
// throw Exception::BadStream();
static const int BlockSize = 0x10000; static const int BlockSize = 0x10000;
int curidx = 0; int curidx = 0;

View File

@ -360,7 +360,7 @@ void ConsoleLogFrame::Write( ConsoleColors color, const wxString& text )
++m_pendingFlushes; ++m_pendingFlushes;
if( m_pendingFlushes > 32 && !wxThread::IsMain() ) if( m_pendingFlushes > 24 && !wxThread::IsMain() )
{ {
++m_WaitingThreadsForFlush; ++m_WaitingThreadsForFlush;
lock.Release(); lock.Release();
@ -375,7 +375,8 @@ void ConsoleLogFrame::Write( ConsoleColors color, const wxString& text )
else else
{ {
// give gui thread time to repaint and handle other pending messages. // 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); Sleep(1);
} }
} }

View File

@ -46,11 +46,13 @@ bool States_isSlotUsed(int num)
void States_FreezeCurrentSlot() void States_FreezeCurrentSlot()
{ {
GSchangeSaveState( StatesC, SaveStateBase::GetFilename( StatesC ).ToUTF8() );
StateCopy_SaveToSlot( StatesC ); StateCopy_SaveToSlot( StatesC );
} }
void States_DefrostCurrentSlot() void States_DefrostCurrentSlot()
{ {
GSchangeSaveState( StatesC, SaveStateBase::GetFilename( StatesC ).ToUTF8() );
StateCopy_LoadFromSlot( StatesC ); StateCopy_LoadFromSlot( StatesC );
//SysStatus( wxsFormat( _("Loaded State (slot %d)"), StatesC ) ); //SysStatus( wxsFormat( _("Loaded State (slot %d)"), StatesC ) );
} }

View File

@ -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 // 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 // left over uninitialized data, and this might be a case of that, which is to be
// silently ignored. // 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 ) 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, #define INSERT_UNMAPPED_4 RegHandlerUNMAPPED, RegHandlerUNMAPPED, RegHandlerUNMAPPED, RegHandlerUNMAPPED,