Cleared up a bit the code and added the FOG handler.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4142 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
feal87@gmail.com 2010-12-25 17:18:13 +00:00
parent bd7ff7de67
commit a3902c57cc
17 changed files with 259 additions and 220 deletions

View File

@ -56,14 +56,15 @@
<DependentUpon>frmMain.cs</DependentUpon> <DependentUpon>frmMain.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Library\GSDump\GSData\GIFPacket\GIFPrim.cs" /> <Compile Include="Library\GSDump\GSData\GIFPacket\GIFPrim.cs" />
<Compile Include="Library\GSDump\GSData\GIFPacket\GIFReg\GIFRegPackedXYZ.cs" /> <Compile Include="Library\GSDump\GSData\GIFPacket\GIFReg\GIFRegFOG.cs" />
<Compile Include="Library\GSDump\GSData\GIFPacket\GIFReg\GIFRegPackedXYZF.cs" /> <Compile Include="Library\GSDump\GSData\GIFPacket\GIFReg\GIFRegXYZ.cs" />
<Compile Include="Library\GSDump\GSData\GIFPacket\GIFReg\GIFRegPackedUV.cs" /> <Compile Include="Library\GSDump\GSData\GIFPacket\GIFReg\GIFRegXYZF.cs" />
<Compile Include="Library\GSDump\GSData\GIFPacket\GIFReg\GIFRegPackedST.cs" /> <Compile Include="Library\GSDump\GSData\GIFPacket\GIFReg\GIFRegUV.cs" />
<Compile Include="Library\GSDump\GSData\GIFPacket\GIFReg\GIFRegST.cs" />
<Compile Include="Library\GSDump\GSData\GIFPacket\GIFReg\GIFReg.cs" /> <Compile Include="Library\GSDump\GSData\GIFPacket\GIFReg\GIFReg.cs" />
<Compile Include="Library\GSDump\GSData\GIFPacket\GIFReg\GifImage.cs" /> <Compile Include="Library\GSDump\GSData\GIFPacket\GIFReg\GifImage.cs" />
<Compile Include="Library\GSDump\GSData\GIFPacket\GIFReg\GIFRegPackedPrim.cs" /> <Compile Include="Library\GSDump\GSData\GIFPacket\GIFReg\GIFRegPrim.cs" />
<Compile Include="Library\GSDump\GSData\GIFPacket\GIFReg\GIFRegPackedRGBAQ.cs" /> <Compile Include="Library\GSDump\GSData\GIFPacket\GIFReg\GIFRegRGBAQ.cs" />
<Compile Include="Library\GSDump\GSData\GIFPacket\GIFReg\IGifData.cs" /> <Compile Include="Library\GSDump\GSData\GIFPacket\GIFReg\IGifData.cs" />
<Compile Include="Library\GSDump\GSData\GIFPacket\GIFTag.cs" /> <Compile Include="Library\GSDump\GSData\GIFPacket\GIFTag.cs" />
<Compile Include="Library\GSDump\GSData\GSData.cs" /> <Compile Include="Library\GSDump\GSData\GSData.cs" />

View File

