SPU2-X: Some improvements to the developer debug window.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4215 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gigaherz 2011-01-15 23:41:22 +00:00
parent e8666897ba
commit 1e2dbc6a22
4 changed files with 132 additions and 24 deletions

View File

@ -126,6 +126,11 @@ StereoOut32 V_Core::ReadInput()
); );
} }
#ifdef PCSX2_DEVBUILD
DebugCores[Index].admaWaveformL[InputPosRead%0x100]=retval.Left;
DebugCores[Index].admaWaveformR[InputPosRead%0x100]=retval.Right;
#endif
InputPosRead++; InputPosRead++;
if( (InputPosRead==0x100) || (InputPosRead>=0x200) ) if( (InputPosRead==0x100) || (InputPosRead>=0x200) )
{ {

View File

@ -59,7 +59,7 @@ void UpdateDebugDialog()
if(!hf) if(!hf)
{ {
hf = CreateFont( 8, 0, 0, 0, 0, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, hf = CreateFont( 12, 0, 0, 0, 0, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, L"Lucida Console" ); DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, L"Lucida Console" );
} }
@ -69,12 +69,17 @@ void UpdateDebugDialog()
for(int c=0;c<2;c++) for(int c=0;c<2;c++)
{ {
V_Core& cx(Cores[c]);
V_CoreDebug& cd(DebugCores[c]);
for(int v=0;v<24;v++) for(int v=0;v<24;v++)
{ {
int IX = 8+256*c; int cc = c*2 + (v/12);
int IY = 8+ 32*v; int vv = v % 12;
V_Voice& vc(Cores[c].Voices[v]); int IX = 8+128*cc;
V_VoiceDebug& vcd( DebugCores[c].Voices[v] ); int IY = 8+ 48*vv;
V_Voice& vc(cx.Voices[v]);
V_VoiceDebug& vcd(cd.Voices[v] );
SetDCBrushColor(hdc,RGB( 0, 0, 0)); SetDCBrushColor(hdc,RGB( 0, 0, 0));
if((vc.ADSR.Phase>0)&&(vc.ADSR.Phase<6)) if((vc.ADSR.Phase>0)&&(vc.ADSR.Phase<6))
@ -94,27 +99,55 @@ void UpdateDebugDialog()
} }
}*/ }*/
FillRectangle(hdc,IX,IY,252,30); FillRectangle(hdc,IX,IY,124,46);
SetDCPenColor(hdc,RGB( 255, 128, 32)); SetDCPenColor(hdc,RGB( 255, 128, 32));
DrawRectangle(hdc,IX,IY,252,30); DrawRectangle(hdc,IX,IY,124,46);
SetDCBrushColor (hdc,RGB( 0,255, 0)); SetDCBrushColor(hdc,RGB( 0,255, 0));
int vl = abs(((vc.Volume.Left.Value >> 16) * 24) >> 15); int vl = abs(((vc.Volume.Left.Value >> 16) * 38) >> 15);
int vr = abs(((vc.Volume.Right.Value >> 16) * 24) >> 15); int vr = abs(((vc.Volume.Right.Value >> 16) * 38) >> 15);
FillRectangle(hdc,IX+38,IY+26 - vl, 4, vl); FillRectangle(hdc,IX+58,IY+42 - vl, 4, vl);
FillRectangle(hdc,IX+42,IY+26 - vr, 4, vr); FillRectangle(hdc,IX+62,IY+42 - vr, 4, vr);
int adsr = (vc.ADSR.Value>>16) * 24 / 32768; int adsr = ((vc.ADSR.Value>>16) * 38) / 32768;
FillRectangle(hdc,IX+48,IY+26 - adsr, 4, adsr); FillRectangle(hdc,IX+66,IY+42 - adsr, 4, adsr);
int peak = vcd.displayPeak * 24 / 32768; int peak = (vcd.displayPeak * 38) / 32768;
FillRectangle(hdc,IX+56,IY+26 - peak, 4, peak); if(vcd.displayPeak >= 32700) // leave a little bit of margin
{
SetDCBrushColor(hdc,RGB( 255, 0, 0));
}
FillRectangle(hdc,IX+70,IY+42 - peak, 4, peak);
if(vc.ADSR.Value>0)
{
if(vc.SBuffer)
for(int i=0;i<28;i++)
{
int val = ((int)vc.SBuffer[i] * 20) / 32768;
int y=0;
if(val>0)
{
y=val;
}
else
val=-val;
if(val!=0)
{
FillRectangle(hdc,IX+90+i,IY+24-y, 1, val);
}
}
}
SetTextColor(hdc,RGB( 0,255, 0)); SetTextColor(hdc,RGB( 0,255, 0));
SetBkColor (hdc,RGB( 0, 0, 0)); SetBkColor (hdc,RGB( 0, 0, 0));
@ -125,10 +158,10 @@ void UpdateDebugDialog()
TextOut(hdc,IX+4,IY+3,t,6); TextOut(hdc,IX+4,IY+3,t,6);
swprintf_s(t,L"%06x",vc.NextA); swprintf_s(t,L"%06x",vc.NextA);
TextOut(hdc,IX+4,IY+12,t,6); TextOut(hdc,IX+4,IY+16,t,6);
swprintf_s(t,L"%06x",vc.LoopStartA); swprintf_s(t,L"%06x",vc.LoopStartA);
TextOut(hdc,IX+4,IY+21,t,6); TextOut(hdc,IX+4,IY+29,t,6);
vcd.displayPeak = 0; vcd.displayPeak = 0;
@ -139,7 +172,74 @@ void UpdateDebugDialog()
vcd.lastSetStartA = vc.StartA; vcd.lastSetStartA = vc.StartA;
} }
} }
// top now: 400
int JX = 8 + c * 256;
int JY = 578;
SetDCBrushColor(hdc,RGB( 0, 0, 0));
SetDCPenColor(hdc,RGB( 255, 128, 32));
FillRectangle(hdc,JX,JY,252,46);
DrawRectangle(hdc,JX,JY,252,46);
SetTextColor(hdc,RGB(255,255,255));
SetBkColor (hdc,RGB( 0, 0, 0));
TextOut(hdc,JX+4,JY+ 3,L"REVB",4);
TextOut(hdc,JX+4,JY+16,L"IRQE",4);
TextOut(hdc,JX+4,JY+29,L"ADMA",4);
SetDCBrushColor(hdc,RGB( 0,255, 0));
if(cx.FxEnable)
{
FillRectangle(hdc,JX+40,JY+3,10,10);
}
if(cx.IRQEnable)
{
FillRectangle(hdc,JX+40,JY+16,10,10);
}
if(cx.AutoDMACtrl != 0)
{
FillRectangle(hdc,JX+40,JY+29,10,10);
for(int j=0;j<64;j++)
{
int i=j*256/64;
int val = (cd.admaWaveformL[i] * 20) / 32768;
int y=0;
if(val>0)
y=val;
else
val=-val;
if(val!=0)
{
FillRectangle(hdc,JX+60+j,JY+24-y, 1, val);
}
}
for(int j=0;j<64;j++)
{
int i=j*256/64;
int val = (cd.admaWaveformR[i] * 20) / 32768;
int y=0;
if(val>0)
y=val;
else
val=-val;
if(val!=0)
{
FillRectangle(hdc,JX+136+j,JY+24-y, 1, val);
}
}
}
} }
ReleaseDC(hDebugDialog,hdc); ReleaseDC(hDebugDialog,hdc);
lCount=0; lCount=0;
} }

