Added some statistics to better identify the type of dump you are using.

Fixed some code to be coherent with actual pcsx2 state. (Still need to talk to Jake to understand the new changes)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4109 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
feal87@gmail.com 2010-12-19 21:32:09 +00:00
parent 36f9dcfcfa
commit f1e5814c8b
6 changed files with 251 additions and 26 deletions

View File

@ -119,7 +119,19 @@ namespace GSDumpGUI
case MessageType.SizeDump:
frmMain.Invoke(new Action<object>(delegate(object e)
{
frmMain.txtDumpSize.Text = (((int)Mess.Parameters[0]) / 1024f / 1024f).ToString("F2");
frmMain.txtDumpSize.Text = (((int)Mess.Parameters[0]) / 1024f / 1024f).ToString("F2") + " MB";
}), new object[] { null });
break;
case MessageType.Statistics:
frmMain.Invoke(new Action<object>(delegate(object e)
{
frmMain.txtGIFPackets.Text = ((int)Mess.Parameters[0]).ToString();
frmMain.txtPath1.Text = ((int)Mess.Parameters[1]).ToString();
frmMain.txtPath2.Text = ((int)Mess.Parameters[2]).ToString();
frmMain.txtPath3.Text = ((int)Mess.Parameters[3]).ToString();
frmMain.txtReadFifo.Text = ((int)Mess.Parameters[5]).ToString();
frmMain.txtVSync.Text = ((int)Mess.Parameters[4]).ToString();
frmMain.txtRegisters.Text = ((int)Mess.Parameters[6]).ToString();
}), new object[] { null });
break;
default:
@ -129,6 +141,7 @@ namespace GSDumpGUI
static void Client_OnMessageReceived(TCPLibrary.Core.Client sender, TCPLibrary.MessageBased.Core.TCPMessage Mess)
{
TCPMessage msg;
switch (Mess.MessageType)
{
case TCPLibrary.MessageBased.Core.MessageType.Connect:
@ -136,7 +149,7 @@ namespace GSDumpGUI
case TCPLibrary.MessageBased.Core.MessageType.MaxUsers:
break;
case TCPLibrary.MessageBased.Core.MessageType.SizeDump:
TCPMessage msg = new TCPMessage();
msg = new TCPMessage();
msg.MessageType = MessageType.SizeDump;
if (dump != null)
msg.Parameters.Add(dump.Size);
@ -144,6 +157,31 @@ namespace GSDumpGUI
msg.Parameters.Add(0);
Client.Send(msg);
break;
case MessageType.Statistics:
msg = new TCPMessage();
msg.MessageType = MessageType.Statistics;
if (dump != null)
{
msg.Parameters.Add(dump.Data.Count);
msg.Parameters.Add(dump.Data.FindAll(a => (int)a.id == 0 && (a.data[0] == 3 || a.data[0] == 0)).Count);
msg.Parameters.Add(dump.Data.FindAll(a => (int)a.id == 0 && a.data[0] == 1).Count);
msg.Parameters.Add(dump.Data.FindAll(a => (int)a.id == 0 && a.data[0] == 2).Count);
msg.Parameters.Add(dump.Data.FindAll(a => (int)a.id == 1).Count);
msg.Parameters.Add(dump.Data.FindAll(a => (int)a.id == 2).Count);
msg.Parameters.Add(dump.Data.FindAll(a => (int)a.id == 3).Count);
}
else
{
msg.Parameters.Add(0);
msg.Parameters.Add(0);
msg.Parameters.Add(0);
msg.Parameters.Add(0);
msg.Parameters.Add(0);
msg.Parameters.Add(0);
msg.Parameters.Add(0);
}
Client.Send(msg);
break;
default:
break;
}

View File

@ -59,6 +59,20 @@
this.lblDumpSize = new System.Windows.Forms.Label();
this.txtDumpSize = new System.Windows.Forms.Label();
this.lblWIP = new System.Windows.Forms.Label();
this.txtGIFPackets = new System.Windows.Forms.Label();
this.lblGIFPackets = new System.Windows.Forms.Label();
this.txtPath1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.txtPath2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.txtPath3 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.txtVSync = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.txtReadFifo = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.txtRegisters = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pctBox)).BeginInit();
this.SuspendLayout();
//
@ -323,7 +337,7 @@
this.lstProcesses.FormattingEnabled = true;
this.lstProcesses.Location = new System.Drawing.Point(12, 502);
this.lstProcesses.Name = "lstProcesses";
this.lstProcesses.Size = new System.Drawing.Size(248, 251);
this.lstProcesses.Size = new System.Drawing.Size(248, 277);
this.lstProcesses.TabIndex = 27;
this.lstProcesses.SelectedIndexChanged += new System.EventHandler(this.lstProcesses_SelectedIndexChanged);
//
@ -339,9 +353,10 @@
// lblDumpSize
//
this.lblDumpSize.AutoSize = true;
this.lblDumpSize.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblDumpSize.Location = new System.Drawing.Point(279, 487);
this.lblDumpSize.Name = "lblDumpSize";
this.lblDumpSize.Size = new System.Drawing.Size(58, 13);
this.lblDumpSize.Size = new System.Drawing.Size(67, 13);
this.lblDumpSize.TabIndex = 29;
this.lblDumpSize.Text = "Dump Size";
//
@ -358,17 +373,157 @@
this.lblWIP.AutoSize = true;
this.lblWIP.Font = new System.Drawing.Font("Times New Roman", 48F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblWIP.ForeColor = System.Drawing.Color.Red;
this.lblWIP.Location = new System.Drawing.Point(407, 589);
this.lblWIP.Location = new System.Drawing.Point(468, 587);
this.lblWIP.Name = "lblWIP";
this.lblWIP.Size = new System.Drawing.Size(508, 73);
this.lblWIP.TabIndex = 31;
this.lblWIP.Text = "Work in Progress";
//
// txtGIFPackets
//
this.txtGIFPackets.AutoSize = true;
this.txtGIFPackets.Location = new System.Drawing.Point(279, 539);
this.txtGIFPackets.Name = "txtGIFPackets";
this.txtGIFPackets.Size = new System.Drawing.Size(0, 13);
this.txtGIFPackets.TabIndex = 33;
//
// lblGIFPackets
//
this.lblGIFPackets.AutoSize = true;
this.lblGIFPackets.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblGIFPackets.Location = new System.Drawing.Point(279, 523);
this.lblGIFPackets.Name = "lblGIFPackets";
this.lblGIFPackets.Size = new System.Drawing.Size(110, 13);
this.lblGIFPackets.TabIndex = 32;
this.lblGIFPackets.Text = "Total GIF Packets";
//
// txtPath1
//
this.txtPath1.AutoSize = true;
this.txtPath1.Location = new System.Drawing.Point(279, 578);
this.txtPath1.Name = "txtPath1";
this.txtPath1.Size = new System.Drawing.Size(0, 13);
this.txtPath1.TabIndex = 35;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(279, 560);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(114, 13);
this.label2.TabIndex = 34;
this.label2.Text = "Path1 GIF Packets";
//
// txtPath2
//
this.txtPath2.AutoSize = true;
this.txtPath2.Location = new System.Drawing.Point(279, 618);
this.txtPath2.Name = "txtPath2";
this.txtPath2.Size = new System.Drawing.Size(0, 13);
this.txtPath2.TabIndex = 37;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.Location = new System.Drawing.Point(279, 601);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(114, 13);
this.label3.TabIndex = 36;
this.label3.Text = "Path2 GIF Packets";
//
// txtPath3
//
this.txtPath3.AutoSize = true;
this.txtPath3.Location = new System.Drawing.Point(279, 653);
this.txtPath3.Name = "txtPath3";
this.txtPath3.Size = new System.Drawing.Size(0, 13);
this.txtPath3.TabIndex = 39;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label5.Location = new System.Drawing.Point(279, 635);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(114, 13);
this.label5.TabIndex = 38;
this.label5.Text = "Path3 GIF Packets";
//
// txtVSync
//
this.txtVSync.AutoSize = true;
this.txtVSync.Location = new System.Drawing.Point(279, 690);
this.txtVSync.Name = "txtVSync";
this.txtVSync.Size = new System.Drawing.Size(0, 13);
this.txtVSync.TabIndex = 41;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label4.Location = new System.Drawing.Point(279, 671);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(91, 13);
this.label4.TabIndex = 40;
this.label4.Text = "Vsync Packets";
//
// txtReadFifo
//
this.txtReadFifo.AutoSize = true;
this.txtReadFifo.Location = new System.Drawing.Point(279, 724);
this.txtReadFifo.Name = "txtReadFifo";
this.txtReadFifo.Size = new System.Drawing.Size(0, 13);
this.txtReadFifo.TabIndex = 43;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label7.Location = new System.Drawing.Point(279, 709);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(114, 13);
this.label7.TabIndex = 42;
this.label7.Text = "ReadFIFO Packets";
//
// txtRegisters
//
this.txtRegisters.AutoSize = true;
this.txtRegisters.Location = new System.Drawing.Point(279, 764);
this.txtRegisters.Name = "txtRegisters";
this.txtRegisters.Size = new System.Drawing.Size(0, 13);
this.txtRegisters.TabIndex = 45;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label6.Location = new System.Drawing.Point(279, 744);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(110, 13);
this.label6.TabIndex = 44;
this.label6.Text = "Registers Packets";
//
// GSDumpGUI
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(988, 766);
this.ClientSize = new System.Drawing.Size(988, 790);
this.Controls.Add(this.txtRegisters);
this.Controls.Add(this.label6);
this.Controls.Add(this.txtReadFifo);
this.Controls.Add(this.label7);
this.Controls.Add(this.txtVSync);
this.Controls.Add(this.label4);
this.Controls.Add(this.txtPath3);
this.Controls.Add(this.label5);
this.Controls.Add(this.txtPath2);
this.Controls.Add(this.label3);
this.Controls.Add(this.txtPath1);
this.Controls.Add(this.label2);
this.Controls.Add(this.txtGIFPackets);
this.Controls.Add(this.lblGIFPackets);
this.Controls.Add(this.lblWIP);
this.Controls.Add(this.txtDumpSize);
this.Controls.Add(this.lblDumpSize);
@ -445,6 +600,20 @@
private System.Windows.Forms.Label lblDumpSize;
public System.Windows.Forms.Label txtDumpSize;
private System.Windows.Forms.Label lblWIP;
public System.Windows.Forms.Label txtGIFPackets;
private System.Windows.Forms.Label lblGIFPackets;
public System.Windows.Forms.Label txtPath1;
private System.Windows.Forms.Label label2;
public System.Windows.Forms.Label txtPath2;
private System.Windows.Forms.Label label3;
public System.Windows.Forms.Label txtPath3;
private System.Windows.Forms.Label label5;
public System.Windows.Forms.Label txtVSync;
private System.Windows.Forms.Label label4;
public System.Windows.Forms.Label txtReadFifo;
private System.Windows.Forms.Label label7;
public System.Windows.Forms.Label txtRegisters;
private System.Windows.Forms.Label label6;
}
}