@ -417,35 +417,35 @@ namespace GSDumpGUI
{ {
if (itm.GetType().IsSubclassOf(typeof(GIFReg))) if (itm.GetType().IsSubclassOf(typeof(GIFReg)))
{ {
if (itm.GetType() == typeof(GIFRegPackedPrim)) if (itm.GetType() == typeof(GIFRegPrim))
{ {
GIFRegPackedPrim p = (GIFRegPackedPrim)itm; GIFRegPrim p = (GIFRegPrim)itm;
val += "Packed Primitive@Primitive Type : " + p.PrimitiveType.ToString() + "@IIP : " + p.IIP.ToString() + "@TME : " + p.TME.ToString() + "@FGE : " + p.FGE.ToString() val += "Packed Primitive@Primitive Type : " + p.PrimitiveType.ToString() + "@IIP : " + p.IIP.ToString() + "@TME : " + p.TME.ToString() + "@FGE : " + p.FGE.ToString()
+ "@ABE : " + p.ABE.ToString() + "@AA1 : " + p.AA1.ToString() + "@FST : " + p.FST.ToString() + "@CTXT : " + p.CTXT.ToString() + "@FIX : " + p.FIX.ToString() + "~"; + "@ABE : " + p.ABE.ToString() + "@AA1 : " + p.AA1.ToString() + "@FST : " + p.FST.ToString() + "@CTXT : " + p.CTXT.ToString() + "@FIX : " + p.FIX.ToString() + "~";
} }
if (itm.GetType() == typeof(GIFRegPackedRGBAQ)) if (itm.GetType() == typeof(GIFRegRGBAQ))
{ {
GIFRegPackedRGBAQ p = (GIFRegPackedRGBAQ)itm; GIFRegRGBAQ p = (GIFRegRGBAQ)itm;
val += "Packed RGBAQ@Red : " + p.R.ToString() + "@Green : " + p.G.ToString() + "@Blue : " + p.B.ToString() + "@Alpha : " + p.A.ToString() + "~"; val += "Packed RGBAQ@Red : " + p.R.ToString() + "@Green : " + p.G.ToString() + "@Blue : " + p.B.ToString() + "@Alpha : " + p.A.ToString() + "~";
} }
if (itm.GetType() == typeof(GIFRegPackedST)) if (itm.GetType() == typeof(GIFRegST))
{ {
GIFRegPackedST p = (GIFRegPackedST)itm; GIFRegST p = (GIFRegST)itm;
val += "Packed ST@S : " + p.S.ToString("F8") + "@T : " + p.T.ToString("F8") + "@Q : " + p.Q.ToString("F8") + "~"; val += "Packed ST@S : " + p.S.ToString("F8") + "@T : " + p.T.ToString("F8") + "@Q : " + p.Q.ToString("F8") + "~";
} }
if (itm.GetType() == typeof(GIFRegPackedUV)) if (itm.GetType() == typeof(GIFRegUV))
{ {
GIFRegPackedUV p = (GIFRegPackedUV)itm; GIFRegUV p = (GIFRegUV)itm;
val += "Packed UV@U : " + p.U.ToString("F4") + "@V : " + p.V.ToString("F4") + "~"; val += "Packed UV@U : " + p.U.ToString("F4") + "@V : " + p.V.ToString("F4") + "~";
} }
if (itm.GetType() == typeof(GIFRegPackedXYZF)) if (itm.GetType() == typeof(GIFRegXYZF))
{ {
GIFRegPackedXYZF p = (GIFRegPackedXYZF)itm; GIFRegXYZF p = (GIFRegXYZF)itm;
val += "Packed XYZF@X : " + p.X.ToString("F4") + "@Y : " + p.Y.ToString("F4") + "@Z : " + p.Z.ToString() + "@F : " + p.F.ToString() + "@ADC : " + p.ADC.ToString() + "~"; val += "Packed XYZF@X : " + p.X.ToString("F4") + "@Y : " + p.Y.ToString("F4") + "@Z : " + p.Z.ToString() + "@F : " + p.F.ToString() + "@ADC : " + p.ADC.ToString() + "~";
} }
if (itm.GetType() == typeof(GIFRegPackedXYZ)) if (itm.GetType() == typeof(GIFRegXYZ))
{ {
GIFRegPackedXYZ p = (GIFRegPackedXYZ)itm; GIFRegXYZ p = (GIFRegXYZ)itm;
val += "Packed XYZ@X : " + p.X.ToString("F4") + "@Y : " + p.Y.ToString("F4") + "@Z : " + p.Z.ToString() + "@ADC : " + p.ADC.ToString() + "~"; val += "Packed XYZ@X : " + p.X.ToString("F4") + "@Y : " + p.Y.ToString("F4") + "@Z : " + p.Z.ToString() + "@ADC : " + p.ADC.ToString() + "~";
} }
} }

View File

@ -11,21 +11,22 @@ namespace GSDumpGUI
public enum GIFRegDescriptor public enum GIFRegDescriptor
{ {
PRIM = 0, PRIM = 0x00,
RGBAQ = 1, RGBAQ = 0x01,
ST = 2, ST = 0x02,
UV = 3, UV = 0x03,
XYZF2 = 4, XYZF2 = 0x04,
XYZ2 = 5, XYZ2 = 0x05,
TEX0_1 = 6, TEX0_1 = 0x06,
TEX0_2 = 7, TEX0_2 = 0x07,
CLAMP_1 = 8, CLAMP_1 = 0x08,
CLAMP_2 = 9, CLAMP_2 = 0x09,
FOG = 10, FOG = 0x0a,
Reserved = 11, Reserved = 0x0b,
XYZF3 = 12, XYZF3 = 0x0c,
XYZ3 = 13, XYZ3 = 0x0d,
AD = 14, AD = 0x0e,
NOP = 15 NOP = 0x0f
} }
} }

