Ejemplo n.º 1
0
        private static void Main(string[] args)
        {
            var game_process = GetProcess("csgo", 5000);

            var overlay = new StickyOverlayWindow(game_process.MainWindowHandle, new OverlayCreationOptions
            {
                BypassTopmost = true,
                WindowTitle   = HelperMethods.GenerateRandomString(5, 11)
            });

            overlay.OnWindowBoundsChanged += Overlay_OnWindowBoundsChanged;

            gfx = new Direct2DRenderer(new RendererOptions
            {
                AntiAliasing = true,
                Hwnd         = overlay.WindowHandle,
                MeasureFps   = true,
                VSync        = false
            });

            font            = gfx.CreateFont("Arial", 22);
            brush           = gfx.CreateBrush(255, 0, 0, 255);
            backgroundBrush = gfx.CreateBrush(0xCC, 0xCC, 0xCC, 80);

            var timer = new FrameTimer(60);

            timer.OnFrameStart += Timer_OnFrameStart;
            timer.FPS           = 900;
            timer.Start();

            Console.WriteLine("drawing...");
            Console.ReadLine();
        }
Ejemplo n.º 2
0
        public Overlay(Process gameProcess)
        {
            process = gameProcess;

            // check the game window exists then create the overlay
            while (true)
            {
                handle = NativeMethods.FindWindow(null, "STAR WARS Battlefront II");

                if (handle != IntPtr.Zero)
                {
                    break;
                }
            }

            // check if game running. timed at 2-5ms per call so runs in own thread
            gameCheckThread = new Thread(new ParameterizedThreadStart(GameCheck));
            gameCheckThread.Start();

            // Starting the ESP before the game leaves invalid process info so we'll wait a second to let the game check thread fix that
            if (process.MainWindowHandle == IntPtr.Zero)
            {
                Thread.Sleep(1000);
            }

            // set up the remote process memory class
            RPM.OpenProcess(process.Id);

            // setup the overlay
            var rendererOptions = new Direct2DRendererOptions()
            {
                AntiAliasing = OPTIONS_AA,
                Hwnd         = IntPtr.Zero,
                MeasureFps   = OPTIONS_ShowFPS,
                VSync        = OPTIONS_VSync
            };

            OverlayManager manager = new OverlayManager(handle, rendererOptions);

            overlay    = manager.Window;
            d2d        = manager.Graphics;
            clearBrush = d2d.CreateBrush(0xF5, 0xF5, 0xF5, 0);  // our transparent colour

            // start the update thread
            updateThread = new Thread(new ParameterizedThreadStart(Update));
            updateThread.Start();
        }
Ejemplo n.º 3
0
        private static void Main(string[] args)
        {
            Console.WindowHeight = Console.LargestWindowHeight / 2;
            Console.WindowWidth  = Console.LargestWindowWidth / 2;

            OverlayCreationOptions overlayOptions = new OverlayCreationOptions()
            {
                BypassTopmost = true,
                Height        = 600,
                Width         = 600,
                WindowTitle   = HelperMethods.GenerateRandomString(5, 11),
                X             = Console.WindowLeft,
                Y             = Console.WindowTop
            };

            StickyOverlayWindow overlay = new StickyOverlayWindow(Process.GetCurrentProcess().MainWindowHandle, overlayOptions);

            overlay.OnWindowBoundsChanged += Overlay_OnWindowBoundsChanged;

            RendererOptions rendererOptions = new RendererOptions()
            {
                AntiAliasing = true,
                Hwnd         = overlay.WindowHandle,
                MeasureFps   = true,
                VSync        = false
            };

            gfx = new Direct2DRenderer(rendererOptions);

            font            = gfx.CreateFont("Arial", 22);
            brush           = gfx.CreateBrush(255, 0, 0, 255);
            backgroundBrush = gfx.CreateBrush(0xCC, 0xCC, 0xCC, 80);

            FrameTimer timer = new FrameTimer(60);

            timer.OnFrameStart += Timer_OnFrameStart;

            timer.Start();

            Console.ReadLine();

            timer.Stop();

            gfx.Dispose();
            overlay.Dispose();
        }
