diff --git a/tools/GSDumpGUI/GSDumpGUI.csproj b/tools/GSDumpGUI/GSDumpGUI.csproj
index 0546d49414..f2a833b17c 100644
--- a/tools/GSDumpGUI/GSDumpGUI.csproj
+++ b/tools/GSDumpGUI/GSDumpGUI.csproj
@@ -56,6 +56,7 @@
frmMain.cs
+
diff --git a/tools/GSDumpGUI/Library/GSDXWrapper.cs b/tools/GSDumpGUI/Library/GSDXWrapper.cs
index 60628efac4..28300decfc 100644
--- a/tools/GSDumpGUI/Library/GSDXWrapper.cs
+++ b/tools/GSDumpGUI/Library/GSDXWrapper.cs
@@ -448,6 +448,13 @@ namespace GSDumpGUI
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() + "~";
}
+ if (itm.GetType() == typeof(GIFRegTEX0))
+ {
+ GIFRegTEX0 p = (GIFRegTEX0)itm;
+ val += "Packed TEX0@TBP0 : " + p.TBP0.ToString() + "@TBW : " + p.TBW.ToString() + "@PSM : " + p.PSM.ToString() + "@TW : " + p.TW.ToString() + "@TH : " + p.TH.ToString()
+ + "@TCC : " + p.TCC.ToString() + "@TFX : " + p.TFX.ToString() + "@CBP : " + p.CBP.ToString() + "@CPSM : " + p.CPSM.ToString() + "@CSM : " + p.CSM.ToString()
+ + "@CSA : " + p.CSA.ToString() + "@CLD : " + p.CLD.ToString() + "~";
+ }
}
else
{
diff --git a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFReg.cs b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFReg.cs
index cc8d5c1f32..153792423c 100644
--- a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFReg.cs
+++ b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFReg.cs
@@ -7,6 +7,11 @@ namespace GSDumpGUI
abstract public class GIFReg : IGifData
{
public GIFRegDescriptor Descriptor;
+
+ static public UInt64 GetBit(UInt64 value, byte lower, byte count)
+ {
+ return (value >> lower) & (ulong)((Math.Pow(2, count)) - 1);
+ }
}
public enum GIFRegDescriptor
diff --git a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegFOG.cs b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegFOG.cs
index 407ee44608..c2c8f3da73 100644
--- a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegFOG.cs
+++ b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegFOG.cs
@@ -12,7 +12,7 @@ namespace GSDumpGUI
{
GIFRegFOG u = new GIFRegFOG();
u.Descriptor = GIFRegDescriptor.FOG;
- u.F = (UInt16)((HighData & 0xFF000000000) >> 36);
+ u.F = (UInt16)(GIFReg.GetBit(HighData, 36, 8));
return u;
}
}
diff --git a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegPrim.cs b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegPrim.cs
index 9a92920dba..6b937a660f 100644
--- a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegPrim.cs
+++ b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegPrim.cs
@@ -20,15 +20,15 @@ namespace GSDumpGUI
{
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);
+ pr.PrimitiveType = (GS_PRIM)GIFReg.GetBit(LowData, 0, 3);
+ pr.IIP = (GSIIP)GIFReg.GetBit(LowData, 3, 1);
+ pr.TME = Convert.ToBoolean(GIFReg.GetBit(LowData, 4, 1));
+ pr.FGE = Convert.ToBoolean(GIFReg.GetBit(LowData, 5, 1));
+ pr.ABE = Convert.ToBoolean(GIFReg.GetBit(LowData, 6, 1));
+ pr.AA1 = Convert.ToBoolean(GIFReg.GetBit(LowData, 7, 1));
+ pr.FST = (GSFST)(GIFReg.GetBit(LowData, 8, 1));
+ pr.CTXT = (GSCTXT)(GIFReg.GetBit(LowData, 9, 1));
+ pr.FIX = (GSFIX)(GIFReg.GetBit(LowData, 10, 1));
return pr;
}
}
diff --git a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegRGBAQ.cs b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegRGBAQ.cs
index bde570f4cd..8913948623 100644
--- a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegRGBAQ.cs
+++ b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegRGBAQ.cs
@@ -15,10 +15,10 @@ namespace GSDumpGUI
{
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);
+ r.R = (int)GIFReg.GetBit(LowData, 0, 8);
+ r.G = (int)GIFReg.GetBit(LowData, 32, 8);
+ r.B = (int)GIFReg.GetBit(HighData, 0, 8);
+ r.A = (int)GIFReg.GetBit(HighData, 32, 8);
return r;
}
}
diff --git a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegST.cs b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegST.cs
index c1b1a5c35f..b9bcec8803 100644
--- a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegST.cs
+++ b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegST.cs
@@ -17,15 +17,15 @@ namespace GSDumpGUI
GIFRegST st = new GIFRegST();
st.Descriptor = GIFRegDescriptor.ST;
- ulong pt = ((LowData & 0xFFFFFFFF));
+ ulong pt = GIFReg.GetBit(LowData, 0, 32);
void* ptt = &pt;
st.S = *(float*)ptt;
- pt = ((LowData & 0xFFFFFFFF00000000) >> 32);
+ pt = GIFReg.GetBit(LowData, 32, 32);
ptt = &pt;
st.T = *(float*)ptt;
- pt = ((HighData & 0xFFFFFFFF));
+ pt = GIFReg.GetBit(HighData, 0, 32);
ptt = &pt;
st.Q = *(float*)ptt;
return st;
diff --git a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegTEX0.cs b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegTEX0.cs
new file mode 100644
index 0000000000..bf577199d3
--- /dev/null
+++ b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegTEX0.cs
@@ -0,0 +1,90 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace GSDumpGUI
+{
+ public class GIFRegTEX0 : GIFReg
+ {
+ public int TBP0;
+ public int TBW;
+ public TEXPSM PSM;
+ public int TW;
+ public int TH;
+ public TEXTCC TCC;
+ public TEXTFX TFX;
+ public int CBP;
+ public TEXCPSM CPSM;
+ public TEXCSM CSM;
+ public int CSA;
+ public int CLD;
+
+ static public GIFReg Unpack(UInt64 LowData, UInt64 HighData, bool PlainFormat)
+ {
+ if (PlainFormat)
+ {
+ GIFRegTEX0 r = new GIFRegTEX0();
+ r.Descriptor = GIFRegDescriptor.TEX0_1;
+ r.TBP0 = (int)GetBit(LowData, 0, 14);
+ r.TBW = (int)GetBit(LowData, 14, 6);
+ r.PSM = (TEXPSM)(int)GetBit(LowData, 20, 6);
+ r.TW = (int)GetBit(LowData, 26, 4);
+ r.TH = (int)GetBit(LowData, 30, 4);
+ r.TCC = (TEXTCC)(int)GetBit(LowData, 34, 1);
+ r.TFX = (TEXTFX)(int)GetBit(LowData, 35, 2);
+ r.CBP = (int)GetBit(LowData, 37, 14);
+ r.CPSM = (TEXCPSM)(int)GetBit(LowData, 51, 4);
+ r.CSM = (TEXCSM)(int)GetBit(LowData, 55, 1);
+ r.CSA = (int)GetBit(LowData, 56, 5);
+ r.CLD = (int)GetBit(LowData, 61, 3);
+ return r;
+ }
+ else
+ throw new ArgumentException("TEX0 Does not have packed format");
+ }
+ }
+
+ public enum TEXPSM
+ {
+ PSMCT32 = 0,
+ PSMCT24 = 1,
+ PSMCT16 = 2,
+ PSMCT16S = 10,
+ PSMT8 = 19,
+ PSMT4 = 20,
+ PSMT8H = 27,
+ PSMT4HL = 36,
+ PSMT4HH = 44,
+ PSMZ32 = 48,
+ PSMZ24 = 49,
+ PSMZ16 = 50,
+ PSMZ16S = 58
+ }
+
+ public enum TEXTCC
+ {
+ RGB = 0,
+ RGBA = 1
+ }
+
+ public enum TEXTFX
+ {
+ MODULATE = 0,
+ DECAL = 1,
+ HIGHLIGHT = 2,
+ HIGHLIGHT2 = 3
+ }
+
+ public enum TEXCPSM
+ {
+ PSMCT32 = 0,
+ PSMCT16 = 2,
+ PSMCT16S = 10
+ }
+
+ public enum TEXCSM
+ {
+ CSM1 = 0,
+ CSM2 = 1
+ }
+}
diff --git a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegUV.cs b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegUV.cs
index f5a4bb3565..65b51dcfd8 100644
--- a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegUV.cs
+++ b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegUV.cs
@@ -13,8 +13,8 @@ namespace GSDumpGUI
{
GIFRegUV u = new GIFRegUV();
u.Descriptor = GIFRegDescriptor.UV;
- u.U = (LowData & 0x3FFF) / 16d;
- u.V = ((LowData & 0x3FFF00000000) >> 32) / 16d;
+ u.U = GIFReg.GetBit(LowData, 0, 14) / 16d;
+ u.V = GIFReg.GetBit(LowData, 32, 14) / 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
index dc46acda5a..d228c47b3d 100644
--- a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegXYZ.cs
+++ b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegXYZ.cs
@@ -13,12 +13,12 @@ namespace GSDumpGUI
static public GIFReg Unpack(UInt64 LowData, UInt64 HighData, bool PlainFormat)
{
- GIFRegXYZF xf = new GIFRegXYZF();
- xf.ADC = ((HighData & 0x1000000000000) >> 46) == 1;
+ GIFRegXYZ xf = new GIFRegXYZ();
+ xf.ADC = GIFReg.GetBit(HighData, 47, 1) == 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);
+ xf.X = GIFReg.GetBit(LowData, 0, 16) / 16d;
+ xf.Y = GIFReg.GetBit(LowData, 32, 16) / 16d;
+ xf.Z = (UInt32)(GIFReg.GetBit(HighData, 4, 24));
return xf;
}
}
diff --git a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegXYZF.cs b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegXYZF.cs
index 78db353254..cafca3d1a3 100644
--- a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegXYZF.cs
+++ b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegXYZF.cs
@@ -14,13 +14,13 @@ namespace GSDumpGUI
static public GIFReg Unpack(UInt64 LowData, UInt64 HighData, bool PlainFormat)
{
- GIFRegXYZ xf2 = new GIFRegXYZ();
- xf2.ADC = ((HighData & 0x1000000000000) >> 46) == 1;
+ GIFRegXYZF xf2 = new GIFRegXYZF();
+ xf2.ADC = GIFReg.GetBit(HighData, 47, 1) == 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);
+ xf2.X = GIFReg.GetBit(LowData, 0, 16) / 16d;
+ xf2.Y = GIFReg.GetBit(LowData, 32, 16) / 16d;
+ xf2.Z = (UInt32)(GIFReg.GetBit(HighData, 4, 24));
+ xf2.F = (UInt16)(GIFReg.GetBit(HighData, 36, 8));
return xf2;
}
}
diff --git a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFTag.cs b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFTag.cs
index 7c2f65f29f..b039074aad 100644
--- a/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFTag.cs
+++ b/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFTag.cs
@@ -53,7 +53,7 @@ namespace GSDumpGUI
for (int i = 0; i < registers.Count; i++)
{
UInt64 LowData = BitConverter.ToUInt64(data, (16 + (i * 16) + (j * 16 * registers.Count)));
- UInt64 HighData = BitConverter.ToUInt64(data, (16 + (i * 16) + (j * 16 * registers.Count)));
+ UInt64 HighData = BitConverter.ToUInt64(data, (16 + (i * 16) + 8 + (j * 16 * registers.Count)));
switch (t.flg)
{
@@ -82,6 +82,10 @@ namespace GSDumpGUI
case GIFRegDescriptor.FOG:
t.regs.Add(GIFRegFOG.Unpack(LowData, HighData, false));
break;
+ case GIFRegDescriptor.TEX0_1:
+ case GIFRegDescriptor.TEX0_2:
+ t.regs.Add(GIFRegTEX0.Unpack(LowData, HighData, true));
+ break;
case GIFRegDescriptor.Reserved:
// TODO?
break;
@@ -94,6 +98,8 @@ namespace GSDumpGUI
case GIFRegDescriptor.AD:
int destaddr = (int)(HighData & 0xF);
UInt64 datat = LowData;
+ if (destaddr == (int)GIFRegDescriptor.TEX0_1 || destaddr == (int)GIFRegDescriptor.TEX0_2)
+ t.regs.Add(GIFRegTEX0.Unpack(datat, HighData, true));
break;
case GIFRegDescriptor.NOP:
// TODO?