View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace GSDumpGUI
{
public class GIFRegFOG : GIFReg
{
public double F;
static public GIFReg Unpack(UInt64 LowData, UInt64 HighData, bool PlainFormat)
{
GIFRegFOG u = new GIFRegFOG();
u.Descriptor = GIFRegDescriptor.FOG;
u.F = (UInt16)((HighData & 0xFF000000000) >> 36);
return u;
}
}
}

View File

@ -1,43 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace GSDumpGUI
{
public class GIFRegPackedPrim : GIFReg
{
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;
}
public enum GSIIP
{
FlatShading=0,
Gouraud=1
}
public enum GSFST
{
STQValue=0,
UVValue=1
}
public enum GSCTXT
{
Context1 =0,
Context2 =1
}
public enum GSFIX
{
Unfixed =0,
Fixed = 1
}
}

View File

@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace GSDumpGUI
{
public class GIFRegPackedRGBAQ : GIFReg
{
public int R;
public int G;
public int B;
public int A;
}
}

View File

@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace GSDumpGUI
{
public class GIFRegPackedST : GIFReg
{
public float S;
public float T;
public float Q;
}
}

View File

@ -1,12 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace GSDumpGUI
{
public class GIFRegPackedUV : GIFReg
{
public double U;
public double V;
}
}

View File

@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace GSDumpGUI
{
public class GIFRegPackedXYZ : GIFReg
{
public double X;
public double Y;
public UInt32 Z;
public bool ADC;
}
}

View File

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace GSDumpGUI
{
public class GIFRegPackedXYZF : GIFReg
{
public double X;
public double Y;
public UInt32 Z;
public UInt16 F;
public bool ADC;
}
}

View File

@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace GSDumpGUI
{
public class GIFRegPrim : GIFReg
{
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 public GIFReg Unpack(UInt64 LowData, UInt64 HighData, bool PlainFormat)
{
GIFRegPrim pr = new GIFRegPrim();
pr.Descriptor = GIFRegDescriptor.PRIM;
pr.PrimitiveType = (GS_PRIM)(LowData & 0x7);
pr.IIP = (GSIIP)((LowData & 0x8) >> 3);
pr.TME = Convert.ToBoolean(((LowData & 0x10) >> 4));
pr.FGE = Convert.ToBoolean(((LowData & 0x20) >> 5));
pr.ABE = Convert.ToBoolean(((LowData & 0x40) >> 6));
pr.AA1 = Convert.ToBoolean(((LowData & 0x80) >> 7));
pr.FST = (GSFST)((LowData & 0x100) >> 8);
pr.CTXT = (GSCTXT)((LowData & 0x200) >> 9);
pr.FIX = (GSFIX)((LowData & 0x400) >> 10);
return pr;
}
}
public enum GSIIP
{
FlatShading=0,
Gouraud=1
}
public enum GSFST
{
STQValue=0,
UVValue=1
}
public enum GSCTXT
{
Context1 =0,
Context2 =1
}
public enum GSFIX
{
Unfixed =0,
Fixed = 1
}
}

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace GSDumpGUI
{
public class GIFRegRGBAQ : GIFReg
{
public int R;
public int G;
public int B;
public int A;
static public GIFReg Unpack(UInt64 LowData, UInt64 HighData, bool PlainFormat)
{
GIFRegRGBAQ r = new GIFRegRGBAQ();
r.Descriptor = GIFRegDescriptor.RGBAQ;
r.R = (int)(LowData & 0xFF);
r.G = (int)((LowData & 0xFF00000000) >> 32);
r.B = (int)((HighData & 0xFF));
r.A = (int)((HighData & 0xFF00000000) >> 32);
return r;
}
}
}

View File

@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace GSDumpGUI
{
public class GIFRegST : GIFReg
{
public float S;
public float T;
public float Q;
static public GIFReg Unpack(UInt64 LowData, UInt64 HighData, bool PlainFormat)
{
unsafe
{
GIFRegST st = new GIFRegST();
st.Descriptor = GIFRegDescriptor.ST;
ulong pt = ((LowData & 0xFFFFFFFF));
void* ptt = &pt;
st.S = *(float*)ptt;
pt = ((LowData & 0xFFFFFFFF00000000) >> 32);
ptt = &pt;
st.T = *(float*)ptt;
pt = ((HighData & 0xFFFFFFFF));
ptt = &pt;
st.Q = *(float*)ptt;
return st;
}
}
}
}