Ejemplo n.º 4
0
        private void DrawAABB(Frostbite.TransformAABBStruct TransformAABB, Direct2DBrush brush)
        {
            Vector3 pos = TransformAABB.Matrix.TranslationVector;

            Vector3 min = new Vector3(TransformAABB.AABB.Min.X, TransformAABB.AABB.Min.Y, TransformAABB.AABB.Min.Z);
            Vector3 max = new Vector3(TransformAABB.AABB.Max.X, TransformAABB.AABB.Max.Y, TransformAABB.AABB.Max.Z);

            Vector3 crnr2 = pos + gameManager.MultiplyMat(new Vector3(max.X, min.Y, min.Z), TransformAABB.Matrix);
            Vector3 crnr3 = pos + gameManager.MultiplyMat(new Vector3(max.X, min.Y, max.Z), TransformAABB.Matrix);
            Vector3 crnr4 = pos + gameManager.MultiplyMat(new Vector3(min.X, min.Y, max.Z), TransformAABB.Matrix);
            Vector3 crnr5 = pos + gameManager.MultiplyMat(new Vector3(min.X, max.Y, max.Z), TransformAABB.Matrix);
            Vector3 crnr6 = pos + gameManager.MultiplyMat(new Vector3(min.X, max.Y, min.Z), TransformAABB.Matrix);
            Vector3 crnr7 = pos + gameManager.MultiplyMat(new Vector3(max.X, max.Y, min.Z), TransformAABB.Matrix);

            min = pos + gameManager.MultiplyMat(min, TransformAABB.Matrix);
            max = pos + gameManager.MultiplyMat(max, TransformAABB.Matrix);

            if (!gameManager.WorldToScreen(min, out min) || !gameManager.WorldToScreen(max, out max) ||
                !gameManager.WorldToScreen(crnr2, out crnr2) || !gameManager.WorldToScreen(crnr3, out crnr3) ||
                !gameManager.WorldToScreen(crnr4, out crnr4) || !gameManager.WorldToScreen(crnr5, out crnr5) ||
                !gameManager.WorldToScreen(crnr6, out crnr6) || !gameManager.WorldToScreen(crnr7, out crnr7))
            {
                return;
            }

            d2d.DrawLine(min.X, min.Y, crnr2.X, crnr2.Y, 1, brush);
            d2d.DrawLine(min.X, min.Y, crnr4.X, crnr4.Y, 1, brush);
            d2d.DrawLine(min.X, min.Y, crnr6.X, crnr6.Y, 1, brush);

            d2d.DrawLine(max.X, max.Y, crnr5.X, crnr5.Y, 1, brush);
            d2d.DrawLine(max.X, max.Y, crnr7.X, crnr7.Y, 1, brush);
            d2d.DrawLine(max.X, max.Y, crnr3.X, crnr3.Y, 1, brush);

            d2d.DrawLine(crnr2.X, crnr2.Y, crnr7.X, crnr7.Y, 1, brush);
            d2d.DrawLine(crnr2.X, crnr2.Y, crnr3.X, crnr3.Y, 1, brush);

            d2d.DrawLine(crnr4.X, crnr4.Y, crnr5.X, crnr5.Y, 1, brush);
            d2d.DrawLine(crnr4.X, crnr4.Y, crnr3.X, crnr3.Y, 1, brush);

            d2d.DrawLine(crnr6.X, crnr6.Y, crnr5.X, crnr5.Y, 1, brush);
            d2d.DrawLine(crnr6.X, crnr6.Y, crnr7.X, crnr7.Y, 1, brush);
        }
