public void init() { Process[] teardowns = Process.GetProcessesByName("teardown"); if (teardowns.Length > 0) { //calculate nessicary offsets Process process; IntPtr handle; Int64 playerInstance; Int64 gameInstance; Int32 processHandle; Int64 sceneInstance; process = teardowns[0]; handle = OpenProcess(PROCESS_ALL_ACCESS, false, process.Id); Byte[] buffer = new Byte[8]; Int32 bytesRead = 0; processHandle = (Int32)handle; dbgTxt.AppendText(" Entrypoint : 0x" + processHandle.ToString("X")); dbgTxt.AppendText(Environment.NewLine); Int64 baseAddress = process.MainModule.BaseAddress.ToInt64() + 0x003E4520; buffer = new byte[8]; ReadProcessMemory(processHandle, baseAddress, buffer, buffer.Length, ref bytesRead); gameInstance = BitConverter.ToInt64(buffer, 0); dbgTxt.AppendText(" Game instance : 0x" + gameInstance.ToString("X")); dbgTxt.AppendText(Environment.NewLine); buffer = new byte[8]; Int64 playerPtr = gameInstance + 0xA0; ReadProcessMemory(processHandle, playerPtr, buffer, buffer.Length, ref bytesRead); playerInstance = BitConverter.ToInt64(buffer, 0); dbgTxt.AppendText("Player instance : 0x" + playerInstance.ToString("X")); dbgTxt.AppendText(Environment.NewLine); buffer = new byte[8]; Int64 scenePtr = gameInstance + 0x40; ReadProcessMemory(processHandle, scenePtr, buffer, buffer.Length, ref bytesRead); sceneInstance = BitConverter.ToInt64(buffer, 0); dbgTxt.AppendText(" Scene instance : 0x" + sceneInstance.ToString("X")); dbgTxt.AppendText(Environment.NewLine); int read_vcount = 0; ReadProcessMemory(processHandle, sceneInstance + 0x530, origionalWallCode, origionalWallCode.Length, ref read_vcount); //create the offsetpackage pack = new offsetPackage(process, handle, playerInstance, gameInstance, processHandle, sceneInstance); byte[] defSpeed = BitConverter.GetBytes(1f); WriteProcessMemory(pack.processHandle, pack.playerInstance + 0x0160, defSpeed, defSpeed.Length, ref bytesRead); //put default speed value into unused memory for later //initialise mods removeBoundaries = new removeBoundaries(pack); teleport = new teleport(pack); jetpack = new jetpack(pack); immortality = new immortality(pack); step = new step(pack); fly = new fly(pack); slowmo = new slowmo(pack); this.Text = "Teardown diddler [ACTIVE]"; tc.Enabled = true; gbReapply.Enabled = true; updateCurrentPositions.Start(); } else { this.Text = "Teardown diddler [INACTIVE]"; } }
public removeBoundaries(offsetPackage pack) { this.pack = pack; }