private static void Loop() { ProcUtils proc; ProcessModule swtorModule = null; ProcessModule memoryManModule = null; while (!ProcUtils.ProcessIsRunning("swtor") && m_bWork) { Thread.Sleep(500); } if (!m_bWork) return; Process swtor = Process.GetProcessesByName("swtor").FirstOrDefault(p => string.IsNullOrWhiteSpace(p.MainWindowTitle)); proc = new ProcUtils(swtor, WinAPI.ProcessAccessFlags.VirtualMemoryRead | WinAPI.ProcessAccessFlags.VirtualMemoryWrite | WinAPI.ProcessAccessFlags.VirtualMemoryOperation); MemUtils.Handle = proc.Handle; while (swtorModule == null) { swtorModule = proc.GetModuleByName("swtor.exe"); } while (memoryManModule == null) { memoryManModule = proc.GetModuleByName("MemoryMan.dll"); } int swrba = swtorModule.BaseAddress.ToInt32(); int mma = memoryManModule.BaseAddress.ToInt32(); int pb = MemUtils.Read<int>((IntPtr)(swrba) + 0x01412EA4); float prev_x = 0.0f; float prev_y = 0.0f; float prev_z = 0.0f; byte[] nop = { 0x90, 0x90, 0x90, 0x90, 0x90 }; byte[] up_down_bytes = { 0xF3, 0x0F, 0x11, 0x46, 0x0C }; while (proc.IsRunning && m_bWork) { Thread.Sleep((int)(1000f / 60f)); //Don't do anything if game is not in foreground //if (WinAPI.GetForegroundWindow() != proc.Process.MainWindowHandle) // continue; int xyz2 = MemUtils.Read<int>((IntPtr)(pb) + 0x18); IntPtr xyz = (IntPtr)(xyz2) + 0x14; IntPtr x_address = (IntPtr)(xyz); IntPtr y_address = (IntPtr)(xyz + 0x04); IntPtr z_address = (IntPtr)(xyz + 0x08); float x = MemUtils.Read<float>(x_address); float y = MemUtils.Read<float>(y_address); float z = MemUtils.Read<float>(z_address); #region Handling input keyUtils.Update(); Console.WriteLine("X: " + x + " Y: " + y + " Z: " + z); //if (keyUtils.KeyIsDown(WinAPI.VirtualKeyShort.ESCAPE)) // m_bWork = false; if (keyUtils.KeyIsDown(WinAPI.VirtualKeyShort.NUMPAD1) && keyUtils.KeyIsDown(WinAPI.VirtualKeyShort.KEY_W)) // FORWARD MemUtils.Write<float>((IntPtr)(z_address), prev_z -= 0.15f); if (keyUtils.KeyIsDown(WinAPI.VirtualKeyShort.NUMPAD1) && keyUtils.KeyIsDown(WinAPI.VirtualKeyShort.KEY_A)) // LEFT MemUtils.Write<float>((IntPtr)(x_address), prev_x -= 0.15f); if (keyUtils.KeyIsDown(WinAPI.VirtualKeyShort.NUMPAD1) && keyUtils.KeyIsDown(WinAPI.VirtualKeyShort.KEY_S)) // BACK MemUtils.Write<float>((IntPtr)(z_address), prev_z += 0.15f); if (keyUtils.KeyIsDown(WinAPI.VirtualKeyShort.NUMPAD1) && keyUtils.KeyIsDown(WinAPI.VirtualKeyShort.KEY_D)) // RIGHT MemUtils.Write<float>((IntPtr)(x_address), prev_x += 0.15f); if (keyUtils.KeyIsDown(WinAPI.VirtualKeyShort.NUMPAD1) && keyUtils.KeyIsDown(WinAPI.VirtualKeyShort.SPACE)) // UP MemUtils.Write<float>((IntPtr)(y_address), prev_y + 0.10f); if (keyUtils.KeyIsDown(WinAPI.VirtualKeyShort.NUMPAD1) && keyUtils.KeyIsDown(WinAPI.VirtualKeyShort.CONTROL)) // DOWN MemUtils.Write<float>((IntPtr)(y_address), prev_y - 0.10f); #endregion prev_x = x; prev_y = y; prev_z = z; } }
public static void Main(string[] args) { System.Windows.Forms.Application.EnableVisualStyles(); System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false); PrintSuccess("[>]=-- Zat's CSGO-ESP"); KeyUtils = new KeyUtils(); ConfigUtils = new CSGOConfigUtils(); ConfigUtils.SetValue("espEnabled", true); ConfigUtils.SetValue("espBox", false); ConfigUtils.SetValue("espSkeleton", true); ConfigUtils.SetValue("espName", false); ConfigUtils.SetValue("espHealth", true); ConfigUtils.SetValue("aimEnabled", true); ConfigUtils.SetValue("aimKey", WinAPI.VirtualKeyShort.XBUTTON1); ConfigUtils.SetValue("aimToggle", false); ConfigUtils.SetValue("aimHold", true); ConfigUtils.SetValue("aimFov", 30f); ConfigUtils.SetValue("aimSmoothEnabled", true); ConfigUtils.SetValue("aimSmoothValue", 0.2f); ConfigUtils.SetValue("aimFilterSpotted", false); ConfigUtils.SetValue("aimFilterSpottedBy", false); ConfigUtils.SetValue("aimFilterEnemies", true); ConfigUtils.SetValue("aimFilterAllies", false); ConfigUtils.SetValue("rcsEnabled", true); ConfigUtils.SetValue("rcsForce", 100f); ConfigUtils.ReadSettingsFromFile("euc_csgo.cfg"); PrintInfo("> Waiting for CSGO to start up..."); while (!ProcUtils.ProcessIsRunning("csgo")) Thread.Sleep(250); ProcUtils = new ProcUtils("csgo", WinAPI.ProcessAccessFlags.VirtualMemoryRead | WinAPI.ProcessAccessFlags.VirtualMemoryWrite | WinAPI.ProcessAccessFlags.VirtualMemoryOperation); MemUtils = new ExternalUtilsCSharp.MemUtils(); MemUtils.Handle = ProcUtils.Handle; PrintInfo("> Waiting for CSGOs window to show up..."); while ((hWnd = WinAPI.FindWindowByCaption(hWnd, "Counter-Strike: Global Offensive")) == IntPtr.Zero) Thread.Sleep(250); ProcessModule clientDll, engineDll; PrintInfo("> Waiting for CSGO to load client.dll..."); while ((clientDll = ProcUtils.GetModuleByName(@"bin\client.dll")) == null) Thread.Sleep(250); PrintInfo("> Waiting for CSGO to load engine.dll..."); while ((engineDll = ProcUtils.GetModuleByName(@"engine.dll")) == null) Thread.Sleep(250); Framework = new Framework(clientDll, engineDll); PrintInfo("> Initializing overlay"); using (SHDXOverlay = new SharpDXOverlay()) { SHDXOverlay.Attach(hWnd); SHDXOverlay.TickEvent += overlay_TickEvent; InitializeComponents(); SharpDXRenderer renderer = SHDXOverlay.Renderer; TextFormat smallFont = renderer.CreateFont("smallFont", "Century Gothic", 10f); TextFormat largeFont = renderer.CreateFont("largeFont", "Century Gothic", 14f); TextFormat heavyFont = renderer.CreateFont("heavyFont", "Century Gothic", 14f, FontStyle.Normal, FontWeight.Heavy); windowMenu.Font = smallFont; windowMenu.Caption.Font = largeFont; windowGraphs.Font = smallFont; windowGraphs.Caption.Font = largeFont; windowSpectators.Font = smallFont; windowSpectators.Caption.Font = largeFont; graphMemRead.Font = smallFont; graphMemWrite.Font = smallFont; for (int i = 0; i < ctrlPlayerESP.Length; i++) { ctrlPlayerESP[i].Font = heavyFont; SHDXOverlay.ChildControls.Add(ctrlPlayerESP[i]); } ctrlRadar.Font = smallFont; windowMenu.ApplySettings(ConfigUtils); SHDXOverlay.ChildControls.Add(ctrlRadar); SHDXOverlay.ChildControls.Add(windowMenu); SHDXOverlay.ChildControls.Add(windowGraphs); SHDXOverlay.ChildControls.Add(windowSpectators); SHDXOverlay.ChildControls.Add(cursor); PrintInfo("> Running overlay"); System.Windows.Forms.Application.Run(SHDXOverlay); } ConfigUtils.SaveSettingsToFile("euc_csgo.cfg"); }