View File

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace GSDumpGUI
{
public class GIFRegUV : GIFReg
{
public double U;
public double V;
static public GIFReg Unpack(UInt64 LowData, UInt64 HighData, bool PlainFormat)
{
GIFRegUV u = new GIFRegUV();
u.Descriptor = GIFRegDescriptor.UV;
u.U = (LowData & 0x3FFF) / 16d;
u.V = ((LowData & 0x3FFF00000000) >> 32) / 16d;
return u;
}
}
}

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace GSDumpGUI
{
public class GIFRegXYZ : GIFReg
{
public double X;
public double Y;
public UInt32 Z;
public bool ADC;
static public GIFReg Unpack(UInt64 LowData, UInt64 HighData, bool PlainFormat)
{
GIFRegXYZF xf = new GIFRegXYZF();
xf.ADC = ((HighData & 0x1000000000000) >> 46) == 1;
xf.Descriptor = (xf.ADC == true ? GIFRegDescriptor.XYZ3 : GIFRegDescriptor.XYZ2);
xf.X = (LowData & 0xFFFF) / 16d;
xf.Y = ((LowData & 0xFFFF00000000) >> 32) / 16d;
xf.Z = (UInt32)((HighData & 0xFFFFFF0) >> 4);
return xf;
}
}
}

View File

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace GSDumpGUI
{
public class GIFRegXYZF : GIFReg
{
public double X;
public double Y;
public UInt32 Z;
public UInt16 F;
public bool ADC;
static public GIFReg Unpack(UInt64 LowData, UInt64 HighData, bool PlainFormat)
{
GIFRegXYZ xf2 = new GIFRegXYZ();
xf2.ADC = ((HighData & 0x1000000000000) >> 46) == 1;
xf2.Descriptor = (xf2.ADC == true ? GIFRegDescriptor.XYZF3 : GIFRegDescriptor.XYZF2);
xf2.X = (LowData & 0xFFFF) / 16d;
xf2.Y = ((LowData & 0xFFFF00000000) >> 32) / 16d;
xf2.Z = (UInt32)((HighData & 0xFFFFFF0) >> 4);
xf2.F = (UInt16)((HighData & 0xFF000000000) >> 36);
return xf2;
}
}
}

View File

