private void Connect() { if (this.Devkit) { XDevkit.XboxManager manager = (XDevkit.XboxManager) Activator.CreateInstance(System.Type.GetTypeFromCLSID(new Guid("A5EB45D8-F3B6-49B9-984A-0D313AB60342"))); this.Console = manager.OpenConsole(manager.DefaultConsole); } else { if (this.JtagConsole == null) { this.JtagConsole = new XRPC(); } this.JtagConsole.Connect(); } }
public uint Call(uint address, params object[] arg) { long[] numArray1 = new long[9]; if (!this.activeConnection) { this.Connect(); } if (XRPC.firstRan == 0) { byte[] Data = new byte[4]; this.xbCon.DebugTarget.GetMemory(2445314222U, 4U, Data, out XRPC.meh); this.xbCon.DebugTarget.InvalidateMemoryCache(true, 2445314222U, 4U); Array.Reverse((Array)Data); this.bufferAddress = BitConverter.ToUInt32(Data, 0); XRPC.firstRan = 1; this.stringPointer = this.bufferAddress + 1500U; this.floatPointer = this.bufferAddress + 2700U; this.bytePointer = this.bufferAddress + 3200U; this.xbCon.DebugTarget.SetMemory(this.bufferAddress, 100U, this.nulled, out XRPC.meh); this.xbCon.DebugTarget.SetMemory(this.stringPointer, 100U, this.nulled, out XRPC.meh); } if (this.bufferAddress == 0U) { byte[] Data = new byte[4]; this.xbCon.DebugTarget.GetMemory(2445314222U, 4U, Data, out XRPC.meh); this.xbCon.DebugTarget.InvalidateMemoryCache(true, 2445314222U, 4U); Array.Reverse((Array)Data); this.bufferAddress = BitConverter.ToUInt32(Data, 0); } this.stringPointer = this.bufferAddress + 1500U; this.floatPointer = this.bufferAddress + 2700U; this.bytePointer = this.bufferAddress + 3200U; int num = 0; int index1 = 0; foreach (object obj in arg) { if (obj is byte) { byte[] numArray2 = (byte[])obj; numArray1[index1] = (long)BitConverter.ToUInt32(numArray2, 0); } else if (obj is byte[]) { byte[] Data = (byte[])obj; this.xbCon.DebugTarget.SetMemory(this.bytePointer, (uint)Data.Length, Data, out XRPC.meh); numArray1[index1] = (long)this.bytePointer; this.bytePointer += (uint)(Data.Length + 2); } else if (obj is float) { byte[] bytes = BitConverter.GetBytes(float.Parse(Convert.ToString(obj))); this.xbCon.DebugTarget.SetMemory(this.floatPointer, (uint)bytes.Length, bytes, out XRPC.meh); numArray1[index1] = (long)this.floatPointer; this.floatPointer += (uint)(bytes.Length + 2); } else if (obj is float[]) { byte[] Data = new byte[12]; for (int index2 = 0; index2 <= 2; ++index2) { byte[] numArray2 = new byte[4]; Buffer.BlockCopy((Array)obj, index2 * 4, (Array)numArray2, 0, 4); Array.Reverse((Array)numArray2); Buffer.BlockCopy((Array)numArray2, 0, (Array)Data, 4 * index2, 4); } this.xbCon.DebugTarget.SetMemory(this.floatPointer, (uint)Data.Length, Data, out XRPC.meh); numArray1[index1] = (long)this.floatPointer; this.floatPointer += 2U; } else if (obj is string) { byte[] bytes = Encoding.ASCII.GetBytes(Convert.ToString(obj)); this.xbCon.DebugTarget.SetMemory(this.stringPointer, (uint)bytes.Length, bytes, out XRPC.meh); numArray1[index1] = (long)this.stringPointer; this.stringPointer += (uint)(Convert.ToString(obj).Length + 1); } else { numArray1[index1] = Convert.ToInt64(obj); } ++num; ++index1; } byte[] data = XRPC.getData(numArray1); this.xbCon.DebugTarget.SetMemory(this.bufferAddress + 8U, (uint)data.Length, data, out XRPC.meh); byte[] bytes1 = BitConverter.GetBytes(num); Array.Reverse((Array)bytes1); this.xbCon.DebugTarget.SetMemory(this.bufferAddress + 4U, 4U, bytes1, out XRPC.meh); Thread.Sleep(0); byte[] bytes2 = BitConverter.GetBytes(address); Array.Reverse((Array)bytes2); this.xbCon.DebugTarget.SetMemory(this.bufferAddress, 4U, bytes2, out XRPC.meh); Thread.Sleep(50); byte[] Data1 = new byte[4]; this.xbCon.DebugTarget.GetMemory(this.bufferAddress + 4092U, 4U, Data1, out XRPC.meh); this.xbCon.DebugTarget.InvalidateMemoryCache(true, this.bufferAddress + 4092U, 4U); Array.Reverse((Array)Data1); return(BitConverter.ToUInt32(Data1, 0)); }