/// <summary> /// Saves xbox kernel as local file on pc. /// </summary> public void SaveAsFile() { Xbox.ConnectionCheck(); //dumps kernel byte[] KrnlDump = Xbox.GetMemory(Base, Size); //saves kernel FileStream fs = new FileStream(Xbox.Version + " Kernel v" + Xbox.KernelVersion + " " + Xbox.Modules[0].TimeStamp.ToString().Replace(':', '.').Replace('/', '.') + " (UTC) .exe", FileMode.Create); fs.Write(KrnlDump, 0, KrnlDump.Length); fs.Close(); }
public uint PacketNumber = 0; // if we detect any changes, update the packet number /// <summary> /// Searches xbox memory for XInputGetState(). Average execution time of 15ms. /// </summary> /// <returns></returns> uint GetXInputGetStateAddress() { // assumes everything we need is in header...why would they put it elsewhere??? // buffer to store our xbe header byte[] xbeh = Xbox.GetMemory(0x10000, (uint)0x1000); BinaryReader header = new BinaryReader(new System.IO.MemoryStream(xbeh)); header.BaseStream.Position = 0x11C; uint SegmentCount = header.ReadUInt32(); //gets segment count uint SegmentBase = header.ReadUInt32() - 0x10000; //gets base address of segment info table //loops through each segment for (int i = 0; i < SegmentCount; i++) { header.BaseStream.Position = (uint)(SegmentBase + i * 56) + 4; uint SegAddress = header.ReadUInt32(); uint SegSize = header.ReadUInt32(); header.BaseStream.Position += 8; header.BaseStream.Position = header.ReadUInt32() - 0x10000; string SegName = System.Text.ASCIIEncoding.ASCII.GetString(header.ReadBytes(3)); if (SegName.Equals("XPP")) { //dumps xpp segment byte[] SegDump = Xbox.GetMemory(SegAddress, SegSize); //searches for xinputgetstate function for (int j = 0; j < SegSize; j++) { if ((BitConverter.ToUInt64(SegDump, j) & 0xFFFFFFFFFFFF) == 0x000015FFDB335653) { return((uint)(SegAddress + j)); } } } } throw new Exception("Unable to find XInputGetState() in memory, you must manually specify this address instead if you wish to initialize a controller hook."); }
/// <summary> /// Initializes the history page. /// </summary> public XboxHistory(Xbox xbox) { Xbox = xbox; Xbox.SetMemory(0xB00292D0, ScriptBufferAddress); // set up the script buffer if (IsPresent()) { // restore our current allocations Xbox.ReloadAllocationTable(); // check other settings like controller hook etc... XInputGetStateAddress = Xbox.GetUInt32(Gamepad.XInputGetState); OriginalGamepadCode = Xbox.GetMemory(Gamepad.OriginalCodeBuffer, 10); } else { // allocate memory for our history pages AllocateHistoryPages(kSize); Xbox.SetMemory(kBaseAddress, 0x6F6C6559); // "Yelo" } }