From 02d5ed7f4517a7bab4402d7ba7b4dbeba71f5fb5 Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Mon, 4 Oct 2010 17:22:54 +0000 Subject: [PATCH] * Implemented GIF PATH/TAG logging option. * Some other EE/Core logging additions and formatting tweaks. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3870 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/Counters.cpp | 6 +++-- pcsx2/DebugTools/Debug.h | 1 + pcsx2/Vif_Transfer.cpp | 6 ++--- pcsx2/ps2/GIFpath.cpp | 31 +++++++++++++++++++++- pcsx2/ps2/eeHwTraceLog.inl | 4 +-- pcsx2/windows/VCprojects/pcsx2_2008.vcproj | 8 +++--- pcsx2/x86/iR3000A.cpp | 5 ++++ 7 files changed, 49 insertions(+), 12 deletions(-) diff --git a/pcsx2/Counters.cpp b/pcsx2/Counters.cpp index 079cbdacc3..14b78c9196 100644 --- a/pcsx2/Counters.cpp +++ b/pcsx2/Counters.cpp @@ -347,7 +347,8 @@ static __fi void VSyncStart(u32 sCycle) GetCoreThread().VsyncInThread(); Cpu->CheckExecutionState(); - EECNT_LOG( "///////// EE COUNTER VSYNC START (frame: %6d) \\\\\\\\\\\\\\\\\\\\ ", g_FrameCount ); + if(EmuConfig.Trace.Enabled && EmuConfig.Trace.EE.m_EnableAll) + SysTrace.EE.Counters.Write( " ================ EE COUNTER VSYNC START (frame: %d) ================", g_FrameCount ); // EE Profiling and Debug code. // FIXME: should probably be moved to VsyncInThread, and handled @@ -393,7 +394,8 @@ static __fi void VSyncStart(u32 sCycle) static __fi void VSyncEnd(u32 sCycle) { - EECNT_LOG( "///////// EE COUNTER VSYNC END (frame: %d) \\\\\\\\\\\\\\\\\\\\", g_FrameCount ); + if(EmuConfig.Trace.Enabled && EmuConfig.Trace.EE.m_EnableAll) + SysTrace.EE.Counters.Write( " ================ EE COUNTER VSYNC END (frame: %d) ================", g_FrameCount ); g_FrameCount++; diff --git a/pcsx2/DebugTools/Debug.h b/pcsx2/DebugTools/Debug.h index 737fb62f3d..505b83320c 100644 --- a/pcsx2/DebugTools/Debug.h +++ b/pcsx2/DebugTools/Debug.h @@ -373,6 +373,7 @@ extern void __Log( const char* fmt, ... ); #define GIF_LOG macTrace(EE.GIF) #define EECNT_LOG macTrace(EE.Counters) #define VifCodeLog macTrace(EE.VIFcode) +#define GifTagLog macTrace(EE.GIFpath) #define PSXBIOS_LOG macTrace(IOP.Bios) diff --git a/pcsx2/Vif_Transfer.cpp b/pcsx2/Vif_Transfer.cpp index 18a8428142..a4455dd3c8 100644 --- a/pcsx2/Vif_Transfer.cpp +++ b/pcsx2/Vif_Transfer.cpp @@ -85,9 +85,9 @@ _vifT void vifTransferLoop(u32* &data) { vifXRegs.code = data[0]; vifX.cmd = data[0] >> 24; iBit = data[0] >> 31; - - vifCmdHandler[idx][vifX.cmd & 0x7f](0, data); + VIF_LOG("New VifCMD %x tagsize %x", vifX.cmd, vifX.tag.size); + vifCmdHandler[idx][vifX.cmd & 0x7f](0, data); data++; pSize--; if (analyzeIbit(data, iBit)) break; continue; @@ -98,7 +98,7 @@ _vifT void vifTransferLoop(u32* &data) { pSize -= ret; if (analyzeIbit(data, iBit)) break; } - + if (pSize) vifX.vifstalled = true; } diff --git a/pcsx2/ps2/GIFpath.cpp b/pcsx2/ps2/GIFpath.cpp index 028529166b..3e561dcf30 100644 --- a/pcsx2/ps2/GIFpath.cpp +++ b/pcsx2/ps2/GIFpath.cpp @@ -74,8 +74,37 @@ struct GIFTAG u32 REGS[2]; GIFTAG() {} + + wxString DumpRegsToString() const; }; +wxString GIFTAG::DumpRegsToString() const +{ + static const char* PackedModeRegsLabel[] = + { + "PRIM", "RGBA", "STQ", "UV", + "XYZF2", "XYZ2", "TEX0_1", "TEX0_2", + "CLAMP_1", "CLAMP_2", "FOG", "Unknown", + "XYZF3", "XYZ3", "A_D", "NOP" + }; + + u32 tempreg = REGS[0]; + uint numregs = ((NREG-1)&0xf) + 1; + + FastFormatUnicode result; + result.Write("NREG=0x%02X (", NREG); + + for (u32 i = 0; i < numregs; i++) { + if (i == 8) tempreg = REGS[1]; + if (i > 0) result.Write(" "); + result.Write(PackedModeRegsLabel[tempreg & 0xf]); + tempreg >>= 4; + } + + result.Write(")"); + return result; +} + // -------------------------------------------------------------------------------------- // GIFPath -- PS2 GIFtag info (one for each path). // -------------------------------------------------------------------------------------- @@ -655,7 +684,7 @@ __fi int GIFPath::CopyTag(const u128* pMem128, u32 size) switch(tag.FLG) { case GIF_FLG_PACKED: - GIF_LOG("Packed Mode EOP %x", tag.EOP); + GIF_LOG("Packed Mode EOP %x : %ls", tag.EOP, tag.DumpRegsToString().c_str()); PrepPackedRegs(); if(DetectE > 0) diff --git a/pcsx2/ps2/eeHwTraceLog.inl b/pcsx2/ps2/eeHwTraceLog.inl index bfe8093677..b39e807c6e 100644 --- a/pcsx2/ps2/eeHwTraceLog.inl +++ b/pcsx2/ps2/eeHwTraceLog.inl @@ -21,12 +21,12 @@ static __ri bool _eelog_enabled( u32 addr ) { // Selective enable/disable ability for specific register maps - if (eeAddrInRange(RCNT0, addr)) return false; + if (eeAddrInRange(RCNT0, addr)) return true; if (eeAddrInRange(RCNT1, addr)) return true; if (eeAddrInRange(RCNT2, addr)) return true; if (eeAddrInRange(RCNT3, addr)) return true; - if (eeAddrInRange(SBUS, addr)) return false; + if (eeAddrInRange(SBUS, addr)) return true; // INTC! if (addr == INTC_STAT || addr == INTC_MASK) return true; diff --git a/pcsx2/windows/VCprojects/pcsx2_2008.vcproj b/pcsx2/windows/VCprojects/pcsx2_2008.vcproj index 16ebf1cf41..470d58976c 100644 --- a/pcsx2/windows/VCprojects/pcsx2_2008.vcproj +++ b/pcsx2/windows/VCprojects/pcsx2_2008.vcproj @@ -2039,10 +2039,6 @@ RelativePath="..\..\gui\Dialogs\ConfirmationDialogs.cpp" > - - @@ -2884,6 +2880,10 @@ + + diff --git a/pcsx2/x86/iR3000A.cpp b/pcsx2/x86/iR3000A.cpp index 6fc18f0bbd..88dbcda10b 100644 --- a/pcsx2/x86/iR3000A.cpp +++ b/pcsx2/x86/iR3000A.cpp @@ -879,6 +879,11 @@ static __noinline s32 recExecuteBlock( s32 eeCycles ) iopBreak = 0; iopCycleEE = eeCycles; +#ifdef PCSX2_DEVBUILD + if (SysTrace.SIF.IsActive()) + SysTrace.IOP.R3000A.Write("Switching to IOP CPU for %d cycles", eeCycles); +#endif + // [TODO] recExecuteBlock could be replaced by a direct call to the iopEnterRecompiledCode() // (by assigning its address to the psxRec structure). But for that to happen, we need // to move iopBreak/iopCycleEE update code to emitted assembly code. >_< --air