From a3902c57cc0c9984934a6738ab7153fb9194c19a Mon Sep 17 00:00:00 2001 From: "feal87@gmail.com" Date: Sat, 25 Dec 2010 17:18:13 +0000 Subject: [PATCH] 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 --- tools/GSDumpGUI/GSDumpGUI.csproj | 13 +-- tools/GSDumpGUI/Library/GSDXWrapper.cs | 24 ++--- .../GSDump/GSData/GIFPacket/GIFReg/GIFReg.cs | 33 +++---- .../GSData/GIFPacket/GIFReg/GIFRegFOG.cs | 19 ++++ .../GIFPacket/GIFReg/GIFRegPackedPrim.cs | 43 --------- .../GIFPacket/GIFReg/GIFRegPackedRGBAQ.cs | 14 --- .../GSData/GIFPacket/GIFReg/GIFRegPackedST.cs | 13 --- .../GSData/GIFPacket/GIFReg/GIFRegPackedUV.cs | 12 --- .../GIFPacket/GIFReg/GIFRegPackedXYZ.cs | 14 --- .../GIFPacket/GIFReg/GIFRegPackedXYZF.cs | 15 ---- .../GSData/GIFPacket/GIFReg/GIFRegPrim.cs | 59 +++++++++++++ .../GSData/GIFPacket/GIFReg/GIFRegRGBAQ.cs | 25 ++++++ .../GSData/GIFPacket/GIFReg/GIFRegST.cs | 35 ++++++++ .../GSData/GIFPacket/GIFReg/GIFRegUV.cs | 21 +++++ .../GSData/GIFPacket/GIFReg/GIFRegXYZ.cs | 25 ++++++ .../GSData/GIFPacket/GIFReg/GIFRegXYZF.cs | 27 ++++++ .../Library/GSDump/GSData/GIFPacket/GIFTag.cs | 87 +++---------------- 17 files changed, 259 insertions(+), 220 deletions(-) create mode 100644 tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegFOG.cs delete mode 100644 tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegPackedPrim.cs delete mode 100644 tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegPackedRGBAQ.cs delete mode 100644 tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegPackedST.cs delete mode 100644 tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegPackedUV.cs delete mode 100644 tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegPackedXYZ.cs delete mode 100644 tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegPackedXYZF.cs create mode 100644 tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegPrim.cs create mode 100644 tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegRGBAQ.cs create mode 100644 tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegST.cs create mode 100644 tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegUV.cs create mode 100644 tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegXYZ.cs create mode 100644 tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegXYZF.cs diff --git a/tools/GSDumpGUI/GSDumpGUI.csproj b/tools/GSDumpGUI/GSDumpGUI.csproj index 70672798d4..0546d49414 100644 --- a/tools/GSDumpGUI/GSDumpGUI.csproj +++ b/tools/GSDumpGUI/GSDumpGUI.csproj @@ -56,14 +56,15 @@ frmMain.cs - - - - + + + + + - - + + diff --git a/tools/GSDumpGUI/Library/GSDXWrapper.cs b/tools/GSDumpGUI/Library/GSDXWrapper.cs index e61cd133b6..60628efac4 100644 --- a/tools/GSDumpGUI/Library/GSDXWrapper.cs +++ b/tools/GSDumpGUI/Library/GSDXWrapper.cs @@ -417,35 +417,35 @@ namespace GSDumpGUI { 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() + "@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() + "~"; } - 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") + "~"; } - 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") + "~"; } - 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() + "~"; } - 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() + "~"; } } diff --git a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFReg.cs b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFReg.cs index 512c25e0cb..cc8d5c1f32 100644 --- a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFReg.cs +++ b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFReg.cs @@ -11,21 +11,22 @@ namespace GSDumpGUI public enum GIFRegDescriptor { - PRIM = 0, - RGBAQ = 1, - ST = 2, - UV = 3, - XYZF2 = 4, - XYZ2 = 5, - TEX0_1 = 6, - TEX0_2 = 7, - CLAMP_1 = 8, - CLAMP_2 = 9, - FOG = 10, - Reserved = 11, - XYZF3 = 12, - XYZ3 = 13, - AD = 14, - NOP = 15 + PRIM = 0x00, + RGBAQ = 0x01, + ST = 0x02, + UV = 0x03, + XYZF2 = 0x04, + XYZ2 = 0x05, + TEX0_1 = 0x06, + TEX0_2 = 0x07, + CLAMP_1 = 0x08, + CLAMP_2 = 0x09, + FOG = 0x0a, + Reserved = 0x0b, + XYZF3 = 0x0c, + XYZ3 = 0x0d, + AD = 0x0e, + NOP = 0x0f } + } diff --git a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegFOG.cs b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegFOG.cs new file mode 100644 index 0000000000..407ee44608 --- /dev/null +++ b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegFOG.cs @@ -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; + } + } +} diff --git a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegPackedPrim.cs b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegPackedPrim.cs deleted file mode 100644 index 2dd5e53852..0000000000 --- a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegPackedPrim.cs +++ /dev/null @@ -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 - } -} diff --git a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegPackedRGBAQ.cs b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegPackedRGBAQ.cs deleted file mode 100644 index 60e89c7131..0000000000 --- a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegPackedRGBAQ.cs +++ /dev/null @@ -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; - } -} diff --git a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegPackedST.cs b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegPackedST.cs deleted file mode 100644 index ef62e0ab7f..0000000000 --- a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegPackedST.cs +++ /dev/null @@ -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; - } -} diff --git a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegPackedUV.cs b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegPackedUV.cs deleted file mode 100644 index 8b7b430a77..0000000000 --- a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegPackedUV.cs +++ /dev/null @@ -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; - } -} diff --git a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegPackedXYZ.cs b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegPackedXYZ.cs deleted file mode 100644 index 92a1d94521..0000000000 --- a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegPackedXYZ.cs +++ /dev/null @@ -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; - } -} diff --git a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegPackedXYZF.cs b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegPackedXYZF.cs deleted file mode 100644 index e8d9a61298..0000000000 --- a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegPackedXYZF.cs +++ /dev/null @@ -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; - } -} diff --git a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegPrim.cs b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegPrim.cs new file mode 100644 index 0000000000..9a92920dba --- /dev/null +++ b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegPrim.cs @@ -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 + } +} diff --git a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegRGBAQ.cs b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegRGBAQ.cs new file mode 100644 index 0000000000..bde570f4cd --- /dev/null +++ b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegRGBAQ.cs @@ -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; + } + } +} diff --git a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegST.cs b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegST.cs new file mode 100644 index 0000000000..c1b1a5c35f --- /dev/null +++ b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegST.cs @@ -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; + } + } + } +} diff --git a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegUV.cs b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegUV.cs new file mode 100644 index 0000000000..f5a4bb3565 --- /dev/null +++ b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegUV.cs @@ -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; + } + } +} diff --git a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegXYZ.cs b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegXYZ.cs new file mode 100644 index 0000000000..dc46acda5a --- /dev/null +++ b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegXYZ.cs @@ -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; + } + } +} diff --git a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegXYZF.cs b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegXYZF.cs new file mode 100644 index 0000000000..78db353254 --- /dev/null +++ b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegXYZF.cs @@ -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; + } + } +} diff --git a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFTag.cs b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFTag.cs index 244d5fca28..7c2f65f29f 100644 --- a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFTag.cs +++ b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFTag.cs @@ -62,104 +62,41 @@ namespace GSDumpGUI { case GIFRegDescriptor.PRIM: if (t.pre == 1) - { - 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); - } + t.regs.Add(GIFRegPrim.Unpack(LowData, HighData, false)); break; case GIFRegDescriptor.RGBAQ: - GIFRegPackedRGBAQ r = new GIFRegPackedRGBAQ(); - 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); + t.regs.Add(GIFRegRGBAQ.Unpack(LowData, HighData, false)); break; case GIFRegDescriptor.ST: - GIFRegPackedST st = new GIFRegPackedST(); - 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); + t.regs.Add(GIFRegST.Unpack(LowData, HighData, false)); break; case GIFRegDescriptor.UV: - GIFRegPackedUV u = new GIFRegPackedUV(); - u.Descriptor = registers[i]; - u.U = (LowData & 0x3FFF) / 16d; - u.V = ((LowData & 0x3FFF00000000) >> 32) / 16d; - - t.regs.Add(u); + t.regs.Add(GIFRegUV.Unpack(LowData, HighData, false)); break; case GIFRegDescriptor.XYZF2: - GIFRegPackedXYZF xf = new GIFRegPackedXYZF(); - 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); + t.regs.Add(GIFRegXYZF.Unpack(LowData, HighData, false)); break; case GIFRegDescriptor.XYZ2: - GIFRegPackedXYZ xf2 = new GIFRegPackedXYZ(); - 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); + t.regs.Add(GIFRegXYZ.Unpack(LowData, HighData, false)); break; case GIFRegDescriptor.FOG: + t.regs.Add(GIFRegFOG.Unpack(LowData, HighData, false)); break; case GIFRegDescriptor.Reserved: + // TODO? break; case GIFRegDescriptor.XYZF3: - GIFRegPackedXYZF xf3 = new GIFRegPackedXYZF(); - 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); + t.regs.Add(GIFRegXYZF.Unpack(LowData, HighData, false)); break; case GIFRegDescriptor.XYZ3: - GIFRegPackedXYZ xf4 = new GIFRegPackedXYZ(); - 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); + t.regs.Add(GIFRegXYZ.Unpack(LowData, HighData, false)); break; case GIFRegDescriptor.AD: int destaddr = (int)(HighData & 0xF); - + UInt64 datat = LowData; break; case GIFRegDescriptor.NOP: - + // TODO? break; default: break;