On Rama request :

1) Implemented 2 new operations (Go To Start and Go To Next VSync)
2) Autoselect the client when started up
3) Fix little bug when trying to run to the packet 0.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4126 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
feal87@gmail.com 2010-12-22 19:45:31 +00:00
parent 9be3624120
commit 8973c0f440
5 changed files with 128 additions and 60 deletions

View File

@ -77,6 +77,13 @@ namespace GSDumpGUI
if (Operation == "GSReplay")
{
dump = GSDump.LoadDump(DumpPath);
if (Client != null)
{
SendStatistics();
SendDumpSize();
}
wrap.Run(dump, Renderer);
ChangeIcon = true;
}
@ -120,7 +127,7 @@ namespace GSDumpGUI
static void Server_OnClientAfterDisconnected(TCPLibrary.Core.Server server, TCPLibrary.Core.ClientS sender)
{
Clients.Remove((TCPLibrary.MessageBased.Core.BaseMessageClientS)sender);
RefreshList();
RefreshList(false);
}
static void Server_OnClientMessageReceived(BaseMessageServer server, BaseMessageClientS sender, TCPMessage Mess)
@ -165,6 +172,8 @@ namespace GSDumpGUI
frmMain.btnRunToSelection.Enabled = frmMain.chkDebugMode.Checked;
frmMain.treTreeView.Enabled = frmMain.chkDebugMode.Checked;
frmMain.btnStep.Enabled = frmMain.chkDebugMode.Checked;
frmMain.cmdGoToStart.Enabled = frmMain.chkDebugMode.Checked;
frmMain.cmdGoToNextVSync.Enabled = frmMain.chkDebugMode.Checked;
if (frmMain.chkDebugMode.Checked == false)
frmMain.treTreeView.Nodes.Clear();
@ -244,38 +253,10 @@ namespace GSDumpGUI
case TCPLibrary.MessageBased.Core.MessageType.MaxUsers:
break;
case TCPLibrary.MessageBased.Core.MessageType.SizeDump:
msg = new TCPMessage();
msg.MessageType = MessageType.SizeDump;
if (dump != null)
msg.Parameters.Add(dump.Size);
else
msg.Parameters.Add(0);
Client.Send(msg);
SendDumpSize();
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);
SendStatistics();
break;
case MessageType.SetDebugMode:
wrap.DebugMode = (Boolean)Mess.Parameters[0];
@ -318,12 +299,8 @@ namespace GSDumpGUI
}
break;
case MessageType.Step:
wrap.ExternalEvent.WaitOne();
wrap.ExternalEvent.Reset();
wrap.QueueMessage.Enqueue(Mess);
wrap.ThereIsWork = true;
break;
case MessageType.RunToCursor:
case MessageType.RunToNextVSync:
wrap.ExternalEvent.WaitOne();
wrap.ExternalEvent.Reset();
wrap.QueueMessage.Enqueue(Mess);
@ -334,13 +311,53 @@ namespace GSDumpGUI
}
}
private static void SendDumpSize()
{
TCPMessage msg;
msg = new TCPMessage();
msg.MessageType = MessageType.SizeDump;
if (dump != null)
msg.Parameters.Add(dump.Size);
else
msg.Parameters.Add(0);
Client.Send(msg);
}
private static void SendStatistics()
{
TCPMessage msg;
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);
}
static void Server_OnClientAfterConnect(TCPLibrary.Core.Server server, TCPLibrary.Core.ClientS sender)
{
Clients.Add((TCPLibrary.MessageBased.Core.BaseMessageClientS)sender);
RefreshList();
RefreshList(true);
}
private static void RefreshList()
private static void RefreshList(bool SelectLast)
{
frmMain.Invoke(new Action<object>( delegate(object e)
{
@ -350,6 +367,7 @@ namespace GSDumpGUI
{
frmMain.lstProcesses.Items.Add(itm.IPAddress);
}
frmMain.lstProcesses.SelectedIndex = frmMain.lstProcesses.Items.Count - 1;
if (frmMain.lstProcesses.SelectedIndex == -1)
{
frmMain.chkDebugMode.Checked = false;
@ -357,6 +375,8 @@ namespace GSDumpGUI
frmMain.btnRunToSelection.Enabled = frmMain.chkDebugMode.Checked;
frmMain.treTreeView.Enabled = frmMain.chkDebugMode.Checked;
frmMain.btnStep.Enabled = frmMain.chkDebugMode.Checked;
frmMain.cmdGoToStart.Enabled = frmMain.chkDebugMode.Checked;
frmMain.cmdGoToNextVSync.Enabled = frmMain.chkDebugMode.Checked;
frmMain.treTreeView.Nodes.Clear();
}
}), new object[] { null});

View File

@ -77,6 +77,8 @@
this.btnStep = new System.Windows.Forms.Button();
this.btnRunToSelection = new System.Windows.Forms.Button();
this.treTreeView = new System.Windows.Forms.TreeView();
this.cmdGoToStart = new System.Windows.Forms.Button();
this.cmdGoToNextVSync = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pctBox)).BeginInit();
this.SuspendLayout();
//
@ -502,7 +504,7 @@
//
this.chkDebugMode.AutoSize = true;
this.chkDebugMode.Enabled = false;
this.chkDebugMode.Location = new System.Drawing.Point(481, 487);
this.chkDebugMode.Location = new System.Drawing.Point(629, 501);
this.chkDebugMode.Name = "chkDebugMode";
this.chkDebugMode.Size = new System.Drawing.Size(88, 17);
this.chkDebugMode.TabIndex = 46;
@ -514,7 +516,7 @@
//
this.lblGif.AutoSize = true;
this.lblGif.Enabled = false;
this.lblGif.Location = new System.Drawing.Point(427, 520);
this.lblGif.Location = new System.Drawing.Point(417, 487);
this.lblGif.Name = "lblGif";
this.lblGif.Size = new System.Drawing.Size(66, 13);
this.lblGif.TabIndex = 48;
@ -523,7 +525,7 @@
// btnStep
//
this.btnStep.Enabled = false;
this.btnStep.Location = new System.Drawing.Point(629, 533);
this.btnStep.Location = new System.Drawing.Point(629, 575);
this.btnStep.Name = "btnStep";
this.btnStep.Size = new System.Drawing.Size(108, 40);
this.btnStep.TabIndex = 49;
@ -535,7 +537,7 @@
// btnRunToSelection
//
this.btnRunToSelection.Enabled = false;
this.btnRunToSelection.Location = new System.Drawing.Point(629, 579);
this.btnRunToSelection.Location = new System.Drawing.Point(629, 621);
this.btnRunToSelection.Name = "btnRunToSelection";
this.btnRunToSelection.Size = new System.Drawing.Size(108, 40);
this.btnRunToSelection.TabIndex = 50;
@ -547,16 +549,42 @@
// treTreeView
//
this.treTreeView.Enabled = false;
this.treTreeView.Location = new System.Drawing.Point(420, 539);
this.treTreeView.Location = new System.Drawing.Point(420, 503);
this.treTreeView.Name = "treTreeView";
this.treTreeView.Size = new System.Drawing.Size(200, 240);
this.treTreeView.Size = new System.Drawing.Size(200, 276);
this.treTreeView.TabIndex = 51;
//
// cmdGoToStart
//
this.cmdGoToStart.Enabled = false;
this.cmdGoToStart.Location = new System.Drawing.Point(629, 529);
this.cmdGoToStart.Name = "cmdGoToStart";
this.cmdGoToStart.Size = new System.Drawing.Size(108, 40);
this.cmdGoToStart.TabIndex = 52;
this.cmdGoToStart.TabStop = false;
this.cmdGoToStart.Text = "Go to Start";
this.cmdGoToStart.UseVisualStyleBackColor = true;
this.cmdGoToStart.Click += new System.EventHandler(this.cmdGoToStart_Click);
//
// cmdGoToNextVSync
//
this.cmdGoToNextVSync.Enabled = false;
this.cmdGoToNextVSync.Location = new System.Drawing.Point(629, 671);
this.cmdGoToNextVSync.Name = "cmdGoToNextVSync";
this.cmdGoToNextVSync.Size = new System.Drawing.Size(108, 40);
this.cmdGoToNextVSync.TabIndex = 53;
this.cmdGoToNextVSync.TabStop = false;
this.cmdGoToNextVSync.Text = "Go to next VSync";
this.cmdGoToNextVSync.UseVisualStyleBackColor = true;
this.cmdGoToNextVSync.Click += new System.EventHandler(this.cmdGoToNextVSync_Click);
//
// GSDumpGUI
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(988, 790);
this.Controls.Add(this.cmdGoToNextVSync);
this.Controls.Add(this.cmdGoToStart);
this.Controls.Add(this.treTreeView);
this.Controls.Add(this.btnRunToSelection);
this.Controls.Add(this.btnStep);
@ -669,6 +697,8 @@
public System.Windows.Forms.Label lblGif;
public System.Windows.Forms.Button btnStep;
public System.Windows.Forms.Button btnRunToSelection;
public System.Windows.Forms.Button cmdGoToStart;
public System.Windows.Forms.Button cmdGoToNextVSync;
}
}