View File

@ -360,6 +360,9 @@ namespace GSDumpGUI
TCPMessage msg = new TCPMessage();
msg.MessageType = MessageType.SizeDump;
Program.Clients.Find(a => a.IPAddress == lstProcesses.SelectedItem.ToString()).Send(msg);
msg = new TCPMessage();
msg.MessageType = MessageType.Statistics;
Program.Clients.Find(a => a.IPAddress == lstProcesses.SelectedItem.ToString()).Send(msg);
}
}
}

View File

@ -7,6 +7,8 @@ using System.IO;
namespace GSDumpGUI
{
public delegate void GSgifTransfer(IntPtr data, int size);
public delegate void GSgifTransfer2(IntPtr data, int size);
public delegate void GSgifTransfer3(IntPtr data, int size);
public delegate void GSVSync(byte field);
public delegate void GSreadFIFO2(IntPtr data, int size);
public delegate void GSsetGameCRC(int crc, int options);
@ -24,6 +26,8 @@ namespace GSDumpGUI
private GSConfigure gsConfigure;
private PSEgetLibName PsegetLibName;
private GSgifTransfer GSgifTransfer;
private GSgifTransfer2 GSgifTransfer2;
private GSgifTransfer3 GSgifTransfer3;
private GSVSync GSVSync;
private GSreadFIFO2 GSreadFIFO2;
private GSsetGameCRC GSsetGameCRC;
@ -103,6 +107,8 @@ namespace GSDumpGUI
IntPtr funcaddrConfig = NativeMethods.GetProcAddress(hmod, "GSconfigure");
IntPtr funcaddrGIF = NativeMethods.GetProcAddress(hmod, "GSgifTransfer");
IntPtr funcaddrGIF2 = NativeMethods.GetProcAddress(hmod, "GSgifTransfer2");
IntPtr funcaddrGIF3 = NativeMethods.GetProcAddress(hmod, "GSgifTransfer3");
IntPtr funcaddrVSync = NativeMethods.GetProcAddress(hmod, "GSvsync");
IntPtr funcaddrSetBaseMem = NativeMethods.GetProcAddress(hmod, "GSsetBaseMem");
IntPtr funcaddrOpen = NativeMethods.GetProcAddress(hmod, "GSopen");
@ -117,6 +123,8 @@ namespace GSDumpGUI
PsegetLibName = (PSEgetLibName)Marshal.GetDelegateForFunctionPointer(funcaddrLibName, typeof(PSEgetLibName));
this.GSgifTransfer = (GSgifTransfer)Marshal.GetDelegateForFunctionPointer(funcaddrGIF, typeof(GSgifTransfer));
this.GSgifTransfer2 = (GSgifTransfer2)Marshal.GetDelegateForFunctionPointer(funcaddrGIF2, typeof(GSgifTransfer2));
this.GSgifTransfer3 = (GSgifTransfer3)Marshal.GetDelegateForFunctionPointer(funcaddrGIF3, typeof(GSgifTransfer3));
this.GSVSync = (GSVSync)Marshal.GetDelegateForFunctionPointer(funcaddrVSync, typeof(GSVSync));
this.GSsetBaseMem = (GSsetBaseMem)Marshal.GetDelegateForFunctionPointer(funcaddrSetBaseMem, typeof(GSsetBaseMem));
this.GSopen = (GSopen)Marshal.GetDelegateForFunctionPointer(funcaddrOpen, typeof(GSopen));
@ -188,36 +196,36 @@ namespace GSDumpGUI
private unsafe void Step(GSData itm, byte* registers)
{
/*"C:\Users\Alessio\Desktop\Plugins\Dll\gsdx-sse4-r3878.dll" "C:\Users\Alessio\Desktop\Plugins\Dumps\gsdx_20101219182059.gs" "GSReplay" 0*/
switch (itm.id)
{
case GSType.Transfer:
switch (itm.data[0])
{/*
{
case 0:
byte[] data = new byte[16384];
for (int i = 0; i < itm.data; i++)
{
}
fixed (byte* gifdata = data)
{
GSgifTransfer1(new IntPtr(gifdata + 5), 16384 - size);
}
break;*/
case 0:
case 1:
case 2:
fixed (byte* gifdata = itm.data)
{
GSgifTransfer(new IntPtr(gifdata + 1), (itm.data.Length - 1) / 16);
}
break;/*
break;
case 1:
fixed (byte* gifdata = itm.data)
{
GSgifTransfer(new IntPtr(gifdata + 1), (itm.data.Length - 1) /16);
}
break;
case 2:
fixed (byte* gifdata = itm.data)
{
GSgifTransfer3(new IntPtr(gifdata + 1), (itm.data.Length - 1) / 16);
GSgifTransfer2(new IntPtr(gifdata + 1), (itm.data.Length - 1) /16);
}
break;*/
break;
case 3:
fixed (byte* gifdata = itm.data)
{
GSgifTransfer3(new IntPtr(gifdata + 1), (itm.data.Length - 1) /16);
}
break;
}
break;
case GSType.VSync:
@ -226,7 +234,11 @@ namespace GSDumpGUI
case GSType.ReadFIFO2:
fixed (byte* FIFO = itm.data)
{
GSreadFIFO2(new IntPtr(FIFO), itm.data.Length / 16);
byte[] arrnew = new byte[*((int*)FIFO)];
fixed (byte* arrn = arrnew)
{
GSreadFIFO2(new IntPtr(arrn), *((int*)FIFO));
}
}
break;
case GSType.Registers:

View File

@ -65,11 +65,13 @@ namespace GSDumpGUI
break;
case GSType.ReadFIFO2:
Int32 sF = br.ReadInt32();
data.data = br.ReadBytes(sF);
data.data = BitConverter.GetBytes(sF);
break;
case GSType.Registers:
data.data = br.ReadBytes(8192);
break;
default:
break;
}
dmp.Data.Add(data);
}

View File

@ -109,6 +109,7 @@ namespace TCPLibrary.MessageBased.Core
{
Connect,
MaxUsers,
SizeDump
SizeDump,
Statistics
}
}