diff --git a/common/include/Utilities/Assertions.h b/common/include/Utilities/Assertions.h index 2353073a08..b70bf2bcb1 100644 --- a/common/include/Utilities/Assertions.h +++ b/common/include/Utilities/Assertions.h @@ -89,6 +89,10 @@ extern pxDoAssertFnType* pxDoAssert; // // Performance: All assumption/fail types optimize into __assume()/likely() directives in // Release builds (non-dev varieties optimize as such in Devel builds as well). If using +// +// Having pxFail and pxFailDev translate into __assume statements is very dangerous, since +// it can lead to the compiler optimizing out code and leading to crashes in dev/release +// builds. To have code optimized, explicitly use pxAssume(false) or pxAssumeDev(false,msg); #define pxDiagSpot DiagnosticOrigin( __TFILE__, __LINE__, __pxFUNCTION__ ) #define pxAssertSpot(cond) DiagnosticOrigin( __TFILE__, __LINE__, __pxFUNCTION__, _T(#cond) ) @@ -100,7 +104,7 @@ extern pxDoAssertFnType* pxDoAssert; #define pxAssertRel(cond, msg) ( (likely(cond)) || (pxOnAssert(pxAssertSpot(cond), msg), false) ) #define pxAssumeRel(cond, msg) ((void) ( (!likely(cond)) && (pxOnAssert(pxAssertSpot(cond), msg), false) )) -#define pxFailRel(msg) pxAssumeRel(false, msg) +#define pxFailRel(msg) pxAssertRel(false, msg) #if defined(PCSX2_DEBUG) @@ -110,8 +114,8 @@ extern pxDoAssertFnType* pxDoAssert; # define pxAssumeMsg(cond, msg) pxAssumeRel(cond, msg) # define pxAssumeDev(cond, msg) pxAssumeRel(cond, msg) -# define pxFail(msg) pxAssumeMsg(false, msg) -# define pxFailDev(msg) pxAssumeDev(false, msg) +# define pxFail(msg) pxAssertMsg(false, msg) +# define pxFailDev(msg) pxAssertDev(false, msg) #elif defined(PCSX2_DEVBUILD) @@ -124,8 +128,8 @@ extern pxDoAssertFnType* pxDoAssert; # define pxAssumeMsg(cond, msg) (__assume(cond)) # define pxAssumeDev(cond, msg) pxAssumeRel(cond, msg) -# define pxFail(msg) (__assume(false)) -# define pxFailDev(msg) pxAssumeDev(false, msg) +# define pxFail(msg) +# define pxFailDev(msg) pxAssertDev(false, msg) #else @@ -138,8 +142,8 @@ extern pxDoAssertFnType* pxDoAssert; # define pxAssumeMsg(cond, msg) (__assume(cond)) # define pxAssumeDev(cond, msg) (__assume(cond)) -# define pxFail(msg) (__assume(false)) -# define pxFailDev(msg) (__assume(false)) +# define pxFail(msg) +# define pxFailDev(msg) #endif @@ -168,31 +172,21 @@ extern pxDoAssertFnType* pxDoAssert; extern void pxOnAssert( const DiagnosticOrigin& origin, const wxChar* msg=NULL ); extern void pxOnAssert( const DiagnosticOrigin& origin, const char* msg ); -////////////////////////////////////////////////////////////////////////////////////////// +// -------------------------------------------------------------------------------------- // jNO_DEFAULT -- disables the default case in a switch, which improves switch optimization // under MSVC. -// -// How it Works: jASSUME turns into an __assume(0) under msvc compilers, which when specified +// -------------------------------------------------------------------------------------- +// How it Works: pxAssumeDev turns into an __assume(0) under msvc compilers, which when specified // in the 'default:' case of a switch tells the compiler that the case is unreachable, so // that it will not generate any code, LUTs, or conditionals to handle it. // // * In debug/devel builds the default case will cause an assertion. // #ifndef jNO_DEFAULT - -#if defined(__cplusplus) && defined(PCSX2_DEVBUILD) # define jNO_DEFAULT \ default: \ { \ - pxFailDev( "Incorrect usage of jNO_DEFAULT detected (default case is not unreachable!)" ); \ - break; \ - } -#else -# define jNO_DEFAULT \ - default: \ - { \ - jASSUME(0); \ + pxAssumeDev( false, "Incorrect usage of jNO_DEFAULT detected (default case is not unreachable!)" ); \ break; \ } #endif -#endif diff --git a/common/include/Utilities/Threading.h b/common/include/Utilities/Threading.h index f35a391d9f..85f0134117 100644 --- a/common/include/Utilities/Threading.h +++ b/common/include/Utilities/Threading.h @@ -37,13 +37,9 @@ class ConsoleLogSource_Threading : ConsoleLogSource typedef ConsoleLogSource _parent; public: - using _parent::IsEnabled; + using _parent::IsActive; - ConsoleLogSource_Threading() - { - Name = L"pxThread"; - Description = wxLt("Threading activity: start, detach, sync, deletion, etc."); - } + ConsoleLogSource_Threading(); bool Write( const wxString& thrname, const wxChar* msg ) { return _parent::Write( wxsFormat(L"(thread:%s) ", thrname.c_str()) + msg ); @@ -58,7 +54,7 @@ public: extern ConsoleLogSource_Threading pxConLog_Thread; -#define pxThreadLog pxConLog_Thread.IsEnabled() && pxConLog_Thread +#define pxThreadLog pxConLog_Thread.IsActive() && pxConLog_Thread // -------------------------------------------------------------------------------------- diff --git a/common/include/Utilities/TraceLog.h b/common/include/Utilities/TraceLog.h index 13b8096402..021be06e04 100644 --- a/common/include/Utilities/TraceLog.h +++ b/common/include/Utilities/TraceLog.h @@ -17,56 +17,97 @@ #include "Console.h" -#define TraceLog_ImplementBaseAPI(thistype) \ - thistype& SetDescription( const wxChar* desc ) { \ - Description = desc; \ - return *this; \ - } \ - thistype& SetName( const wxChar* name ) { \ - Name = name; \ - return *this; \ - } \ - thistype& SetShortName( const wxChar* name ) { \ - ShortName = name; \ - return *this; \ - } - -#define ConsoleLog_ImplementBaseAPI(thistype) \ - TraceLog_ImplementBaseAPI(thistype) \ - thistype& SetColor( ConsoleColors color ) { \ - DefaultColor = color; \ - return *this; \ - } +// These macros are currently not needed (anymore), but might be needed aain in the future --air +#define TraceLog_ImplementBaseAPI(thistype) +#define ConsoleLog_ImplementBaseAPI(thistype) // -------------------------------------------------------------------------------------- -// BaseTraceLog +// TraceLogDescriptor // -------------------------------------------------------------------------------------- -class BaseTraceLogAttr +// Provides textual information for use by UIs; to give the end user a selection screen for +// enabling/disabling logs, and also for saving the log settings to INI. +// +struct TraceLogDescriptor { -public: - bool Enabled; - // short name, alphanumerics only: used for saving/loading options. const wxChar* ShortName; // Standard UI name for this log source. Used in menus, options dialogs. const wxChar* Name; + + // Length description for use as a tooltip or menu item description. const wxChar* Description; -public: - TraceLog_ImplementBaseAPI(BaseTraceLogAttr) - - BaseTraceLogAttr() + wxString GetShortName() const { + pxAssumeDev(Name, "Tracelog descriptors require a valid name!"); + return ShortName ? ShortName : Name; + } +}; + +// -------------------------------------------------------------------------------------- +// BaseTraceLogSource +// -------------------------------------------------------------------------------------- +// This class houses the base attributes for any trace log (to file or to console), which +// only includes the logfile's name, description, and enabled bit (for UIs and ini files), +// and an IsActive() method for determining if the log should be written or not. +// +// Derived classes then provide their own Write/DoWrite functions that format and write +// the log to the intended target(s). +// +// All individual calls to log write functions should be responsible for checking the +// status of the log via the IsActive() method manually (typically done via macro). This +// is done in favor of internal checks because most logs include detailed/formatted +// information, which itself can take a lot of cpu power to prepare. If the IsActive() +// check is done top-level, the parameters' calculations can be skipped. If the IsActive() +// check is done internally as part of the Write/Format calls, all parameters have to be +// resolved regardless of if the log is actually active. +// +class BaseTraceLogSource +{ +protected: + const TraceLogDescriptor* m_Descriptor; + +public: + // Indicates if the user has enabled this specific log. This boolean only represents + // the configured status of this log, and does *NOT* actually mean the log is active + // even when TRUE. Because many tracelogs have master enablers that act on a group + // of logs, logging checks should always use IsActive() instead to determine if a log + // should be processed or not. + bool Enabled; + +protected: + BaseTraceLogSource() {} + +public: + TraceLog_ImplementBaseAPI(BaseTraceLogSource) + + BaseTraceLogSource( const TraceLogDescriptor* desc ) + { + pxAssumeDev( desc, "Trace logs must have a valid (non-NULL) descriptor." ); Enabled = false; - ShortName = NULL; + m_Descriptor = desc; } - virtual wxString GetShortName() const { return ShortName ? ShortName : Name; } + // Provides a categorical identifier, typically in "group.subgroup.subgroup" form. + // (use periods in favor of colons, since they do not require escape characters when + // written to ini/config files). virtual wxString GetCategory() const { return wxEmptyString; } - virtual bool IsEnabled() const { return Enabled; } - const wxChar* GetDescription() const; + // This method should be used to determine if a log should be generated or not. + // See the class overview comments for details on how and why this method should + // be used. + virtual bool IsActive() const { return Enabled; } + + virtual wxString GetShortName() const { return m_Descriptor->GetShortName(); } + virtual const wxChar* GetName() const { return m_Descriptor->Name; } + virtual const wxChar* GetDescription() const + { + return (m_Descriptor->Description!=NULL) ? pxGetTranslation(m_Descriptor->Description) : wxEmptyString; + } + + virtual bool HasDescription() const { return m_Descriptor->Description != NULL;} + }; // -------------------------------------------------------------------------------------- @@ -75,11 +116,14 @@ public: // This class is tailored for performance logging to file. It does not support console // colors or wide/unicode text conversion. // -class TextFileTraceLog : public BaseTraceLogAttr +class TextFileTraceLog : public BaseTraceLogSource { -protected: - public: + TextFileTraceLog( const TraceLogDescriptor* desc ) + : BaseTraceLogSource( desc ) + { + } + bool Write( const char* fmt, ... ) const { va_list list; @@ -103,22 +147,28 @@ public: virtual void DoWrite( const char* fmt ) const=0; }; - // -------------------------------------------------------------------------------------- // ConsoleLogSource // -------------------------------------------------------------------------------------- // This class is tailored for logging to console. It applies default console color attributes // to all writes, and supports both char and wxChar (Ascii and UF8/16) formatting. // -class ConsoleLogSource : public BaseTraceLogAttr +class ConsoleLogSource : public BaseTraceLogSource { public: ConsoleColors DefaultColor; +protected: + ConsoleLogSource() {} + public: ConsoleLog_ImplementBaseAPI(ConsoleLogSource) - ConsoleLogSource(); + ConsoleLogSource( const TraceLogDescriptor* desc, ConsoleColors defaultColor = Color_Gray ) + : BaseTraceLogSource(desc) + { + DefaultColor = defaultColor; + } // Writes to the console using the source's default color. Note that the source's default // color will always be used, thus ConsoleColorScope() will not be effectual unless the @@ -201,46 +251,3 @@ public: } }; -#if 0 -// -------------------------------------------------------------------------------------- -// pxConsoleLogList -// -------------------------------------------------------------------------------------- -struct pxConsoleLogList -{ - uint count; - ConsoleLogSource* source[128]; - - void Add( ConsoleLogSource* trace ) - { - if( !pxAssertDev( count < ArraySize(source), - wxsFormat( L"Trace log initialization list is already maxed out. The tracelog for'%s' will not be enumerable.", trace->Name ) ) - ) return; - - source[count++] = trace; - } - - uint GetCount() const - { - return count; - } - - ConsoleLogSource& operator[]( uint idx ) - { - pxAssumeDev( idx < count, "SysTraceLog index is out of bounds." ); - pxAssume( source[idx] != NULL ); - - return *source[idx]; - } - - const ConsoleLogSource& operator[]( uint idx ) const - { - pxAssumeDev( idx < count, "SysTraceLog index is out of bounds." ); - pxAssume( source[idx] != NULL ); - - return *source[idx]; - } -}; - -extern pxConsoleLogList pxConLogSources_AllKnown; - -#endif diff --git a/common/include/Utilities/wxAppWithHelpers.h b/common/include/Utilities/wxAppWithHelpers.h index 39f2c9165c..cf373db885 100644 --- a/common/include/Utilities/wxAppWithHelpers.h +++ b/common/include/Utilities/wxAppWithHelpers.h @@ -34,16 +34,12 @@ class ConsoleLogSource_App : public ConsoleLogSource typedef ConsoleLogSource _parent; public: - ConsoleLogSource_App() - { - Name = L"App Events"; - Description = wxLt("Includes idle event processing and some other uncommon event usages."); - } + ConsoleLogSource_App(); }; extern ConsoleLogSource_App pxConLog_App; -#define pxAppLog pxConLog_App.IsEnabled() && pxConLog_App +#define pxAppLog pxConLog_App.IsActive() && pxConLog_App // -------------------------------------------------------------------------------------- diff --git a/common/src/Utilities/Console.cpp b/common/src/Utilities/Console.cpp index 393833d712..11c3424b4d 100644 --- a/common/src/Utilities/Console.cpp +++ b/common/src/Utilities/Console.cpp @@ -560,19 +560,8 @@ const IConsoleWriter DbgConWriter = _DefaultWriter_; const NullConsoleWriter NullCon = {}; - // -------------------------------------------------------------------------------------- -// BaseTraceLogAttr -// -------------------------------------------------------------------------------------- - -// Returns the translated description of this trace log! -const wxChar* BaseTraceLogAttr::GetDescription() const -{ - return (Description!=NULL) ? pxGetTranslation(Description) : wxEmptyString; -} - -// -------------------------------------------------------------------------------------- -// ConsoleLogSource +// ConsoleLogSource (implementations) // -------------------------------------------------------------------------------------- // Writes to the console using the specified color. This overrides the default color setting @@ -605,13 +594,3 @@ bool ConsoleLogSource::WriteV( const wxChar *fmt, va_list list ) const WriteV( DefaultColor, fmt, list ); return false; } - -ConsoleLogSource::ConsoleLogSource() -{ - // SourceLogs are usually pretty heavy spam, so default to something - // reasonably non-intrusive: - DefaultColor = Color_Gray; - //pxConLogSources_AllKnown.Add(this); -} - -ConsoleLogSource_Threading pxConLog_Thread; diff --git a/common/src/Utilities/ThreadTools.cpp b/common/src/Utilities/ThreadTools.cpp index 4b66bbd536..de7b73f8e6 100644 --- a/common/src/Utilities/ThreadTools.cpp +++ b/common/src/Utilities/ThreadTools.cpp @@ -33,6 +33,20 @@ template class EventSource< EventListener_Thread >; // to avoid gui deadlock). const wxTimeSpan Threading::def_yieldgui_interval( 0, 0, 0, 100 ); +ConsoleLogSource_Threading::ConsoleLogSource_Threading() +{ + static const TraceLogDescriptor myDesc = + { + L"pxThread", L"pxThread", + wxLt("Threading activity: start, detach, sync, deletion, etc.") + }; + + m_Descriptor = &myDesc; +} + +ConsoleLogSource_Threading pxConLog_Thread; + + class StaticMutex : public Mutex { protected: diff --git a/common/src/Utilities/wxAppWithHelpers.cpp b/common/src/Utilities/wxAppWithHelpers.cpp index abd56ade62..aee33ccd3c 100644 --- a/common/src/Utilities/wxAppWithHelpers.cpp +++ b/common/src/Utilities/wxAppWithHelpers.cpp @@ -28,6 +28,17 @@ DEFINE_EVENT_TYPE( pxEvt_SynchronousCommand ); IMPLEMENT_DYNAMIC_CLASS( pxSimpleEvent, wxEvent ) +ConsoleLogSource_App::ConsoleLogSource_App() +{ + static const TraceLogDescriptor myDesc = + { + L"AppEvents", L"App Events", + wxLt("Includes idle event processing and some other uncommon event usages.") + }; + + m_Descriptor = &myDesc; +} + ConsoleLogSource_App pxConLog_App; void BaseDeletableObject::DoDeletion() diff --git a/common/src/x86emitter/x86emitter.cpp b/common/src/x86emitter/x86emitter.cpp index 6e0d2b6c1d..a1b3084174 100644 --- a/common/src/x86emitter/x86emitter.cpp +++ b/common/src/x86emitter/x86emitter.cpp @@ -543,7 +543,7 @@ xAddressVoid& xAddressVoid::Add( const xAddressReg& src ) else if( Index.IsEmpty() ) Index = src; else - pxFailDev( L"x86Emitter: address modifiers cannot have more than two index registers." ); // oops, only 2 regs allowed per ModRm! + pxAssumeDev( false, L"x86Emitter: address modifiers cannot have more than two index registers." ); // oops, only 2 regs allowed per ModRm! return *this; } @@ -568,7 +568,7 @@ xAddressVoid& xAddressVoid::Add( const xAddressVoid& src ) Factor += src.Factor; } else - pxFailDev( L"x86Emitter: address modifiers cannot have more than two index registers." ); // oops, only 2 regs allowed per ModRm! + pxAssumeDev( false, L"x86Emitter: address modifiers cannot have more than two index registers." ); // oops, only 2 regs allowed per ModRm! return *this; } @@ -664,11 +664,11 @@ void xIndirectVoid::Reduce() break; case 6: // invalid! - pxFail( "x86 asm cannot scale a register by 6." ); + pxAssumeDev( false, "x86 asm cannot scale a register by 6." ); break; case 7: // so invalid! - pxFail( "x86 asm cannot scale a register by 7." ); + pxAssumeDev( false, "x86 asm cannot scale a register by 7." ); break; case 8: Scale = 3; break; @@ -677,12 +677,14 @@ void xIndirectVoid::Reduce() Base = Index; Scale = 3; break; + + jNO_DEFAULT } } uint xIndirectVoid::GetOperandSize() const { - pxFail( "Invalid operation on xIndirectVoid" ); + pxFailDev( "Invalid operation on xIndirectVoid" ); return 0; } diff --git a/pcsx2/DebugTools/Debug.h b/pcsx2/DebugTools/Debug.h index 92fded01cb..75a7ca3d9b 100644 --- a/pcsx2/DebugTools/Debug.h +++ b/pcsx2/DebugTools/Debug.h @@ -67,6 +67,17 @@ namespace R3000A extern char* disR3000AF(u32 code, u32 pc); } +// this structure uses old fashioned C-style "polymorphism". The base struct TraceLogDescriptor +// must always be the first member in the struct. +struct SysTraceLogDescriptor +{ + TraceLogDescriptor base; + const char* Prefix; +}; + +// -------------------------------------------------------------------------------------- +// SysTraceLog +// -------------------------------------------------------------------------------------- // Default trace log for high volume VM/System logging. // This log dumps to emuLog.txt directly and has no ability to pipe output // to the console (due to the console's inability to handle extremely high @@ -79,6 +90,10 @@ public: public: TraceLog_ImplementBaseAPI(SysTraceLog) + // Pass me a NULL and you *will* suffer! Muahahaha. + SysTraceLog( const SysTraceLogDescriptor* desc ) + : TextFileTraceLog( &desc->base ) {} + void DoWrite( const char *fmt ) const; SysTraceLog& SetPrefix( const char* name ) @@ -91,9 +106,13 @@ public: class SysTraceLog_EE : public SysTraceLog { + typedef SysTraceLog _parent; + public: + SysTraceLog_EE( const SysTraceLogDescriptor* desc ) : _parent( desc ) {} + void ApplyPrefix( FastFormatAscii& ascii ) const; - bool IsEnabled() const + bool IsActive() const { return EmuConfig.Trace.Enabled && Enabled && EmuConfig.Trace.EE.m_EnableAll; } @@ -106,6 +125,8 @@ class SysTraceLog_VIFcode : public SysTraceLog_EE typedef SysTraceLog_EE _parent; public: + SysTraceLog_VIFcode( const SysTraceLogDescriptor* desc ) : _parent( desc ) {} + void ApplyPrefix( FastFormatAscii& ascii ) const; }; @@ -114,9 +135,11 @@ class SysTraceLog_EE_Disasm : public SysTraceLog_EE typedef SysTraceLog_EE _parent; public: - bool IsEnabled() const + SysTraceLog_EE_Disasm( const SysTraceLogDescriptor* desc ) : _parent( desc ) {} + + bool IsActive() const { - return _parent::IsEnabled() && EmuConfig.Trace.EE.m_EnableDisasm; + return _parent::IsActive() && EmuConfig.Trace.EE.m_EnableDisasm; } wxString GetCategory() const { return _parent::GetCategory() + L".Disasm"; } @@ -127,9 +150,11 @@ class SysTraceLog_EE_Registers : public SysTraceLog_EE typedef SysTraceLog_EE _parent; public: - bool IsEnabled() const + SysTraceLog_EE_Registers( const SysTraceLogDescriptor* desc ) : _parent( desc ) {} + + bool IsActive() const { - return _parent::IsEnabled() && EmuConfig.Trace.EE.m_EnableRegisters; + return _parent::IsActive() && EmuConfig.Trace.EE.m_EnableRegisters; } wxString GetCategory() const { return _parent::GetCategory() + L".Registers"; } @@ -140,9 +165,11 @@ class SysTraceLog_EE_Events : public SysTraceLog_EE typedef SysTraceLog_EE _parent; public: - bool IsEnabled() const + SysTraceLog_EE_Events( const SysTraceLogDescriptor* desc ) : _parent( desc ) {} + + bool IsActive() const { - return _parent::IsEnabled() && EmuConfig.Trace.EE.m_EnableEvents; + return _parent::IsActive() && EmuConfig.Trace.EE.m_EnableEvents; } wxString GetCategory() const { return _parent::GetCategory() + L".Events"; } @@ -151,9 +178,13 @@ public: class SysTraceLog_IOP : public SysTraceLog { + typedef SysTraceLog _parent; + public: + SysTraceLog_IOP( const SysTraceLogDescriptor* desc ) : _parent( desc ) {} + void ApplyPrefix( FastFormatAscii& ascii ) const; - bool IsEnabled() const + bool IsActive() const { return EmuConfig.Trace.Enabled && Enabled && EmuConfig.Trace.IOP.m_EnableAll; } @@ -166,9 +197,10 @@ class SysTraceLog_IOP_Disasm : public SysTraceLog_IOP typedef SysTraceLog_IOP _parent; public: - bool IsEnabled() const + SysTraceLog_IOP_Disasm( const SysTraceLogDescriptor* desc ) : _parent( desc ) {} + bool IsActive() const { - return _parent::IsEnabled() && EmuConfig.Trace.IOP.m_EnableDisasm; + return _parent::IsActive() && EmuConfig.Trace.IOP.m_EnableDisasm; } wxString GetCategory() const { return _parent::GetCategory() + L".Disasm"; } @@ -179,9 +211,10 @@ class SysTraceLog_IOP_Registers : public SysTraceLog_IOP typedef SysTraceLog_IOP _parent; public: - bool IsEnabled() const + SysTraceLog_IOP_Registers( const SysTraceLogDescriptor* desc ) : _parent( desc ) {} + bool IsActive() const { - return _parent::IsEnabled() && EmuConfig.Trace.IOP.m_EnableRegisters; + return _parent::IsActive() && EmuConfig.Trace.IOP.m_EnableRegisters; } wxString GetCategory() const { return _parent::GetCategory() + L".Registers"; } @@ -192,9 +225,10 @@ class SysTraceLog_IOP_Events : public SysTraceLog_IOP typedef SysTraceLog_IOP _parent; public: - bool IsEnabled() const + SysTraceLog_IOP_Events( const SysTraceLogDescriptor* desc ) : _parent( desc ) {} + bool IsActive() const { - return _parent::IsEnabled() && EmuConfig.Trace.IOP.m_EnableEvents; + return _parent::IsActive() && EmuConfig.Trace.IOP.m_EnableEvents; } wxString GetCategory() const { return _parent::GetCategory() + L".Events"; } @@ -209,24 +243,21 @@ public: // formatting, since anything coming over the EE/IOP consoles should be considered raw // string data. (otherwise %'s would get mis-interpreted). // -class ConsoleLogFromVM : ConsoleLogSource +template< ConsoleColors conColor > +class ConsoleLogFromVM : public BaseTraceLogSource { - typedef ConsoleLogSource _parent; + typedef BaseTraceLogSource _parent; public: ConsoleLog_ImplementBaseAPI(ConsoleLogFromVM) - using _parent::IsEnabled; + + ConsoleLogFromVM( const TraceLogDescriptor* desc ) : _parent( desc ) {} bool Write( const wxChar* msg ) const { - ConsoleColorScope cs(DefaultColor); - DoWrite(msg); - return false; - } - - virtual void DoWrite( const wxChar* msg ) const - { + ConsoleColorScope cs(conColor); Console.WriteRaw( msg ); + return false; } }; @@ -238,7 +269,7 @@ struct SysTraceLogPack // TODO : Sif has special logging needs.. ? SysTraceLog SIF; - struct + struct EE_PACK { SysTraceLog_EE Bios; SysTraceLog_EE Memory; @@ -263,9 +294,10 @@ struct SysTraceLogPack SysTraceLog_EE_Events VIF; SysTraceLog_EE_Events GIF; + EE_PACK(); } EE; - struct + struct IOP_PACK { SysTraceLog_IOP Bios; SysTraceLog_IOP Memcards; @@ -288,6 +320,7 @@ struct SysTraceLogPack SysTraceLog_IOP_Events Counters; SysTraceLog_IOP_Events CDVD; + IOP_PACK(); } IOP; SysTraceLogPack(); @@ -298,23 +331,23 @@ struct SysConsoleLogPack ConsoleLogSource ELF; ConsoleLogSource eeRecPerf; - ConsoleLogFromVM eeConsole; - ConsoleLogFromVM iopConsole; - ConsoleLogFromVM deci2; + ConsoleLogFromVM eeConsole; + ConsoleLogFromVM iopConsole; + ConsoleLogFromVM deci2; SysConsoleLogPack(); }; -extern SysTraceLogPack SysTracePack; -extern SysConsoleLogPack SysConsolePack; +extern SysTraceLogPack SysTrace; +extern SysConsoleLogPack SysConsole; // Helper macro for cut&paste. Note that we intentionally use a top-level *inline* bitcheck // against Trace.Enabled, to avoid extra overhead in Debug builds when logging is disabled. // (specifically this allows debug builds to skip havingto resolve all the parameters being // passed into the function) -#define macTrace(trace) SysTracePack.trace.IsEnabled() && SysTracePack.trace.Write +#define macTrace(trace) SysTrace.trace.IsActive() && SysTrace.trace.Write #ifdef PCSX2_DEVBUILD @@ -389,8 +422,8 @@ extern void __Log( const char* fmt, ... ); #define MEMCARDS_LOG 0&& #endif -#define ELF_LOG SysConsolePack.ELF.IsEnabled() && SysConsolePack.ELF.Write -#define eeRecPerfLog SysConsolePack.eeRecPerf.IsEnabled() && SysConsolePack.eeRecPerf -#define eeConLog SysConsolePack.eeConsole.IsEnabled() && SysConsolePack.eeConsole.Write -#define eeDeci2Log SysConsolePack.deci2.IsEnabled() && SysConsolePack.deci2.Write -#define iopConLog SysConsolePack.iopConsole.IsEnabled() && SysConsolePack.iopConsole.Write +#define ELF_LOG SysConsole.ELF.IsActive() && SysConsole.ELF.Write +#define eeRecPerfLog SysConsole.eeRecPerf.IsActive() && SysConsole.eeRecPerf +#define eeConLog SysConsole.eeConsole.IsActive() && SysConsole.eeConsole.Write +#define eeDeci2Log SysConsole.deci2.IsActive() && SysConsole.deci2.Write +#define iopConLog SysConsole.iopConsole.IsActive() && SysConsole.iopConsole.Write diff --git a/pcsx2/IopBios.cpp b/pcsx2/IopBios.cpp index 1912696ee1..8bc54553d6 100644 --- a/pcsx2/IopBios.cpp +++ b/pcsx2/IopBios.cpp @@ -460,7 +460,7 @@ namespace sysmem { // printf-style formatting processing. This part can be skipped if the user has the // console disabled. - if (!SysConsolePack.iopConsole.IsEnabled()) return 1; + if (!SysConsole.iopConsole.IsActive()) return 1; char tmp[1024], tmp2[1024]; char *ptmp = tmp; diff --git a/pcsx2/R5900OpcodeImpl.cpp b/pcsx2/R5900OpcodeImpl.cpp index d1268e1f23..a990677278 100644 --- a/pcsx2/R5900OpcodeImpl.cpp +++ b/pcsx2/R5900OpcodeImpl.cpp @@ -869,7 +869,7 @@ void SYSCALL() // The only thing this code is used for is the one log message, so don't execute it if we aren't logging bios messages. #ifdef PCSX2_DEVBUILD - if (SysTracePack.EE.Bios.IsEnabled() && (call == 0x77)) + if (SysTrace.EE.Bios.IsActive() && (call == 0x77)) { t_sif_dma_transfer *dmat; //struct t_sif_cmd_header *hdr; diff --git a/pcsx2/SourceLog.cpp b/pcsx2/SourceLog.cpp index 387ae238ef..4cfd72a0e6 100644 --- a/pcsx2/SourceLog.cpp +++ b/pcsx2/SourceLog.cpp @@ -40,8 +40,8 @@ using namespace R5900; FILE *emuLog; wxString emuLogName; -SysTraceLogPack SysTracePack; -SysConsoleLogPack SysConsolePack; +SysTraceLogPack SysTrace; +SysConsoleLogPack SysConsole; typedef void Fntype_SrcLogPrefix( FastFormatAscii& dest ); @@ -72,12 +72,12 @@ void SysTraceLog::DoWrite( const char *msg ) const void SysTraceLog_EE::ApplyPrefix( FastFormatAscii& ascii ) const { - ascii.Write( "%-4s(%8.8lx %8.8lx): ", PrePrefix, cpuRegs.pc, cpuRegs.cycle ); + ascii.Write( "%-4s(%8.8lx %8.8lx): ", ((SysTraceLogDescriptor*)m_Descriptor)->Prefix, cpuRegs.pc, cpuRegs.cycle ); } void SysTraceLog_IOP::ApplyPrefix( FastFormatAscii& ascii ) const { - ascii.Write( "%-4s(%8.8lx %8.8lx): ", PrePrefix, psxRegs.pc, psxRegs.cycle ); + ascii.Write( "%-4s(%8.8lx %8.8lx): ", ((SysTraceLogDescriptor*)m_Descriptor)->Prefix, psxRegs.pc, psxRegs.cycle ); } void SysTraceLog_VIFcode::ApplyPrefix( FastFormatAscii& ascii ) const @@ -86,179 +86,291 @@ void SysTraceLog_VIFcode::ApplyPrefix( FastFormatAscii& ascii ) const ascii.Write( "vifCode_" ); } +// -------------------------------------------------------------------------------------- +// SysConsoleLogPack (descriptions) +// -------------------------------------------------------------------------------------- +static const TraceLogDescriptor + +TLD_ELF = { + L"ELF", L"ELF", + wxLt("Dumps detailed information for PS2 executables (ELFs).") +}, + +TLD_eeRecPerf = { + L"EErecPerf", L"EErec Performance", + wxLt("Logs manual protection, split blocks, and other things that might impact performance.") +}, + +TLD_eeConsole = { + L"EEout", L"EE Console", + wxLt("Shows the game developer's logging text (EE processor)") +}, + +TLD_iopConsole = { + L"IOPout", L"IOP Console", + wxLt("Shows the game developer's logging text (IOP processor)") +}, + +TLD_deci2 = { + L"DECI2", L"DECI2 Console", + wxLt("Shows DECI2 debugging logs (EE processor)") +}; SysConsoleLogPack::SysConsoleLogPack() + : ELF (&TLD_ELF, Color_Gray) + , eeRecPerf (&TLD_eeRecPerf, Color_Gray) + , eeConsole (&TLD_eeConsole) + , iopConsole(&TLD_iopConsole) + , deci2 (&TLD_deci2) { - // Console Logging - - ELF.SetShortName(L"ELF") - .SetName(L"ELF") - .SetDescription(wxLt("Dumps detailed information for PS2 executables (ELFs).")); - - eeRecPerf.SetShortName(L"EErecPerf") - .SetName(L"EErec Performance") - .SetDescription(wxLt("Logs manual protection, split blocks, and other things that might impact performance.")) - .SetColor(Color_Gray); - - eeConsole.SetShortName(L"EEout") - .SetName(L"EE Console") - .SetDescription(wxLt("Shows the game developer's logging text (EE processor)")) - .SetColor(Color_Cyan); - - iopConsole.SetShortName(L"IOPout") - .SetName(L"IOP Console") - .SetDescription(wxLt("Shows the game developer's logging text (IOP processor)")) - .SetColor(Color_Yellow); - - deci2.SetShortName(L"DECI2") - .SetName(L"DECI2 Console") - .SetDescription(wxLt("Shows DECI2 debugging logs (EE processor)")) - .SetColor(Color_Cyan); } - + +// -------------------------------------------------------------------------------------- +// SysTraceLogPack (descriptions) +// -------------------------------------------------------------------------------------- +static const SysTraceLogDescriptor +TLD_SIF = { + L"SIF", L"SIF (EE <-> IOP)", + wxLt(""), + "SIF" +}; + +// ---------------------------- +// EmotionEngine (EE/R5900) +// ---------------------------- + +static const SysTraceLogDescriptor +TLD_EE_Bios = { + L"Bios", L"Bios", + wxLt("SYSCALL and DECI2 activity."), + "EE" +}, + +TLD_EE_Memory = { + L"Memory", L"Memory", + wxLt("Direct memory accesses to unknown or unmapped EE memory space."), + "eMem" +}, + +TLD_EE_R5900 = { + L"R5900", L"R5900 Core", + wxLt("Disasm of executing core instructions (excluding COPs and CACHE)."), + "eDis" +}, + +TLD_EE_COP0 = { + L"COP0", L"COP0", + wxLt("Disasm of COP0 instructions (MMU, cpu and dma status, etc)."), + "eDis" +}, + +TLD_EE_COP1 = { + L"FPU", L"COP1/FPU", + wxLt("Disasm of the EE's floating point unit (FPU) only."), + "eDis" +}, + +TLD_EE_COP2 = { + L"VUmacro", L"COP2/VUmacro", + wxLt("Disasm of the EE's VU0macro co-processor instructions."), + "eDis" +}, + +TLD_EE_Cache = { + L"Cache", L"Cache", + wxLt("Execution of EE cache instructions."), + "eDis" +}, + +TLD_EE_KnownHw = { + L"HwRegs", L"Hardware Regs", + wxLt("All known hardware register accesses (very slow!); not including sub filter options below."), + "eReg" +}, + +TLD_EE_UnknownHw = { + L"UnknownRegs", L"Unknown Regs", + wxLt("Logs only unknown, unmapped, or unimplemented register accesses."), + "eReg" +}, + +TLD_EE_DMAhw = { + L"DmaRegs", L"DMA Regs", + wxLt("Logs only DMA-related registers."), + "eReg" +}, + +TLD_EE_IPU = { + L"IPU", L"IPU", + wxLt("IPU activity: hardware registers, decoding operations, DMA status, etc."), + "IPU" +}, + +TLD_EE_GIFtag = { + L"GIFtags", L"GIFtags", + wxLt("All GIFtag parse activity; path index, tag type, etc."), + "GIF" +}, + +TLD_EE_VIFcode = { + L"VIFcodes", L"VIFcodes", + wxLt("All VIFcode processing; command, tag style, interrupts."), + "VIF" +}, + +TLD_EE_SPR = { + L"MFIFO", L"Scratchpad MFIFO", + wxLt("Scratchpad's MFIFO activity."), + "SPR" +}, + +TLD_EE_DMAC = { + L"DmaCtrl", L"DMA Controller", + wxLt("Actual data transfer logs, bus right arbitration, stalls, etc."), + "eDmaC" +}, + +TLD_EE_Counters = { + L"Counters", L"Counters", + wxLt("Tracks all EE counters events and some counter register activity."), + "eCnt" +}, + +TLD_EE_VIF = { + L"VIF", L"VIF", + wxLt("Dumps various VIF and VIFcode processing data."), + "VIF" +}, + +TLD_EE_GIF = { + L"GIF", L"GIF", + wxLt("Dumps various GIF and GIFtag parsing data."), + "GIF" +}; + +// ---------------------------------- +// IOP - Input / Output Processor +// ---------------------------------- + +static const SysTraceLogDescriptor +TLD_IOP_Bios = { + L"Bios", L"Bios", + wxLt("SYSCALL and IRX activity."), + "IOP" +}, + +TLD_IOP_Memory = { + L"Memory", L"Memory", + wxLt("Direct memory accesses to unknown or unmapped IOP memory space."), + "iMem" +}, + +TLD_IOP_R3000A = { + L"R3000A", L"R3000A Core", + wxLt("Disasm of executing core instructions (excluding COPs and CACHE)."), + "iDis" +}, + +TLD_IOP_COP2 = { + L"COP2/GPU", L"COP2", + wxLt("Disasm of the IOP's GPU co-processor instructions."), + "iDis" +}, + +TLD_IOP_KnownHw = { + L"HwRegs", L"Hardware Regs", + wxLt("All known hardware register accesses, not including the sub-filters below."), + "iReg" +}, + +TLD_IOP_UnknownHw = { + L"UnknownRegs", L"Unknown Regs", + wxLt("Logs only unknown, unmapped, or unimplemented register accesses."), + "iReg" +}, + +TLD_IOP_DMAhw = { + L"DmaRegs", L"DMA Regs", + wxLt("Logs only DMA-related registers."), + "iReg" +}, + +TLD_IOP_Memcards = { + L"Memorycards", L"Memorycards", + wxLt("Memorycard reads, writes, erases, terminators, and other processing."), + "Mcd" +}, + +TLD_IOP_PAD = { + L"Pad", L"Pad", + wxLt("Gamepad activity on the SIO."), + "Pad" +}, + +TLD_IOP_DMAC = { + L"DmaCrl", L"DMA Controller", + wxLt("Actual DMA event processing and data transfer logs."), + "iDmaC" +}, + +TLD_IOP_Counters = { + L"Counters", L"Counters", + wxLt("Tracks all IOP counters events and some counter register activity."), + "iCnt" +}, + +TLD_IOP_CDVD = { + L"CDVD", L"CDVD", + wxLt("Detailed logging of CDVD hardware."), + "CDVD" +}; + SysTraceLogPack::SysTraceLogPack() + : SIF (&TLD_SIF) { - SIF .SetName(L"SIF (EE <-> IOP)") - .SetShortName(L"SIF") - .SetPrefix("SIF") - .SetDescription(wxLt("")); - - // EmotionEngine (EE/R5900) - - EE.Bios .SetName(L"Bios") - .SetPrefix("EE") - .SetDescription(wxLt("SYSCALL and DECI2 activity.")); - - EE.Memory .SetName(L"Memory") - .SetPrefix("eMem") - .SetDescription(wxLt("Direct memory accesses to unknown or unmapped EE memory space.")); - - EE.R5900 .SetName(L"R5900 Core") - .SetShortName(L"R5900") - .SetPrefix("eDis") - .SetDescription(wxLt("Disasm of executing core instructions (excluding COPs and CACHE).")); - - EE.COP0 .SetName(L"COP0") - .SetPrefix("eDis") - .SetDescription(wxLt("Disasm of COP0 instructions (MMU, cpu and dma status, etc).")); - - EE.COP1 .SetName(L"COP1/FPU") - .SetShortName(L"FPU") - .SetPrefix("eDis") - .SetDescription(wxLt("Disasm of the EE's floating point unit (FPU) only.")); - - EE.COP2 .SetName(L"COP2/VUmacro") - .SetShortName(L"VUmacro") - .SetPrefix("eDis") - .SetDescription(wxLt("Disasm of the EE's VU0macro co-processor instructions.")); - - EE.Cache .SetName(L"Cache") - .SetPrefix("eDis") - .SetDescription(wxLt("Execution of EE cache instructions.")); - - EE.KnownHw .SetName(L"Hardware Regs") - .SetShortName(L"HardwareRegs") - .SetPrefix("eReg") - .SetDescription(wxLt("All known hardware register accesses (very slow!); not including sub filter options below.")); - - EE.UnknownHw.SetName(L"Unknown Regs") - .SetShortName(L"UnknownRegs") - .SetPrefix("eReg") - .SetDescription(wxLt("Logs only unknown, unmapped, or unimplemented register accesses.")); - - EE.DMAhw .SetName(L"DMA Regs") - .SetShortName(L"DmaRegs") - .SetPrefix("eReg") - .SetDescription(wxLt("Logs only DMA-related registers.")); - - EE.IPU .SetName(L"IPU") - .SetPrefix("IPU") - .SetDescription(wxLt("IPU activity: hardware registers, decoding operations, DMA status, etc.")); - - EE.GIFtag .SetName(L"GIFtags") - .SetPrefix("GIF") - .SetDescription(wxLt("All GIFtag parse activity; path index, tag type, etc.")); - - EE.VIFcode .SetName(L"VIFcodes") - .SetPrefix("VIF") - .SetDescription(wxLt("All VIFcode processing; command, tag style, interrupts.")); - - EE.SPR .SetName(L"Scratchpad MFIFO") - .SetShortName(L"ScratchpadMFIFO") - .SetPrefix("SPR") - .SetDescription(wxLt("Scratchpad's MFIFO activity.")); - - EE.DMAC .SetName(L"DMA Controller") - .SetShortName(L"DmaController") - .SetPrefix("eDmaC") - .SetDescription(wxLt("Actual data transfer logs, bus right arbitration, stalls, etc.")); - - EE.Counters .SetName(L"Counters") - .SetPrefix("eCnt") - .SetDescription(wxLt("Tracks all EE counters events and some counter register activity.")); - - EE.VIF .SetName(L"VIF") - .SetPrefix("VIF") - .SetDescription(wxLt("Dumps various VIF and VIFcode processing data.")); - - EE.GIF .SetName(L"GIF") - .SetPrefix("GIF") - .SetDescription(wxLt("Dumps various GIF and GIFtag parsing data.")); - - // IOP - Input / Output Processor - - IOP.Bios .SetName(L"Bios") - .SetPrefix("IOP") - .SetDescription(wxLt("SYSCALL and IRX activity.")); - - IOP.Memory .SetName(L"Memory") - .SetPrefix("iMem") - .SetDescription(wxLt("Direct memory accesses to unknown or unmapped IOP memory space.")); - - IOP.R3000A .SetName(L"R3000A Core") - .SetShortName(L"R3000A") - .SetPrefix("iDis") - .SetDescription(wxLt("Disasm of executing core instructions (excluding COPs and CACHE).")); - - IOP.COP2 .SetName(L"COP2/GPU") - .SetShortName(L"COP2") - .SetPrefix("iDis") - .SetDescription(wxLt("Disasm of the IOP's GPU co-processor instructions.")); - - IOP.KnownHw .SetName(L"Hardware Regs") - .SetShortName(L"HardwareRegs") - .SetPrefix("iReg") - .SetDescription(wxLt("All known hardware register accesses, not including the sub-filters below.")); - - IOP.UnknownHw.SetName(L"Unknown Regs") - .SetShortName(L"UnknownRegs") - .SetPrefix("iReg") - .SetDescription(wxLt("Logs only unknown, unmapped, or unimplemented register accesses.")); - - IOP.DMAhw .SetName(L"DMA Regs") - .SetShortName(L"DmaRegs") - .SetPrefix("iReg") - .SetDescription(wxLt("Logs only DMA-related registers.")); - - IOP.Memcards.SetName(L"Memorycards") - .SetPrefix("Mcd") - .SetDescription(wxLt("Memorycard reads, writes, erases, terminators, and other processing.")); - - IOP.PAD .SetName(L"Pad") - .SetPrefix("Pad") - .SetDescription(wxLt("Gamepad activity on the SIO.")); - - IOP.DMAC .SetName(L"DMA Controller") - .SetShortName(L"DmaController") - .SetPrefix("iDmaC") - .SetDescription(wxLt("Actual DMA event processing and data transfer logs.")); - - IOP.Counters.SetName(L"Counters") - .SetPrefix("iCnt") - .SetDescription(wxLt("Tracks all IOP counters events and some counter register activity.")); - - IOP.CDVD .SetName(L"CDVD") - .SetPrefix("CDVD") - .SetDescription(wxLt("Detailed logging of CDVD hardware.")); } +SysTraceLogPack::EE_PACK::EE_PACK() + : Bios (&TLD_EE_Bios) + , Memory (&TLD_EE_Memory) + , GIFtag (&TLD_EE_GIFtag) + , VIFcode (&TLD_EE_VIFcode) + + , R5900 (&TLD_EE_R5900) + , COP0 (&TLD_EE_COP0) + , COP1 (&TLD_EE_COP1) + , COP2 (&TLD_EE_COP2) + , Cache (&TLD_EE_Cache) + + , KnownHw (&TLD_EE_KnownHw) + , UnknownHw (&TLD_EE_UnknownHw) + , DMAhw (&TLD_EE_DMAhw) + , IPU (&TLD_EE_IPU) + + , DMAC (&TLD_EE_DMAC) + , Counters (&TLD_EE_Counters) + , SPR (&TLD_EE_SPR) + + , VIF (&TLD_EE_VIF) + , GIF (&TLD_EE_GIF) +{ +} + +SysTraceLogPack::IOP_PACK::IOP_PACK() + : Bios (&TLD_IOP_Bios) + , Memcards (&TLD_IOP_Memcards) + , PAD (&TLD_IOP_PAD) + + , R3000A (&TLD_IOP_R3000A) + , COP2 (&TLD_IOP_COP2) + , Memory (&TLD_IOP_Memory) + + , KnownHw (&TLD_IOP_KnownHw) + , UnknownHw (&TLD_IOP_UnknownHw) + , DMAhw (&TLD_IOP_DMAhw) + + , DMAC (&TLD_IOP_DMAC) + , Counters (&TLD_IOP_Counters) + , CDVD (&TLD_IOP_CDVD) +{ +} \ No newline at end of file diff --git a/pcsx2/gui/ConsoleLogger.cpp b/pcsx2/gui/ConsoleLogger.cpp index db91b3917c..a3319d8790 100644 --- a/pcsx2/gui/ConsoleLogger.cpp +++ b/pcsx2/gui/ConsoleLogger.cpp @@ -324,11 +324,11 @@ public: static ConsoleLogSource* const ConLogSources[] = { - (ConsoleLogSource*)&SysConsolePack.eeConsole, - (ConsoleLogSource*)&SysConsolePack.iopConsole, - (ConsoleLogSource*)&SysConsolePack.eeRecPerf, + (ConsoleLogSource*)&SysConsole.eeConsole, + (ConsoleLogSource*)&SysConsole.iopConsole, + (ConsoleLogSource*)&SysConsole.eeRecPerf, NULL, - (ConsoleLogSource*)&SysConsolePack.ELF, + (ConsoleLogSource*)&SysConsole.ELF, NULL, (ConsoleLogSource*)&pxConLog_Event, (ConsoleLogSource*)&pxConLog_Thread, @@ -441,9 +441,9 @@ ConsoleLogFrame::ConsoleLogFrame( MainEmuFrame *parent, const wxString& title, A uint srcnt = ArraySize(ConLogSources); for (uint i=0; iName, log->GetDescription(), wxITEM_CHECK ); + menuSources.Append( MenuId_LogSource_Start+i, log->GetName(), log->GetDescription(), wxITEM_CHECK ); Connect( MenuId_LogSource_Start+i, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(ConsoleLogFrame::OnToggleSource)); } else @@ -547,7 +547,7 @@ void ConsoleLogFrame::OnLoggingChanged() { if (const ConsoleLogSource* log = ConLogSources[i]) { - GetMenuBar()->Check( MenuId_LogSource_Start+i, log->IsEnabled() ); + GetMenuBar()->Check( MenuId_LogSource_Start+i, log->IsActive() ); } } } diff --git a/pcsx2/gui/ExecutorThread.cpp b/pcsx2/gui/ExecutorThread.cpp index f28cfeb7c7..e822cb7c7c 100644 --- a/pcsx2/gui/ExecutorThread.cpp +++ b/pcsx2/gui/ExecutorThread.cpp @@ -32,6 +32,17 @@ bool ConsoleLogSource_Event::Error( const pxEvtHandler* evtHandler, const SysExe return _parent::Write( wxsFormat(L"(%s%s) ", evtHandler->GetEventHandlerName().c_str(), evt->GetEventName().c_str()) + msg ); } +ConsoleLogSource_Event::ConsoleLogSource_Event() +{ + static const TraceLogDescriptor myDesc = + { + L"SysEvents", L"SysVM Control Events", + wxLt("Logs events as they are passed to the PS2 virtual machine."), + }; + + m_Descriptor = &myDesc; +} + ConsoleLogSource_Event pxConLog_Event; // -------------------------------------------------------------------------------------- diff --git a/pcsx2/gui/Panels/LogOptionsPanels.cpp b/pcsx2/gui/Panels/LogOptionsPanels.cpp index 561afc2d03..1bda114407 100644 --- a/pcsx2/gui/Panels/LogOptionsPanels.cpp +++ b/pcsx2/gui/Panels/LogOptionsPanels.cpp @@ -121,47 +121,47 @@ void Panels::iopLogOptionsPanel::OnSettingsChanged() static SysTraceLog * const traceLogList[] = { - &SysTracePack.SIF, + &SysTrace.SIF, - &SysTracePack.EE.Bios, - &SysTracePack.EE.Memory, + &SysTrace.EE.Bios, + &SysTrace.EE.Memory, - &SysTracePack.EE.R5900, - &SysTracePack.EE.COP0, - &SysTracePack.EE.COP1, - &SysTracePack.EE.COP2, - &SysTracePack.EE.Cache, + &SysTrace.EE.R5900, + &SysTrace.EE.COP0, + &SysTrace.EE.COP1, + &SysTrace.EE.COP2, + &SysTrace.EE.Cache, - &SysTracePack.EE.KnownHw, - &SysTracePack.EE.UnknownHw, - &SysTracePack.EE.DMAhw, - &SysTracePack.EE.IPU, - &SysTracePack.EE.GIFtag, - &SysTracePack.EE.VIFcode, + &SysTrace.EE.KnownHw, + &SysTrace.EE.UnknownHw, + &SysTrace.EE.DMAhw, + &SysTrace.EE.IPU, + &SysTrace.EE.GIFtag, + &SysTrace.EE.VIFcode, - &SysTracePack.EE.DMAC, - &SysTracePack.EE.Counters, - &SysTracePack.EE.SPR, - &SysTracePack.EE.VIF, - &SysTracePack.EE.GIF, + &SysTrace.EE.DMAC, + &SysTrace.EE.Counters, + &SysTrace.EE.SPR, + &SysTrace.EE.VIF, + &SysTrace.EE.GIF, // IOP Section - &SysTracePack.IOP.Bios, - &SysTracePack.IOP.Memcards, - &SysTracePack.IOP.PAD, + &SysTrace.IOP.Bios, + &SysTrace.IOP.Memcards, + &SysTrace.IOP.PAD, - &SysTracePack.IOP.R3000A, - &SysTracePack.IOP.COP2, - &SysTracePack.IOP.Memory, + &SysTrace.IOP.R3000A, + &SysTrace.IOP.COP2, + &SysTrace.IOP.Memory, - &SysTracePack.IOP.KnownHw, - &SysTracePack.IOP.UnknownHw, - &SysTracePack.IOP.DMAhw, - &SysTracePack.IOP.DMAC, - &SysTracePack.IOP.Counters, - &SysTracePack.IOP.CDVD, + &SysTrace.IOP.KnownHw, + &SysTrace.IOP.UnknownHw, + &SysTrace.IOP.DMAhw, + &SysTrace.IOP.DMAC, + &SysTrace.IOP.Counters, + &SysTrace.IOP.CDVD, }; static const int traceLogCount = ArraySize(traceLogList); @@ -174,7 +174,7 @@ void SysTraceLog_LoadSaveSettings( IniInterface& ini ) { if (SysTraceLog* log = traceLogList[i]) { - pxAssertMsg(log->Name, "Trace log without a name!" ); + pxAssertMsg(log->GetName(), "Trace log without a name!" ); ini.Entry( log->GetCategory() + L"." + log->GetShortName(), log->Enabled, false ); } } @@ -193,7 +193,7 @@ static bool traceLogEnabled( const wxString& ident ) return traceLogList[i]->Enabled; } - pxAssertDev( false, wxsFormat(L"Invalid or unknown TraceLog identifier: %s", ident.c_str()) ); + pxFailDev( wxsFormat(L"Invalid or unknown TraceLog identifier: %s", ident.c_str()) ); return false; } @@ -213,7 +213,7 @@ Panels::LogOptionsPanel::LogOptionsPanel(wxWindow* parent ) { const SysTraceLog& item = *traceLogList[i]; - pxAssertMsg(item.Name, "Trace log without a name!" ); + pxAssertMsg(item.GetName(), "Trace log without a name!" ); wxStringTokenizer token( item.GetCategory(), L"." ); wxSizer* addsizer = NULL; @@ -240,8 +240,8 @@ Panels::LogOptionsPanel::LogOptionsPanel(wxWindow* parent ) addparent = this; } - *addsizer += m_checks[i] = new pxCheckBox( addparent, item.Name ); - if( m_checks[i] && item.Description ) + *addsizer += m_checks[i] = new pxCheckBox( addparent, item.GetName() ); + if( m_checks[i] && item.HasDescription() ) m_checks[i]->SetToolTip(item.GetDescription()); } @@ -324,7 +324,7 @@ void Panels::LogOptionsPanel::Apply() } } -#define GetSet( cpu, name ) SysTracePack.cpu.name.Enabled = m_##name->GetValue() +#define GetSet( cpu, name ) SysTrace.cpu.name.Enabled = m_##name->GetValue() void Panels::eeLogOptionsPanel::Apply() { diff --git a/pcsx2/gui/pxEventThread.h b/pcsx2/gui/pxEventThread.h index cb4856b943..5ffe072519 100644 --- a/pcsx2/gui/pxEventThread.h +++ b/pcsx2/gui/pxEventThread.h @@ -34,13 +34,9 @@ class ConsoleLogSource_Event : ConsoleLogSource typedef ConsoleLogSource _parent; public: - using _parent::IsEnabled; + using _parent::IsActive; - ConsoleLogSource_Event() - { - Name = L"PS2vm Events"; - Description = wxLt("Logs events as they are passed to the PS2 virtual machine."); - } + ConsoleLogSource_Event(); bool Write( const pxEvtHandler* evtHandler, const SysExecEvent* evt, const wxChar* msg ); bool Warn( const pxEvtHandler* evtHandler, const SysExecEvent* evt, const wxChar* msg ); @@ -49,7 +45,7 @@ public: extern ConsoleLogSource_Event pxConLog_Event; -#define pxEvtLog pxConLog_Event.IsEnabled() && pxConLog_Event +#define pxEvtLog pxConLog_Event.IsActive() && pxConLog_Event // -------------------------------------------------------------------------------------- diff --git a/pcsx2/ps2/Iop/IopHwWrite.cpp b/pcsx2/ps2/Iop/IopHwWrite.cpp index 96adc0092b..d689ae6482 100644 --- a/pcsx2/ps2/Iop/IopHwWrite.cpp +++ b/pcsx2/ps2/Iop/IopHwWrite.cpp @@ -111,7 +111,7 @@ void __fastcall iopHwWrite8_Page3( u32 addr, mem8_t val ) // all addresses are assumed to be prefixed with 0x1f803xxx: pxAssert( (addr >> 12) == 0x1f803 ); - if( SysConsolePack.iopConsole.IsEnabled() && (addr == 0x1f80380c) ) // STDOUT + if( SysConsole.iopConsole.IsActive() && (addr == 0x1f80380c) ) // STDOUT { static char pbuf[1024]; static int pidx; diff --git a/pcsx2/x86/iCore.cpp b/pcsx2/x86/iCore.cpp index 607bd0a046..6c42bacd8d 100644 --- a/pcsx2/x86/iCore.cpp +++ b/pcsx2/x86/iCore.cpp @@ -997,7 +997,7 @@ int _signExtendXMMtoM(u32 to, x86SSERegType from, int candestroy) return 0; } - pxAssert( false ); + pxAssume( false ); } int _allocCheckGPRtoXMM(EEINST* pinst, int gprreg, int mode) @@ -1076,7 +1076,7 @@ void _recFillRegister(EEINST& pinst, int type, int reg, int write) return; } } - pxAssert( false ); + pxAssume( false ); } else { for(i = 0; i < ArraySize(pinst.readType); ++i) { @@ -1086,7 +1086,7 @@ void _recFillRegister(EEINST& pinst, int type, int reg, int write) return; } } - pxAssert( false ); + pxAssume( false ); } } diff --git a/pcsx2/x86/iR3000A.cpp b/pcsx2/x86/iR3000A.cpp index 87c547271f..b6daf75a70 100644 --- a/pcsx2/x86/iR3000A.cpp +++ b/pcsx2/x86/iR3000A.cpp @@ -670,7 +670,7 @@ void psxRecompileCodeConst1(R3000AFNPTR constcode, R3000AFNPTR_INFO noconstcode) const char *funcname = irxImportFuncname(libname, index); irxDEBUG debug = irxImportDebug(libname, index); - if (SysTracePack.IOP.Bios.IsEnabled()) { + if (SysTrace.IOP.Bios.IsActive()) { xMOV(ecx, (uptr)libname); xMOV(edx, index); xPUSH((uptr)funcname); diff --git a/pcsx2/x86/ix86-32/iCore-32.cpp b/pcsx2/x86/ix86-32/iCore-32.cpp index e1bdeaafd1..0e9320e10f 100644 --- a/pcsx2/x86/ix86-32/iCore-32.cpp +++ b/pcsx2/x86/ix86-32/iCore-32.cpp @@ -478,7 +478,7 @@ __fi void* _MMXGetAddr(int reg) if( reg >= MMX_FPU && reg < MMX_FPU+32 ) return &fpuRegs.fpr[reg&31]; if( reg >= MMX_COP0 && reg < MMX_COP0+32 ) return &cpuRegs.CP0.r[reg&31]; - pxAssert( false ); + pxAssume( false ); return NULL; } diff --git a/pcsx2/x86/ix86-32/iR5900-32.cpp b/pcsx2/x86/ix86-32/iR5900-32.cpp index 82ade41ff1..dfb8c3654d 100644 --- a/pcsx2/x86/ix86-32/iR5900-32.cpp +++ b/pcsx2/x86/ix86-32/iR5900-32.cpp @@ -884,7 +884,7 @@ void recClear(u32 addr, u32 size) if( !IsDevBuild ) Console.Error( "Impossible block clearing failure" ); else - pxAssertDev( false, "Impossible block clearing failure" ); + pxFailDev( "Impossible block clearing failure" ); } }