Resolved tree mess by passing entire class through tcp.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4167 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
feal87@gmail.com 2010-12-29 08:41:15 +00:00
parent 6a8507d6c3
commit 5df7a65727
17 changed files with 96 additions and 102 deletions

View File

@ -244,54 +244,52 @@ namespace GSDumpGUI
case MessageType.PacketInfo:
frmMain.Invoke(new Action<object>(delegate(object e)
{
if (Mess.Parameters[0].ToString() != "No Data Available")
if (Mess.Parameters[0].GetType() == typeof(GIFTag))
{
string[] vals = Mess.Parameters[0].ToString().Split('|');
frmMain.txtGifPacketSize.Text = vals[0] + " bytes";
GIFTag tag = (GIFTag)Mess.Parameters[0];
frmMain.txtGifPacketSize.Text = tag.size + " bytes";
frmMain.treeGifPacketContent.Nodes.Clear();
frmMain.treeGifPacketContent.Nodes.Add(vals[1]);
frmMain.treeGifPacketContent.Nodes.Add("Transfer Path " + tag.path);
if (vals.Length > 2)
frmMain.treeGifPacketContent.Nodes[0].Nodes.Add("nloop = " + tag.nloop);
frmMain.treeGifPacketContent.Nodes[0].Nodes.Add("eop = " + tag.eop);
frmMain.treeGifPacketContent.Nodes[0].Nodes.Add("flg = " + tag.flg.ToString());
frmMain.treeGifPacketContent.Nodes[0].Nodes.Add("pre = " + tag.pre);
TreeNode nodePrim = new TreeNode("Prim");
string[] prim = tag.prim.ToString().Split(new char[] { '@' });
for (int j = 0; j < prim.Length; j++)
nodePrim.Nodes.Add(prim[j]);
frmMain.treeGifPacketContent.Nodes[0].Nodes.Add(nodePrim);
frmMain.treeGifPacketContent.Nodes[0].Nodes.Add("nreg = " + tag.nreg.ToString());
TreeNode nodeReg = new TreeNode("reg");
for (int j = 0; j < tag.regs.Count; j++)
{
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++)
string[] fvals = tag.regs[j].ToString().Split(new char[] { '@' }, StringSplitOptions.RemoveEmptyEntries);
TreeNode nodeObj = new TreeNode(fvals[0]);
for (int z = 1; z < fvals.Length; z++)
{
nodePrim.Nodes.Add(prim[j]);
TreeNode item = new TreeNode(fvals[z]);
nodeObj.Nodes.Add(item);
}
frmMain.treeGifPacketContent.Nodes[0].Nodes.Add(nodePrim);
frmMain.treeGifPacketContent.Nodes[0].Nodes.Add(vals[7]);
TreeNode nodeReg = new TreeNode("reg");
string[] reg = vals[8].Split(new char[]{'~'}, StringSplitOptions.RemoveEmptyEntries);
for (int j = 1; j < reg.Length; j++)
{
string[] fvals = reg[j].Split(new char[] { '@' }, StringSplitOptions.RemoveEmptyEntries);
TreeNode nodeObj = new TreeNode(fvals[0]);
for (int z = 1; z < fvals.Length; z++)
{
TreeNode item = new TreeNode(fvals[z]);
nodeObj.Nodes.Add(item);
}
nodeReg.Nodes.Add(nodeObj);
}
frmMain.treeGifPacketContent.Nodes[0].Nodes.Add(nodeReg);
nodeReg.Nodes.Add(nodeObj);
}
frmMain.treeGifPacketContent.Nodes[0].Nodes.Add(nodeReg);
frmMain.treeGifPacketContent.Nodes[0].ExpandAll();
}
else
{
String[] vals = Mess.Parameters[0].ToString().Split('|');
frmMain.txtGifPacketSize.Text = vals[0] + " bytes";
frmMain.treeGifPacketContent.Nodes.Clear();
frmMain.treeGifPacketContent.Nodes.Add(Mess.Parameters[0].ToString());
frmMain.treeGifPacketContent.Nodes.Add(vals[1]);
frmMain.treeGifPacketContent.Nodes[0].ExpandAll();
}
}), new object[] { null });
break;

View File