Ejemplo n.º 5
0
        private void DrawAABB(AxisAlignedBox aabb, Vector3 m_Position, float Yaw, Direct2DBrush color)
        {
            float cosY = (float)Math.Cos(Yaw);
            float sinY = (float)Math.Sin(Yaw);

            Vector3 fld = new Vector3(aabb.Min.Z * cosY - aabb.Min.X * sinY, aabb.Min.Y, aabb.Min.X * cosY + aabb.Min.Z * sinY) + m_Position; // 0
            Vector3 brt = new Vector3(aabb.Min.Z * cosY - aabb.Max.X * sinY, aabb.Min.Y, aabb.Max.X * cosY + aabb.Min.Z * sinY) + m_Position; // 1
            Vector3 bld = new Vector3(aabb.Max.Z * cosY - aabb.Max.X * sinY, aabb.Min.Y, aabb.Max.X * cosY + aabb.Max.Z * sinY) + m_Position; // 2
            Vector3 frt = new Vector3(aabb.Max.Z * cosY - aabb.Min.X * sinY, aabb.Min.Y, aabb.Min.X * cosY + aabb.Max.Z * sinY) + m_Position; // 3
            Vector3 frd = new Vector3(aabb.Max.Z * cosY - aabb.Min.X * sinY, aabb.Max.Y, aabb.Min.X * cosY + aabb.Max.Z * sinY) + m_Position; // 4
            Vector3 brb = new Vector3(aabb.Min.Z * cosY - aabb.Min.X * sinY, aabb.Max.Y, aabb.Min.X * cosY + aabb.Min.Z * sinY) + m_Position; // 5
            Vector3 blt = new Vector3(aabb.Min.Z * cosY - aabb.Max.X * sinY, aabb.Max.Y, aabb.Max.X * cosY + aabb.Min.Z * sinY) + m_Position; // 6
            Vector3 flt = new Vector3(aabb.Max.Z * cosY - aabb.Max.X * sinY, aabb.Max.Y, aabb.Max.X * cosY + aabb.Max.Z * sinY) + m_Position; // 7

            #region WorldToScreen
            if (!WorldToScreen(fld, out fld) || !WorldToScreen(brt, out brt) ||
                !WorldToScreen(bld, out bld) || !WorldToScreen(frt, out frt) ||
                !WorldToScreen(frd, out frd) || !WorldToScreen(brb, out brb) ||
                !WorldToScreen(blt, out blt) || !WorldToScreen(flt, out flt))
            {
                return;
            }
            #endregion

            #region DrawLines
            d2d.DrawLine(fld.X, fld.Y, brt.X, brt.Y, 1, color);
            d2d.DrawLine(brb.X, brb.Y, blt.X, blt.Y, 1, color);
            d2d.DrawLine(fld.X, fld.Y, brb.X, brb.Y, 1, color);
            d2d.DrawLine(brt.X, brt.Y, blt.X, blt.Y, 1, color);

            d2d.DrawLine(frt.X, frt.Y, bld.X, bld.Y, 1, color);
            d2d.DrawLine(frd.X, frd.Y, flt.X, flt.Y, 1, color);
            d2d.DrawLine(frt.X, frt.Y, frd.X, frd.Y, 1, color);
            d2d.DrawLine(bld.X, bld.Y, flt.X, flt.Y, 1, color);

            d2d.DrawLine(frt.X, frt.Y, fld.X, fld.Y, 1, color);
            d2d.DrawLine(frd.X, frd.Y, brb.X, brb.Y, 1, color);
            d2d.DrawLine(brt.X, brt.Y, bld.X, bld.Y, 1, color);
            d2d.DrawLine(blt.X, blt.Y, flt.X, flt.Y, 1, color);
            #endregion
        }
