private string GetInputName(SHBIN.DVLE d, uint r) { if (r >> 4 == 0U) { for (int index = 0; (long)index < (long)d.NrVariables; ++index) { if ((int)d.Variables[index].StartRegister == (int)r) { return(d.SymbolTable[(int)d.Variables[index].SymbolOffset]); } } } else if (r >> 4 == 2U) { r = (uint)((int)r & 15 | 16); for (int index = 0; (long)index < (long)d.NrVariables; ++index) { if ((uint)d.Variables[index].StartRegister <= r && (uint)d.Variables[index].EndRegister >= r) { return(d.SymbolTable[(int)d.Variables[index].SymbolOffset] + "[" + (object)(uint)((int)r - (int)d.Variables[index].StartRegister) + "]"); } } } return(string.Format("{0:X}", (object)r)); }
private string GetOutputName(SHBIN.DVLE d, uint r) { if (r >> 4 == 0U) { switch (r) { case 0: return("gl_Position"); case 2: return("gl_Color"); case 4: return("gl_TexCoord[0]"); case 6: return("gl_TexCoord[1]"); case 8: return("gl_Texcoord[2]"); } } return(string.Format("{0:X}", (object)r)); }
private void Dump(SHBIN.DVLE d, uint Offset, uint NrInstructions) { int offset = (int)Offset * 4; for (int index = 0; (long)index < (long)NrInstructions; ++index) { foreach (SHBIN.DVLE.Label label in d.Labels) { if ((long)label.LabelProgramOffset == (long)(offset / 4)) { Console.WriteLine(d.SymbolTable[(int)label.SymbolOffset] + ":"); } } uint num1 = Bytes.Read4BytesAsUInt32(this.Dvlp.Program, offset); offset += 4; uint num2 = num1 >> 26; uint num3 = num2; if (num3 <= 8U) { switch ((int)num3 - 1) { case 0: SHBIN.DVLP.ExtensionTableEntry extensionTableEntry1 = this.Dvlp.ExtensionTableEntries[(IntPtr)(num1 & 63U)]; Console.WriteLine(" DP3 - {0}.{1} dot {2}.{3} -> {4}.{5}", (object)this.GetInputName(d, num1 >> 12 & 63U), (object)extensionTableEntry1.GetSource1Mask(), (object)this.GetInputName(d, num1 >> 6 & 63U), (object)extensionTableEntry1.GetSource2Mask(), (object)this.GetOutputName(d, num1 >> 20 & 63U), (object)extensionTableEntry1.GetOutputMask()); continue; case 1: SHBIN.DVLP.ExtensionTableEntry extensionTableEntry2 = this.Dvlp.ExtensionTableEntries[(IntPtr)(num1 & 63U)]; Console.WriteLine(" DP4 - {0}.{1} dot {2}.{3} -> {4}.{5}", (object)this.GetInputName(d, num1 >> 12 & 63U), (object)extensionTableEntry2.GetSource1Mask(), (object)this.GetInputName(d, num1 >> 6 & 63U), (object)extensionTableEntry2.GetSource2Mask(), (object)this.GetOutputName(d, num1 >> 20 & 63U), (object)extensionTableEntry2.GetOutputMask()); continue; default: if (num3 == 8U) { SHBIN.DVLP.ExtensionTableEntry extensionTableEntry3 = this.Dvlp.ExtensionTableEntries[(IntPtr)(num1 & 63U)]; Console.WriteLine(" MUL - {0}.{1} * {2}.{3} -> {4}.{5}", (object)this.GetInputName(d, num1 >> 12 & 63U), (object)extensionTableEntry3.GetSource1Mask(), (object)this.GetInputName(d, num1 >> 6 & 63U), (object)extensionTableEntry3.GetSource2Mask(), (object)this.GetOutputName(d, num1 >> 20 & 63U), (object)extensionTableEntry3.GetOutputMask()); continue; } break; } } else if (num3 != 11U) { if (num3 != 19U) { switch ((int)num3 - 33) { case 0: Console.WriteLine(" END21"); continue; case 1: Console.WriteLine(" END22"); continue; case 3: uint num4 = num1 & 1023U; uint num5 = num1 >> 10 & 1023U; string str = ""; foreach (SHBIN.DVLE.Label label in d.Labels) { if ((int)label.LabelProgramOffset == (int)num5) { str = d.SymbolTable[(int)label.SymbolOffset]; } } Console.WriteLine(" CAL - " + str); continue; } } else { SHBIN.DVLP.ExtensionTableEntry extensionTableEntry3 = this.Dvlp.ExtensionTableEntries[(IntPtr)(num1 & 63U)]; Console.WriteLine(" MOV - {0}.{1} -> {2}.{3}", new object[4] { (object)this.GetInputName(d, num1 >> 12 & 63U), (object)extensionTableEntry3.GetSource1Mask(), (object)this.GetOutputName(d, num1 >> 20 & 63U), (object)extensionTableEntry3.GetOutputMask() }); continue; } } else { SHBIN.DVLP.ExtensionTableEntry extensionTableEntry3 = this.Dvlp.ExtensionTableEntries[(IntPtr)(num1 & 63U)]; Console.WriteLine(" UNKB - {0}.{1}, {2}.{3} -> {4}.{5}", (object)this.GetInputName(d, num1 >> 12 & 63U), (object)extensionTableEntry3.GetSource1Mask(), (object)this.GetInputName(d, num1 >> 6 & 63U), (object)extensionTableEntry3.GetSource2Mask(), (object)this.GetOutputName(d, num1 >> 20 & 63U), (object)extensionTableEntry3.GetOutputMask()); continue; } if (num2 < 32U) { SHBIN.DVLP.ExtensionTableEntry extensionTableEntry3 = this.Dvlp.ExtensionTableEntries[(IntPtr)(num1 & 63U)]; Console.WriteLine(" {0:X} - {1}.{2}, {3:X}.{4} -> {5}.{6}", (object)num2, (object)this.GetInputName(d, num1 >> 12 & 63U), (object)extensionTableEntry3.GetSource1Mask(), (object)this.GetInputName(d, num1 >> 6 & 63U), (object)extensionTableEntry3.GetSource2Mask(), (object)this.GetOutputName(d, num1 >> 20 & 63U), (object)extensionTableEntry3.GetOutputMask()); } else { Console.WriteLine(" {0:X}", (object)num2); } } foreach (SHBIN.DVLE.Label label in d.Labels) { if ((long)label.LabelProgramOffset == (long)(offset / 4)) { Console.WriteLine(d.SymbolTable[(int)label.SymbolOffset] + ":"); } } }