View File

@ -427,5 +427,20 @@ namespace GSDumpGUI
else
MessageBox.Show("You have not selected a node to jump to");
}
private void cmdGoToStart_Click(object sender, EventArgs e)
{
TCPMessage msg = new TCPMessage();
msg.MessageType = MessageType.RunToCursor;
msg.Parameters.Add(0);
Program.Clients.Find(a => a.IPAddress == lstProcesses.SelectedItem.ToString()).Send(msg);
}
private void cmdGoToNextVSync_Click(object sender, EventArgs e)
{
TCPMessage msg = new TCPMessage();
msg.MessageType = MessageType.RunToNextVSync;
Program.Clients.Find(a => a.IPAddress == lstProcesses.SelectedItem.ToString()).Send(msg);
}
}
}

View File

@ -267,23 +267,25 @@ namespace GSDumpGUI
if (QueueMessage.Count > 0)
{
TCPMessage Mess = QueueMessage.Dequeue();
if (Mess.MessageType == MessageType.Step)
switch (Mess.MessageType)
{
RunTo = i;
i = 0;
Marshal.Copy(dump.Registers, 0, new IntPtr(pointer), 8192);
GSfreeze(0, new IntPtr(fr));
}
else
if (Mess.MessageType == MessageType.RunToCursor)
{
case MessageType.Step:
RunTo = i;
i = -1;
break;
case MessageType.RunToCursor:
RunTo = (int)Mess.Parameters[0];
i = 0;
Marshal.Copy(dump.Registers, 0, new IntPtr(pointer), 8192);
GSfreeze(0, new IntPtr(fr));
}
i = -1;
break;
case MessageType.RunToNextVSync:
RunTo = dump.Data.FindIndex(i, a => a.id == GSType.VSync);
i = -1;
break;
default:
break;
}
Marshal.Copy(dump.Registers, 0, new IntPtr(pointer), 8192);
GSfreeze(0, new IntPtr(fr));
}
}
}

View File

@ -118,6 +118,7 @@ namespace TCPLibrary.MessageBased.Core
DebugState,
Step,
RunToCursor
RunToCursor,
RunToNextVSync
}
}