Ejemplo n.º 6
0
        private void DrawAABB(AxisAlignedBox aabb, Matrix tranform, Direct2DBrush color)
        {
            Vector3 m_Position = new Vector3(tranform.M41, tranform.M42, tranform.M43);
            Vector3 fld        = Multiply(new Vector3(aabb.Min.X, aabb.Min.Y, aabb.Min.Z), tranform) + m_Position;
            Vector3 brt        = Multiply(new Vector3(aabb.Max.X, aabb.Max.Y, aabb.Max.Z), tranform) + m_Position;
            Vector3 bld        = Multiply(new Vector3(aabb.Min.X, aabb.Min.Y, aabb.Max.Z), tranform) + m_Position;
            Vector3 frt        = Multiply(new Vector3(aabb.Max.X, aabb.Max.Y, aabb.Min.Z), tranform) + m_Position;
            Vector3 frd        = Multiply(new Vector3(aabb.Max.X, aabb.Min.Y, aabb.Min.Z), tranform) + m_Position;
            Vector3 brb        = Multiply(new Vector3(aabb.Max.X, aabb.Min.Y, aabb.Max.Z), tranform) + m_Position;
            Vector3 blt        = Multiply(new Vector3(aabb.Min.X, aabb.Max.Y, aabb.Max.Z), tranform) + m_Position;
            Vector3 flt        = Multiply(new Vector3(aabb.Min.X, aabb.Max.Y, aabb.Min.Z), tranform) + m_Position;

            #region WorldToScreen
            if (!WorldToScreen(fld, out fld) || !WorldToScreen(brt, out brt) ||
                !WorldToScreen(bld, out bld) || !WorldToScreen(frt, out frt) ||
                !WorldToScreen(frd, out frd) || !WorldToScreen(brb, out brb) ||
                !WorldToScreen(blt, out blt) || !WorldToScreen(flt, out flt))
            {
                return;
            }
            #endregion

            #region DrawLines
            d2d.DrawLine(fld.X, fld.Y, flt.X, flt.Y, 1, color);
            d2d.DrawLine(flt.X, flt.Y, frt.X, frt.Y, 1, color);
            d2d.DrawLine(frt.X, frt.Y, frd.X, frd.Y, 1, color);
            d2d.DrawLine(frd.X, frd.Y, fld.X, fld.Y, 1, color);
            d2d.DrawLine(bld.X, bld.Y, blt.X, blt.Y, 1, color);
            d2d.DrawLine(blt.X, blt.Y, brt.X, brt.Y, 1, color);
            d2d.DrawLine(brt.X, brt.Y, brb.X, brb.Y, 1, color);
            d2d.DrawLine(brb.X, brb.Y, bld.X, bld.Y, 1, color);
            d2d.DrawLine(fld.X, fld.Y, bld.X, bld.Y, 1, color);
            d2d.DrawLine(frd.X, frd.Y, brb.X, brb.Y, 1, color);
            d2d.DrawLine(flt.X, flt.Y, blt.X, blt.Y, 1, color);
            d2d.DrawLine(frt.X, frt.Y, brt.X, brt.Y, 1, color);
            #endregion
        }
Ejemplo n.º 7
0
        // Init
        public Overlay(Process process)
        {
            this.process = process;

            // check the game window exists then create the overlay
            while (true)
            {
                handle = NativeMethods.FindWindow(null, "Battlefield 4");

                if (handle != IntPtr.Zero)
                {
                    break;
                }
            }

            gameCheckThread = new Thread(new ParameterizedThreadStart(GameCheck));
            gameCheckThread.Start();
            if (process.MainWindowHandle == IntPtr.Zero)
            {
                Thread.Sleep(1000);
            }

            RPM.OpenProcess(process.Id);

            // setup the overlay
            var rendererOptions = new Direct2DRendererOptions()
            {
                AntiAliasing = OPTIONS_AA,
                Hwnd         = IntPtr.Zero,
                MeasureFps   = OPTIONS_ShowFPS,
                VSync        = OPTIONS_VSync
            };

            OverlayManager manager = new OverlayManager(handle, rendererOptions);

            overlay    = manager.Window;
            d2d        = manager.Graphics;
            clearBrush = d2d.CreateBrush(0xF5, 0xF5, 0xF5, 0);  // our transparent colour



            // Init player array
            localPlayer = new GPlayer();
            //localPlayer.CurrentWeapon = new Weapon();
            localWeapons  = new List <Gun>();
            players       = new List <GPlayer>();
            targetEnimies = new List <GPlayer>();

            // Init update thread
            updateStream = new Thread(new ParameterizedThreadStart(Update));
            updateStream.Start();


            ScreenCapture sc = new ScreenCapture();

            sc.CaptureWindowToFile(process.MainWindowHandle, @"C:\PZ_BF4_FAIRFIGHT_GAME_SS.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);



            // Init Key Listener
            KeyAssign();
        }