@ -394,52 +394,24 @@ namespace GSDumpGUI
return Data;
}
internal String GetGifPacketInfo(GSDump dump, int i)
internal object GetGifPacketInfo(GSDump dump, int i)
{
string val = dump.Data[i].data.Length.ToString() + "|";
switch (dump.Data[i].id)
if (dump.Data[i].id == GSType.Transfer)
return GIFTag.ExtractGifTag(dump.Data[i].data, ((GSTransfer)dump.Data[i]).Path);
else
{
case GSType.Transfer:
try
{
GIFTag tag = GIFTag.ExtractGifTag(dump.Data[i].data);
val += "Transfer Path " + ((GSTransfer)dump.Data[i]).Path.ToString() + "|";
val += "NLoop = " + tag.nloop + "|";
//val += "Pad1 = " + tag._pad1 + "|";
//val += "Pad2 = " + tag._pad2 + "|";
val += "eop = " + tag.eop + "|";
val += "flg = " + ((GIFFLG)tag.flg).ToString() + "|";
val += "pre = " + tag.pre + "|";
val += "prim~Prim Class = " + ((GS_PRIM)tag.prim.Prim).ToString() + "~IIP = " + tag.prim.IIP + "~TME = " + tag.prim.TME + "~FGE = " + tag.prim.FGE + "~ABE = " +
tag.prim.ABE + "~AA1 = " + tag.prim.AA1 + "~FST = " + tag.prim.FST + "~CTXT = " + tag.prim.CTXT + "~FIX = " + tag.prim.FIX + "|";
val += "nreg = " + (tag.nreg == 0 ? 16 : tag.nreg) + "|";
val += "regs~";
foreach (var itm in tag.regs)
{
val += itm.ToString() + "~";
}
}
catch (ArgumentException) // out of bounds because of split primitive
{
// accomodating hacked up tree builder
val += "Unhandled split GIF primitive|||||||||";
}
break;
case GSType.VSync:
val += "Field = " + dump.Data[i].data[0].ToString();
break;
case GSType.ReadFIFO2:
val += "ReadFIFO2 : Size = " + BitConverter.ToInt32(dump.Data[i].data, 0).ToString() + " byte";
break;
case GSType.Registers:
val += "Registers";
break;
default:
break;
switch (dump.Data[i].id)
{
case GSType.VSync:
return dump.Data[i].data.Length + "|Field = " + dump.Data[i].data[0].ToString();
case GSType.ReadFIFO2:
return dump.Data[i].data.Length + "|ReadFIFO2 : Size = " + BitConverter.ToInt32(dump.Data[i].data, 0).ToString() + " byte";
case GSType.Registers:
return dump.Data[i].data.Length + "|Registers";
default:
return "";
}
}
return val;
}
}
}

View File