View File

@ -9,7 +9,6 @@
// //
#include "svnrev.h" #include "svnrev.h"
#include "afxresmw.h" #include "afxresmw.h"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS #undef APSTUDIO_READONLY_SYMBOLS
@ -80,12 +79,12 @@ BEGIN
COMBOBOX IDC_SYNCHMODE,163,103,134,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_SYNCHMODE,163,103,134,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
END END
IDD_DEBUG DIALOGEX 0, 0, 306, 551 IDD_DEBUG DIALOGEX 0, 0, 303, 443
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "SPU2-X Debug" CAPTION "SPU2-X Debug"
FONT 9, "Lucida Console", 400, 0, 0x0 FONT 9, "Lucida Console", 400, 0, 0x0
BEGIN BEGIN
DEFPUSHBUTTON "Close",IDOK,249,530,50,14 DEFPUSHBUTTON "Close",IDOK,246,421,50,14
END END
IDD_DSOUND DIALOGEX 0, 0, 196, 218 IDD_DSOUND DIALOGEX 0, 0, 196, 218
@ -102,7 +101,8 @@ BEGIN
CTEXT "8 (80 ms latency)",IDC_LATENCY_LABEL,44,123,95,11 CTEXT "8 (80 ms latency)",IDC_LATENCY_LABEL,44,123,95,11
LTEXT "The options above are useful for compatibility with older and/or buggy sound drivers ONLY, and should not be checked unless you experience sound problems (such as crackly audio or silence).",IDC_STATIC,16,68,175,38 LTEXT "The options above are useful for compatibility with older and/or buggy sound drivers ONLY, and should not be checked unless you experience sound problems (such as crackly audio or silence).",IDC_STATIC,16,68,175,38
CONTROL "Disable Global Focus",IDC_GLOBALFOCUS_DISABLE,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,4,38,140,10 CONTROL "Disable Global Focus",IDC_GLOBALFOCUS_DISABLE,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,4,38,140,10
CONTROL "Use a crappy alternate buffering mode",IDC_USE_HARDWARE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,4,53,140,10 CONTROL "Use a crappy alternate buffering mode",IDC_USE_HARDWARE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,4,53,140,10
GROUPBOX "Output Buffers",IDC_STATIC,4,111,185,79 GROUPBOX "Output Buffers",IDC_STATIC,4,111,185,79
END END
@ -211,9 +211,9 @@ BEGIN
IDD_DEBUG, DIALOG IDD_DEBUG, DIALOG
BEGIN BEGIN
LEFTMARGIN, 7 LEFTMARGIN, 7
RIGHTMARGIN, 299 RIGHTMARGIN, 296
TOPMARGIN, 7 TOPMARGIN, 7
BOTTOMMARGIN, 544 BOTTOMMARGIN, 435
END END
IDD_DSOUND, DIALOG IDD_DSOUND, DIALOG

View File

@ -211,6 +211,9 @@ struct V_CoreDebug
V_VoiceDebug Voices[24]; V_VoiceDebug Voices[24];
// Last Transfer Size // Last Transfer Size
u32 lastsize; u32 lastsize;
s32 admaWaveformL[0x100];
s32 admaWaveformR[0x100];
}; };
// Debug tracking information - 24 voices and 2 cores. // Debug tracking information - 24 voices and 2 cores.