@ -62,104 +62,41 @@ namespace GSDumpGUI
{ {
case GIFRegDescriptor.PRIM: case GIFRegDescriptor.PRIM:
if (t.pre == 1) if (t.pre == 1)
{ t.regs.Add(GIFRegPrim.Unpack(LowData, HighData, false));
GIFRegPackedPrim pr = new GIFRegPackedPrim();
pr.Descriptor = registers[i];
pr.PrimitiveType = (GS_PRIM)(LowData & 0x7);
pr.IIP = (GSIIP)((LowData & 0x8) >> 3);
pr.TME = Convert.ToBoolean(((LowData & 0x10) >> 4));
pr.FGE = Convert.ToBoolean(((LowData & 0x20) >> 5));
pr.ABE = Convert.ToBoolean(((LowData & 0x40) >> 6));
pr.AA1 = Convert.ToBoolean(((LowData & 0x80) >> 7));
pr.FST = (GSFST)((LowData & 0x100) >> 8);
pr.CTXT = (GSCTXT)((LowData & 0x200) >> 9);
pr.FIX = (GSFIX)((LowData & 0x400) >> 10);
t.regs.Add(pr);
}
break; break;
case GIFRegDescriptor.RGBAQ: case GIFRegDescriptor.RGBAQ:
GIFRegPackedRGBAQ r = new GIFRegPackedRGBAQ(); t.regs.Add(GIFRegRGBAQ.Unpack(LowData, HighData, false));
r.Descriptor = registers[i];
r.R = (int)(LowData & 0xFF);
r.G = (int)((LowData & 0xFF00000000) >> 32);
r.B = (int)((HighData & 0xFF));
r.A = (int)((HighData & 0xFF00000000) >> 32);
t.regs.Add(r);
break; break;
case GIFRegDescriptor.ST: case GIFRegDescriptor.ST:
GIFRegPackedST st = new GIFRegPackedST(); t.regs.Add(GIFRegST.Unpack(LowData, HighData, false));
st.Descriptor = registers[i];
ulong pt = ((LowData & 0xFFFFFFFF));
void* ptt = &pt;
st.S = *(float*)ptt;
pt = ((LowData & 0xFFFFFFFF00000000) >> 32);
ptt = &pt;
st.T = *(float*)ptt;
pt = ((HighData & 0xFFFFFFFF));
ptt = &pt;
st.Q = *(float*)ptt;
t.regs.Add(st);
break; break;
case GIFRegDescriptor.UV: case GIFRegDescriptor.UV:
GIFRegPackedUV u = new GIFRegPackedUV(); t.regs.Add(GIFRegUV.Unpack(LowData, HighData, false));
u.Descriptor = registers[i];
u.U = (LowData & 0x3FFF) / 16d;
u.V = ((LowData & 0x3FFF00000000) >> 32) / 16d;
t.regs.Add(u);
break; break;
case GIFRegDescriptor.XYZF2: case GIFRegDescriptor.XYZF2:
GIFRegPackedXYZF xf = new GIFRegPackedXYZF(); t.regs.Add(GIFRegXYZF.Unpack(LowData, HighData, false));
xf.Descriptor = registers[i];
xf.X = (LowData & 0xFFFF) / 16d;
xf.Y = ((LowData & 0xFFFF00000000) >> 32) / 16d;
xf.Z = (UInt32)((HighData & 0xFFFFFF0) >> 4);
xf.F = (UInt16)((HighData & 0xFF000000000) >> 36);
xf.ADC = ((HighData & 0x1000000000000) >> 46) == 1;
t.regs.Add(xf);
break; break;
case GIFRegDescriptor.XYZ2: case GIFRegDescriptor.XYZ2:
GIFRegPackedXYZ xf2 = new GIFRegPackedXYZ(); t.regs.Add(GIFRegXYZ.Unpack(LowData, HighData, false));
xf2.Descriptor = registers[i];
xf2.X = (LowData & 0xFFFF) / 16d;
xf2.Y = ((LowData & 0xFFFF00000000) >> 32) / 16d;
xf2.Z = (UInt32)((HighData & 0xFFFFFF0) >> 4);
xf2.ADC = ((HighData & 0x1000000000000) >> 46) == 1;
t.regs.Add(xf2);
break; break;
case GIFRegDescriptor.FOG: case GIFRegDescriptor.FOG:
t.regs.Add(GIFRegFOG.Unpack(LowData, HighData, false));
break; break;
case GIFRegDescriptor.Reserved: case GIFRegDescriptor.Reserved:
// TODO?
break; break;
case GIFRegDescriptor.XYZF3: case GIFRegDescriptor.XYZF3:
GIFRegPackedXYZF xf3 = new GIFRegPackedXYZF(); t.regs.Add(GIFRegXYZF.Unpack(LowData, HighData, false));
xf3.Descriptor = registers[i];
xf3.X = (LowData & 0xFFFF) / 16d;
xf3.Y = ((LowData & 0xFFFF00000000) >> 32) / 16d;
xf3.Z = (UInt32)((HighData & 0xFFFFFF0) >> 4);
xf3.F = (UInt16)((HighData & 0xFF000000000) >> 36);
xf3.ADC = ((HighData & 0x1000000000000) >> 46) == 1;
t.regs.Add(xf3);
break; break;
case GIFRegDescriptor.XYZ3: case GIFRegDescriptor.XYZ3:
GIFRegPackedXYZ xf4 = new GIFRegPackedXYZ(); t.regs.Add(GIFRegXYZ.Unpack(LowData, HighData, false));
xf4.Descriptor = registers[i];
xf4.X = (LowData & 0xFFFF) / 16d;
xf4.Y = ((LowData & 0xFFFF00000000) >> 32) / 16d;
xf4.Z = (UInt32)((HighData & 0xFFFFFF0) >> 4);
xf4.ADC = ((HighData & 0x1000000000000) >> 46) == 1;
t.regs.Add(xf4);
break; break;
case GIFRegDescriptor.AD: case GIFRegDescriptor.AD:
int destaddr = (int)(HighData & 0xF); int destaddr = (int)(HighData & 0xF);
UInt64 datat = LowData;
break; break;
case GIFRegDescriptor.NOP: case GIFRegDescriptor.NOP:
// TODO?
break; break;
default: default:
break; break;