@ -4,31 +4,38 @@ using System.Text;
namespace GSDumpGUI
{
[Serializable]
public class GIFPrim : GIFUtil
{
public UInt32 Prim;
public UInt32 IIP;
public UInt32 TME;
public UInt32 FGE;
public UInt32 ABE;
public UInt32 AA1;
public UInt32 FST;
public UInt32 CTXT;
public UInt32 FIX;
public GS_PRIM PrimitiveType;
public GSIIP IIP;
public bool TME;
public bool FGE;
public bool ABE;
public bool AA1;
public GSFST FST;
public GSCTXT CTXT;
public GSFIX FIX;
static internal GIFPrim ExtractGIFPrim(UInt32 rawValue)
static internal GIFPrim ExtractGIFPrim(UInt32 LowData)
{
GIFPrim pri = new GIFPrim();
pri.Prim = (rawValue & 0x007);
pri.IIP = (rawValue & 0x008) >> 3;
pri.TME = (rawValue & 0x010) >> 4;
pri.FGE = (rawValue & 0x020) >> 5;
pri.ABE = (rawValue & 0x040) >> 6;
pri.AA1 = (rawValue & 0x080) >> 7;
pri.FST = (rawValue & 0x100) >> 8;
pri.CTXT = (rawValue & 0x200) >> 9;
pri.FIX = (rawValue & 0x400) >> 10;
return pri;
GIFPrim pr = new GIFPrim();
pr.PrimitiveType = (GS_PRIM)GetBit(LowData, 0, 3);
pr.IIP = (GSIIP)GetBit(LowData, 3, 1);
pr.TME = Convert.ToBoolean(GetBit(LowData, 4, 1));
pr.FGE = Convert.ToBoolean(GetBit(LowData, 5, 1));
pr.ABE = Convert.ToBoolean(GetBit(LowData, 6, 1));
pr.AA1 = Convert.ToBoolean(GetBit(LowData, 7, 1));
pr.FST = (GSFST)(GetBit(LowData, 8, 1));
pr.CTXT = (GSCTXT)(GetBit(LowData, 9, 1));
pr.FIX = (GSFIX)(GetBit(LowData, 10, 1));
return pr;
}
public override string ToString()
{
return "Primitive Type : " + PrimitiveType.ToString() + "@IIP : " + IIP.ToString() + "@TME : " + TME.ToString() + "@FGE : " + FGE.ToString()
+ "@ABE : " + ABE.ToString() + "@AA1 : " + AA1.ToString() + "@FST : " + FST.ToString() + "@CTXT : " + CTXT.ToString() + "@FIX : " + FIX.ToString();
}
}

View File

@ -4,6 +4,7 @@ using System.Text;
namespace GSDumpGUI
{
[Serializable]
abstract public class GIFReg : GIFUtil, IGifData
{
public GIFRegDescriptor Descriptor;

View File

@ -4,6 +4,7 @@ using System.Text;
namespace GSDumpGUI
{
[Serializable]
public static class GIFRegAD
{
static public GIFReg Unpack(GIFTag tag, byte addr, UInt64 LowData, UInt64 HighData, bool PackedFormat)

View File

@ -4,6 +4,7 @@ using System.Text;
namespace GSDumpGUI
{
[Serializable]
public class GIFRegFOG : GIFReg
{
public double F;

View File

@ -4,6 +4,7 @@ using System.Text;
namespace GSDumpGUI
{
[Serializable]
public class GIFRegNOP : GIFReg
{
public byte addr;

View File

@ -4,6 +4,7 @@ using System.Text;
namespace GSDumpGUI
{
[Serializable]
public class GIFRegPRIM : GIFReg
{
public GS_PRIM PrimitiveType;

View File

@ -4,6 +4,7 @@ using System.Text;
namespace GSDumpGUI
{
[Serializable]
public class GIFRegRGBAQ : GIFReg
{
public byte R;

View File

@ -4,6 +4,7 @@ using System.Text;
namespace GSDumpGUI
{
[Serializable]
public class GIFRegST : GIFReg
{
public float S;

View File

@ -4,6 +4,7 @@ using System.Text;
namespace GSDumpGUI
{
[Serializable]
public class GIFRegTEX0 : GIFReg
{
public ushort TBP0;

View File

@ -4,6 +4,7 @@ using System.Text;
namespace GSDumpGUI
{
[Serializable]
public class GIFRegUV : GIFReg
{
public double U;

View File

@ -4,6 +4,7 @@ using System.Text;
namespace GSDumpGUI
{
[Serializable]
public class GIFRegUnimpl : GIFReg
{
public GIFRegUnimpl(byte addr, UInt64 LowData, UInt64 HighData, bool PackedFormat) : base(addr, LowData, HighData, PackedFormat) { }

View File

@ -4,6 +4,7 @@ using System.Text;
namespace GSDumpGUI
{
[Serializable]
public class GIFRegXYZF : GIFReg
{
public double X;

View File

@ -4,6 +4,7 @@ using System.Text;
namespace GSDumpGUI
{
[Serializable]
public class GifImage : IGifData
{
public byte[] Data;

View File

@ -4,13 +4,16 @@ using System.Text;
namespace GSDumpGUI
{
[Serializable]
public class GIFTag : GIFUtil
{
public delegate GIFReg Unpack(GIFTag tag, byte addr, UInt64 LowData, UInt64 HighData, bool PackedFormat);
static public Dictionary<int, Unpack> UnpackReg;
public UInt64 TAG, REGS;
private UInt64 TAG, REGS;
internal float Q; // GIF has an internal Q register which is reset to 1.0 at the tag and updated on packed ST(Q) for output at next RGBAQ
public GSTransferPath path;
public UInt32 nloop;
public UInt32 eop;
public UInt32 pre;
@ -18,7 +21,7 @@ namespace GSDumpGUI
public GIFFLG flg;
public UInt32 nreg;
public List<IGifData> regs;
public float Q; // GIF has an internal Q register which is reset to 1.0 at the tag and updated on packed ST(Q) for output at next RGBAQ
public int size;
static GIFTag()
{
@ -88,10 +91,11 @@ namespace GSDumpGUI
return ret;
}
static internal GIFTag ExtractGifTag(byte[] data)
static internal GIFTag ExtractGifTag(byte[] data, GSTransferPath path)
{
GIFTag t = new GIFTag();
t.size = data.Length;
t.path = path;
t.TAG = BitConverter.ToUInt64(data, 0);
t.REGS = BitConverter.ToUInt64(data, 8);

View File

@ -2,6 +2,7 @@
namespace GSDumpGUI
{
[Serializable]
public class GIFUtil
{
public static UInt64 GetBit(UInt64 value, int lower, int count)