2010-03-01 16:47:58 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using Specialized = System.Collections.Specialized;
|
|
|
|
|
using Reflection = System.Reflection;
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Diagnostics;
|
2010-03-04 14:54:20 +00:00
|
|
|
|
using GSDumpGUI.Properties;
|
2010-12-19 10:48:09 +00:00
|
|
|
|
using System.IO;
|
2010-12-19 15:55:52 +00:00
|
|
|
|
using TCPLibrary.MessageBased.Core;
|
2010-12-22 09:19:58 +00:00
|
|
|
|
using System.Drawing;
|
2010-03-01 16:47:58 +00:00
|
|
|
|
|
|
|
|
|
namespace GSDumpGUI
|
|
|
|
|
{
|
|
|
|
|
static class Program
|
|
|
|
|
{
|
|
|
|
|
static public GSDumpGUI frmMain;
|
2010-12-19 15:55:52 +00:00
|
|
|
|
static public TCPLibrary.MessageBased.Core.BaseMessageServer Server;
|
|
|
|
|
static public List<TCPLibrary.MessageBased.Core.BaseMessageClientS> Clients;
|
2010-03-01 16:47:58 +00:00
|
|
|
|
|
2010-12-19 15:55:52 +00:00
|
|
|
|
static public TCPLibrary.MessageBased.Core.BaseMessageClient Client;
|
2010-03-04 14:54:20 +00:00
|
|
|
|
static private Boolean ChangeIcon;
|
2010-12-19 15:55:52 +00:00
|
|
|
|
static private GSDump dump;
|
2010-12-22 06:59:53 +00:00
|
|
|
|
static private GSDXWrapper wrap;
|
2010-03-04 14:54:20 +00:00
|
|
|
|
|
2010-12-22 09:19:58 +00:00
|
|
|
|
static private TreeNode CurrentNode;
|
|
|
|
|
|
2010-03-01 16:47:58 +00:00
|
|
|
|
[STAThread]
|
|
|
|
|
static void Main(String[] args)
|
|
|
|
|
{
|
2010-03-04 13:47:36 +00:00
|
|
|
|
if (args.Length == 4)
|
2010-03-01 16:47:58 +00:00
|
|
|
|
{
|
2010-12-22 20:04:12 +00:00
|
|
|
|
// do this first, else racy mess ;)
|
|
|
|
|
wrap = new GSDXWrapper();
|
|
|
|
|
|
2010-12-19 15:55:52 +00:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Client = new TCPLibrary.MessageBased.Core.BaseMessageClient();
|
|
|
|
|
Client.OnMessageReceived += new TCPLibrary.MessageBased.Core.BaseMessageClient.MessageReceivedHandler(Client_OnMessageReceived);
|
|
|
|
|
Client.Connect("localhost", 9999);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
Client = null;
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-01 16:47:58 +00:00
|
|
|
|
Thread thd = new Thread(new ThreadStart(delegate
|
|
|
|
|
{
|
|
|
|
|
while (true)
|
|
|
|
|
{
|
2010-12-22 09:19:58 +00:00
|
|
|
|
IntPtr pt = Process.GetCurrentProcess().MainWindowHandle;
|
2010-03-04 14:54:20 +00:00
|
|
|
|
if (ChangeIcon)
|
|
|
|
|
{
|
|
|
|
|
if (pt.ToInt64() != 0)
|
|
|
|
|
{
|
|
|
|
|
NativeMethods.SetClassLong(pt, -14, Resources.AppIcon.Handle.ToInt64());
|
|
|
|
|
ChangeIcon = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-12-22 09:19:58 +00:00
|
|
|
|
|
2010-03-01 16:47:58 +00:00
|
|
|
|
Int32 tmp = NativeMethods.GetAsyncKeyState(0x1b) & 0xf;
|
|
|
|
|
if (tmp != 0)
|
|
|
|
|
Process.GetCurrentProcess().Kill();
|
|
|
|
|
Thread.Sleep(16);
|
|
|
|
|
}
|
|
|
|
|
}));
|
|
|
|
|
thd.IsBackground = true;
|
|
|
|
|
thd.Start();
|
|
|
|
|
|
|
|
|
|
// Retrieve parameters
|
|
|
|
|
String DLLPath = args[0];
|
|
|
|
|
String DumpPath = args[1];
|
|
|
|
|
String Operation = args[2];
|
2010-03-04 13:47:36 +00:00
|
|
|
|
Int32 Renderer = Convert.ToInt32(args[3]);
|
2010-03-01 16:47:58 +00:00
|
|
|
|
|
2010-03-04 14:54:20 +00:00
|
|
|
|
wrap.Load(DLLPath);
|
2010-12-19 10:48:09 +00:00
|
|
|
|
Directory.SetCurrentDirectory(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory + "GSDumpGSDXConfigs\\" + Path.GetFileName(DLLPath) + "\\"));
|
2010-03-04 14:54:20 +00:00
|
|
|
|
if (Operation == "GSReplay")
|
2010-03-01 16:47:58 +00:00
|
|
|
|
{
|
2010-12-19 15:55:52 +00:00
|
|
|
|
dump = GSDump.LoadDump(DumpPath);
|
2010-12-22 19:45:31 +00:00
|
|
|
|
|
|
|
|
|
if (Client != null)
|
|
|
|
|
{
|
|
|
|
|
SendStatistics();
|
|
|
|
|
SendDumpSize();
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-19 14:41:11 +00:00
|
|
|
|
wrap.Run(dump, Renderer);
|
2010-03-04 14:54:20 +00:00
|
|
|
|
ChangeIcon = true;
|
2010-03-01 16:47:58 +00:00
|
|
|
|
}
|
2010-03-04 14:54:20 +00:00
|
|
|
|
else
|
|
|
|
|
wrap.GSConfig();
|
|
|
|
|
wrap.Unload();
|
2010-12-19 15:55:52 +00:00
|
|
|
|
|
2010-12-21 07:29:33 +00:00
|
|
|
|
if (GSDXWrapper.DumpTooOld)
|
|
|
|
|
{
|
|
|
|
|
if (Client != null)
|
|
|
|
|
{
|
|
|
|
|
TCPMessage msg = new TCPMessage();
|
|
|
|
|
msg.MessageType = MessageType.StateOld;
|
|
|
|
|
Client.Send(msg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-19 15:55:52 +00:00
|
|
|
|
if (Client != null)
|
|
|
|
|
Client.Disconnect();
|
2010-03-01 16:47:58 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2010-12-19 15:55:52 +00:00
|
|
|
|
Clients = new List<TCPLibrary.MessageBased.Core.BaseMessageClientS>();
|
|
|
|
|
|
|
|
|
|
Server = new TCPLibrary.MessageBased.Core.BaseMessageServer();
|
|
|
|
|
Server.OnClientMessageReceived += new BaseMessageServer.MessageReceivedHandler(Server_OnClientMessageReceived);
|
|
|
|
|
Server.OnClientAfterConnect += new TCPLibrary.Core.Server.ConnectedHandler(Server_OnClientAfterConnect);
|
|
|
|
|
Server.OnClientAfterDisconnected += new TCPLibrary.Core.Server.DisconnectedHandler(Server_OnClientAfterDisconnected);
|
|
|
|
|
Server.Port = 9999;
|
|
|
|
|
Server.Enabled = true;
|
|
|
|
|
|
2010-03-01 16:47:58 +00:00
|
|
|
|
Application.EnableVisualStyles();
|
|
|
|
|
Application.SetCompatibleTextRenderingDefault(false);
|
|
|
|
|
frmMain = new GSDumpGUI();
|
|
|
|
|
Application.Run(frmMain);
|
2010-12-19 15:55:52 +00:00
|
|
|
|
|
|
|
|
|
Server.Enabled = false;
|
2010-03-01 16:47:58 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2010-12-19 15:55:52 +00:00
|
|
|
|
|
|
|
|
|
static void Server_OnClientAfterDisconnected(TCPLibrary.Core.Server server, TCPLibrary.Core.ClientS sender)
|
|
|
|
|
{
|
|
|
|
|
Clients.Remove((TCPLibrary.MessageBased.Core.BaseMessageClientS)sender);
|
2010-12-22 19:45:31 +00:00
|
|
|
|
RefreshList(false);
|
2010-12-19 15:55:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void Server_OnClientMessageReceived(BaseMessageServer server, BaseMessageClientS sender, TCPMessage Mess)
|
|
|
|
|
{
|
|
|
|
|
switch (Mess.MessageType)
|
|
|
|
|
{
|
|
|
|
|
case MessageType.Connect:
|
|
|
|
|
break;
|
|
|
|
|
case MessageType.MaxUsers:
|
|
|
|
|
break;
|
|
|
|
|
case MessageType.SizeDump:
|
|
|
|
|
frmMain.Invoke(new Action<object>(delegate(object e)
|
|
|
|
|
{
|
2010-12-19 21:32:09 +00:00
|
|
|
|
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();
|
2010-12-19 15:55:52 +00:00
|
|
|
|
}), new object[] { null });
|
|
|
|
|
break;
|
2010-12-21 07:29:33 +00:00
|
|
|
|
case MessageType.StateOld:
|
|
|
|
|
frmMain.Invoke(new Action<object>(delegate(object e)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("Savestate too old to be read. :(", "Warning");
|
2010-12-21 08:07:43 +00:00
|
|
|
|
frmMain.Focus();
|
2010-12-22 06:59:53 +00:00
|
|
|
|
}), new object[] { null });
|
|
|
|
|
break;
|
|
|
|
|
case MessageType.GetDebugMode:
|
|
|
|
|
frmMain.Invoke(new Action<object>(delegate(object e)
|
|
|
|
|
{
|
|
|
|
|
frmMain.chkDebugMode.Checked = (Boolean)Mess.Parameters[0];
|
|
|
|
|
|
|
|
|
|
frmMain.lblGif.Enabled = frmMain.chkDebugMode.Checked;
|
|
|
|
|
frmMain.btnRunToSelection.Enabled = frmMain.chkDebugMode.Checked;
|
|
|
|
|
frmMain.treTreeView.Enabled = frmMain.chkDebugMode.Checked;
|
|
|
|
|
frmMain.btnStep.Enabled = frmMain.chkDebugMode.Checked;
|
2010-12-22 19:45:31 +00:00
|
|
|
|
frmMain.cmdGoToStart.Enabled = frmMain.chkDebugMode.Checked;
|
|
|
|
|
frmMain.cmdGoToNextVSync.Enabled = frmMain.chkDebugMode.Checked;
|
2010-12-24 08:45:54 +00:00
|
|
|
|
frmMain.treeGifPacketContent.Enabled = frmMain.chkDebugMode.Checked;
|
2010-12-22 06:59:53 +00:00
|
|
|
|
if (frmMain.chkDebugMode.Checked == false)
|
|
|
|
|
frmMain.treTreeView.Nodes.Clear();
|
|
|
|
|
|
|
|
|
|
}), new object[] { null });
|
|
|
|
|
break;
|
|
|
|
|
case MessageType.DebugState:
|
|
|
|
|
frmMain.Invoke(new Action<object>(delegate(object e)
|
|
|
|
|
{
|
|
|
|
|
frmMain.treTreeView.Nodes.Clear();
|
|
|
|
|
List<TreeNode> parents = new List<TreeNode>();
|
|
|
|
|
List<TreeNode> nodes = new List<TreeNode>();
|
|
|
|
|
foreach (var itm in Mess.Parameters)
|
|
|
|
|
{
|
|
|
|
|
String[] parts = itm.ToString().Split(new char[] { '|' });
|
|
|
|
|
switch (parts[1])
|
|
|
|
|
{
|
|
|
|
|
case "Transfer":
|
2010-12-22 09:19:58 +00:00
|
|
|
|
TreeNode tn2 = new TreeNode();
|
|
|
|
|
tn2.Name = parts[0];
|
2010-12-24 08:45:54 +00:00
|
|
|
|
tn2.Text = parts[0] + " - " + parts[1] + " - " + parts[2] + " - " + parts[3] + " byte";
|
2010-12-22 09:19:58 +00:00
|
|
|
|
nodes.Add(tn2);
|
2010-12-22 06:59:53 +00:00
|
|
|
|
break;
|
|
|
|
|
case "ReadFIFO2":
|
2010-12-22 09:19:58 +00:00
|
|
|
|
TreeNode tn3 = new TreeNode();
|
|
|
|
|
tn3.Name = parts[0];
|
2010-12-24 08:45:54 +00:00
|
|
|
|
tn3.Text = parts[0] + " - " + parts[1] + " - " + parts[2] + " byte";
|
2010-12-22 09:19:58 +00:00
|
|
|
|
nodes.Add(tn3);
|
2010-12-22 06:59:53 +00:00
|
|
|
|
break;
|
|
|
|
|
case "VSync":
|
|
|
|
|
TreeNode tn = new TreeNode();
|
2010-12-22 09:19:58 +00:00
|
|
|
|
tn.Name = parts[0];
|
2010-12-24 08:45:54 +00:00
|
|
|
|
tn.Text = parts[0] + " - " + parts[1] + " - " + parts[2] + " byte";
|
2010-12-22 06:59:53 +00:00
|
|
|
|
tn.Nodes.AddRange(nodes.ToArray());
|
|
|
|
|
parents.Add(tn);
|
|
|
|
|
|
|
|
|
|
nodes.Clear();
|
|
|
|
|
break;
|
|
|
|
|
case "Registers":
|
2010-12-22 09:19:58 +00:00
|
|
|
|
TreeNode tn4 = new TreeNode();
|
|
|
|
|
tn4.Name = parts[0];
|
2010-12-24 08:45:54 +00:00
|
|
|
|
tn4.Text = parts[0] + " - " + parts[1] + " - " + parts[2] + " byte";
|
2010-12-22 09:19:58 +00:00
|
|
|
|
nodes.Add(tn4);
|
2010-12-22 06:59:53 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
frmMain.treTreeView.Nodes.AddRange(parents.ToArray());
|
2010-12-21 07:29:33 +00:00
|
|
|
|
}), new object[] { null });
|
|
|
|
|
break;
|
2010-12-22 09:19:58 +00:00
|
|
|
|
case MessageType.Step:
|
|
|
|
|
case MessageType.RunToCursor:
|
|
|
|
|
frmMain.Invoke(new Action<object>(delegate(object e)
|
|
|
|
|
{
|
|
|
|
|
int idtoselect = (int)Mess.Parameters[0];
|
|
|
|
|
TreeNode[] noes = frmMain.treTreeView.Nodes.Find(idtoselect.ToString(), true);
|
|
|
|
|
if (noes.Length > 0)
|
|
|
|
|
{
|
|
|
|
|
if (CurrentNode != null)
|
|
|
|
|
CurrentNode.BackColor = Color.White;
|
|
|
|
|
noes[0].BackColor = Color.LightBlue;
|
|
|
|
|
CurrentNode = noes[0];
|
|
|
|
|
frmMain.treTreeView.SelectedNode = noes[0];
|
|
|
|
|
}
|
|
|
|
|
}), new object[] { null });
|
|
|
|
|
break;
|
2010-12-24 08:45:54 +00:00
|
|
|
|
case MessageType.PacketInfo:
|
|
|
|
|
frmMain.Invoke(new Action<object>(delegate(object e)
|
|
|
|
|
{
|
2010-12-24 11:47:24 +00:00
|
|
|
|
if (Mess.Parameters[0].ToString() != "No Data Available")
|
|
|
|
|
{
|
|
|
|
|
string[] vals = Mess.Parameters[0].ToString().Split('|');
|
|
|
|
|
frmMain.txtGifPacketSize.Text = vals[0] + " bytes";
|
2010-12-24 08:45:54 +00:00
|
|
|
|
|
2010-12-24 11:47:24 +00:00
|
|
|
|
frmMain.treeGifPacketContent.Nodes.Clear();
|
2010-12-24 08:45:54 +00:00
|
|
|
|
|
2010-12-24 11:47:24 +00:00
|
|
|
|
frmMain.treeGifPacketContent.Nodes.Add(vals[1]);
|
2010-12-24 08:45:54 +00:00
|
|
|
|
|
2010-12-24 11:47:24 +00:00
|
|
|
|
if (vals.Length > 2)
|
2010-12-24 08:45:54 +00:00
|
|
|
|
{
|
2010-12-24 11:47:24 +00:00
|
|
|
|
frmMain.treeGifPacketContent.Nodes[0].Nodes.Add(vals[2]);
|
|
|
|
|
frmMain.treeGifPacketContent.Nodes[0].Nodes.Add(vals[3]);
|
|
|
|
|
frmMain.treeGifPacketContent.Nodes[0].Nodes.Add(vals[4]);
|
|
|
|
|
frmMain.treeGifPacketContent.Nodes[0].Nodes.Add(vals[5]);
|
|
|
|
|
|
|
|
|
|
TreeNode nodePrim = new TreeNode("Prim");
|
|
|
|
|
string[] prim = vals[6].Split('~');
|
|
|
|
|
for (int j = 1; j < prim.Length; j++)
|
|
|
|
|
{
|
|
|
|
|
nodePrim.Nodes.Add(prim[j]);
|
|
|
|
|
}
|
|
|
|
|
frmMain.treeGifPacketContent.Nodes[0].Nodes.Add(nodePrim);
|
|
|
|
|
|
|
|
|
|
frmMain.treeGifPacketContent.Nodes[0].Nodes.Add(vals[7]);
|
|
|
|
|
frmMain.treeGifPacketContent.Nodes[0].Nodes.Add(vals[8]);
|
2010-12-24 08:45:54 +00:00
|
|
|
|
}
|
2010-12-24 11:47:24 +00:00
|
|
|
|
frmMain.treeGifPacketContent.Nodes[0].ExpandAll();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
frmMain.treeGifPacketContent.Nodes.Clear();
|
|
|
|
|
|
|
|
|
|
frmMain.treeGifPacketContent.Nodes.Add(Mess.Parameters[0].ToString());
|
2010-12-24 08:45:54 +00:00
|
|
|
|
}
|
|
|
|
|
}), new object[] { null });
|
|
|
|
|
break;
|
2010-12-19 15:55:52 +00:00
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void Client_OnMessageReceived(TCPLibrary.Core.Client sender, TCPLibrary.MessageBased.Core.TCPMessage Mess)
|
|
|
|
|
{
|
2010-12-19 21:32:09 +00:00
|
|
|
|
TCPMessage msg;
|
2010-12-19 15:55:52 +00:00
|
|
|
|
switch (Mess.MessageType)
|
|
|
|
|
{
|
|
|
|
|
case TCPLibrary.MessageBased.Core.MessageType.Connect:
|
|
|
|
|
break;
|
|
|
|
|
case TCPLibrary.MessageBased.Core.MessageType.MaxUsers:
|
|
|
|
|
break;
|
|
|
|
|
case TCPLibrary.MessageBased.Core.MessageType.SizeDump:
|
2010-12-22 19:45:31 +00:00
|
|
|
|
SendDumpSize();
|
2010-12-19 15:55:52 +00:00
|
|
|
|
break;
|
2010-12-19 21:32:09 +00:00
|
|
|
|
case MessageType.Statistics:
|
2010-12-22 19:45:31 +00:00
|
|
|
|
SendStatistics();
|
2010-12-19 21:32:09 +00:00
|
|
|
|
break;
|
2010-12-22 06:59:53 +00:00
|
|
|
|
case MessageType.SetDebugMode:
|
|
|
|
|
wrap.DebugMode = (Boolean)Mess.Parameters[0];
|
|
|
|
|
|
|
|
|
|
msg = new TCPMessage();
|
|
|
|
|
msg.MessageType = MessageType.GetDebugMode;
|
|
|
|
|
msg.Parameters.Add(wrap.DebugMode);
|
|
|
|
|
Client.Send(msg);
|
|
|
|
|
|
|
|
|
|
if (wrap.DebugMode)
|
|
|
|
|
{
|
|
|
|
|
msg = new TCPMessage();
|
|
|
|
|
msg.MessageType = MessageType.DebugState;
|
|
|
|
|
msg.Parameters.AddRange(wrap.GetGifPackets(dump));
|
|
|
|
|
Client.Send(msg);
|
2010-12-22 09:19:58 +00:00
|
|
|
|
|
|
|
|
|
msg = new TCPMessage();
|
|
|
|
|
msg.MessageType = MessageType.Step;
|
|
|
|
|
msg.Parameters.Add(dump.Data.FindIndex(a => a == wrap.CurrentGIFPacket));
|
|
|
|
|
Client.Send(msg);
|
2010-12-22 06:59:53 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case MessageType.GetDebugMode:
|
|
|
|
|
msg = new TCPMessage();
|
|
|
|
|
msg.MessageType = MessageType.GetDebugMode;
|
|
|
|
|
msg.Parameters.Add(wrap.DebugMode);
|
|
|
|
|
Client.Send(msg);
|
|
|
|
|
|
|
|
|
|
if (wrap.DebugMode)
|
|
|
|
|
{
|
|
|
|
|
msg = new TCPMessage();
|
|
|
|
|
msg.MessageType = MessageType.DebugState;
|
|
|
|
|
msg.Parameters.AddRange(wrap.GetGifPackets(dump));
|
|
|
|
|
Client.Send(msg);
|
2010-12-22 09:19:58 +00:00
|
|
|
|
|
|
|
|
|
msg = new TCPMessage();
|
|
|
|
|
msg.MessageType = MessageType.Step;
|
|
|
|
|
msg.Parameters.Add(dump.Data.FindIndex(a => a == wrap.CurrentGIFPacket));
|
|
|
|
|
Client.Send(msg);
|
2010-12-22 06:59:53 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
2010-12-24 08:45:54 +00:00
|
|
|
|
|
|
|
|
|
case MessageType.PacketInfo:
|
|
|
|
|
int id = (int)Mess.Parameters[0];
|
|
|
|
|
msg = new TCPMessage();
|
|
|
|
|
msg.MessageType = MessageType.PacketInfo;
|
|
|
|
|
msg.Parameters.Add(wrap.GetGifPacketInfo(dump, id));
|
|
|
|
|
Client.Send(msg);
|
|
|
|
|
break;
|
2010-12-22 09:19:58 +00:00
|
|
|
|
case MessageType.Step:
|
|
|
|
|
case MessageType.RunToCursor:
|
2010-12-22 19:45:31 +00:00
|
|
|
|
case MessageType.RunToNextVSync:
|
2010-12-22 09:19:58 +00:00
|
|
|
|
wrap.ExternalEvent.WaitOne();
|
|
|
|
|
wrap.ExternalEvent.Reset();
|
|
|
|
|
wrap.QueueMessage.Enqueue(Mess);
|
|
|
|
|
wrap.ThereIsWork = true;
|
|
|
|
|
break;
|
2010-12-19 15:55:52 +00:00
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-22 19:45:31 +00:00
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-19 15:55:52 +00:00
|
|
|
|
static void Server_OnClientAfterConnect(TCPLibrary.Core.Server server, TCPLibrary.Core.ClientS sender)
|
|
|
|
|
{
|
|
|
|
|
Clients.Add((TCPLibrary.MessageBased.Core.BaseMessageClientS)sender);
|
2010-12-22 19:45:31 +00:00
|
|
|
|
RefreshList(true);
|
2010-12-19 15:55:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-22 19:45:31 +00:00
|
|
|
|
private static void RefreshList(bool SelectLast)
|
2010-12-19 15:55:52 +00:00
|
|
|
|
{
|
|
|
|
|
frmMain.Invoke(new Action<object>( delegate(object e)
|
|
|
|
|
{
|
|
|
|
|
frmMain.lstProcesses.Items.Clear();
|
|
|
|
|
|
|
|
|
|
foreach (var itm in Clients)
|
|
|
|
|
{
|
|
|
|
|
frmMain.lstProcesses.Items.Add(itm.IPAddress);
|
|
|
|
|
}
|
2010-12-22 19:54:06 +00:00
|
|
|
|
if (SelectLast)
|
|
|
|
|
frmMain.lstProcesses.SelectedIndex = frmMain.lstProcesses.Items.Count - 1;
|
2010-12-22 07:07:35 +00:00
|
|
|
|
if (frmMain.lstProcesses.SelectedIndex == -1)
|
|
|
|
|
{
|
|
|
|
|
frmMain.chkDebugMode.Checked = false;
|
|
|
|
|
frmMain.lblGif.Enabled = frmMain.chkDebugMode.Checked;
|
|
|
|
|
frmMain.btnRunToSelection.Enabled = frmMain.chkDebugMode.Checked;
|
|
|
|
|
frmMain.treTreeView.Enabled = frmMain.chkDebugMode.Checked;
|
|
|
|
|
frmMain.btnStep.Enabled = frmMain.chkDebugMode.Checked;
|
2010-12-22 19:45:31 +00:00
|
|
|
|
frmMain.cmdGoToStart.Enabled = frmMain.chkDebugMode.Checked;
|
|
|
|
|
frmMain.cmdGoToNextVSync.Enabled = frmMain.chkDebugMode.Checked;
|
2010-12-22 07:07:35 +00:00
|
|
|
|
frmMain.treTreeView.Nodes.Clear();
|
2010-12-24 08:45:54 +00:00
|
|
|
|
frmMain.treeGifPacketContent.Nodes.Clear();
|
2010-12-22 07:07:35 +00:00
|
|
|
|
}
|
2010-12-19 15:55:52 +00:00
|
|
|
|
}), new object[] { null});
|
|
|
|
|
}
|
2010-03-01 16:47:58 +00:00
|
|
|
|
}
|
|
|
|
|
}
|