static void Main(string[] args)
        {
            DX9Overlay.SetParam("process", "GFXTest32.exe"); // Set the process name

            DX9Overlay.DestroyAllVisual();

            overlayText = DX9Overlay.TextCreateUnicode("Arial", 12, false, false, 200, 200, 0xFF00FFFF, "Hello world!\n€ÖÜŒœЄϿ", true, true); // Initialize 'overlayText'
            overlayBox  = DX9Overlay.BoxCreate(200, 200, 100, 100, 0x50FF00FF, true);                                                         // Initialize 'overlayBox'
            overlayLine = DX9Overlay.LineCreate(0, 0, 300, 300, 5, 0xFFFFFFFF, true);                                                         // Initialize 'overlayLine'

            if (overlayText == -1 || overlayBox == -1 || overlayLine == -1)
            {
                Console.WriteLine("A error is occurred at the intializing.");
                Console.WriteLine("Press any key to close the application!");

                Console.ReadKey();
                return;
            }
            Console.WriteLine("Enter 'exit' to close the application!");
            string input = Console.ReadLine(); // Get the input

            while (input != "exit")
            {
                DX9Overlay.TextSetString(overlayText, input); // Set 'overlayText' string to the value of 'input'
                input = Console.ReadLine();
            }

            DX9Overlay.TextDestroy(overlayText); // Destroy text if the input is 'exit'
            DX9Overlay.BoxDestroy(overlayBox);   // Destroy box if the input is 'exit'
            DX9Overlay.LineDestroy(overlayLine); // Destroy line if the input is 'exit'
        }
示例#2
0
        //IntPtr handle =
        static void Main(string[] args)
        {
            BotLoader.AddSearchPath("../../../UltraBot/Bots/");
            var KenBot = BotLoader.LoadBotFromFile("KenBot");

            KenBot.Init(0);
            Util.Init();
            DX9Overlay.SetParam("process", "SSFIV.exe");
            DX9Overlay.DestroyAllVisual();
            TextLabel roundTimer = new TextLabel("Consolas", 10, TypeFace.NONE, new Point(390, 0), Color.White, "", true, true);
            TextLabel player1    = new TextLabel("Consolas", 10, TypeFace.NONE, new Point(90, 0), Color.White, "", true, true);
            TextLabel player2    = new TextLabel("Consolas", 10, TypeFace.NONE, new Point(480, 0), Color.White, "", true, true);

            //Stopwatch sw = new Stopwatch();


            // Do something you want to time


            var ms = MatchState.getInstance();
            var f1 = FighterState.getFighter(0);
            var f2 = FighterState.getFighter(1);

            KenBot.Init(0);

            while (true)
            {
                ms.Update();
                roundTimer.Text = String.Format("Frame:{0}", ms.FrameCounter);
                UpdateOverlay(player1, f1);
                UpdateOverlay(player2, f2);
                KenBot.Run();
            }
        }
示例#3
0
        static void Main(string[] args)
        {
            DX9Overlay.SetParam("use_window", "1");                                                                          // Use the window name to find the process
            DX9Overlay.SetParam("window", "GTA:SA:MP");                                                                      // Set the window name

            overlayText = DX9Overlay.TextCreate("Arial", 12, false, false, 200, 200, 0xFF00FFFF, "Hello world", true, true); // Initialize 'overlayText'
            if (overlayText == -1)
            {
                Console.WriteLine("A error is occurred at the intializing.");
                Console.WriteLine("Press any key to close the application!");

                Console.ReadKey();
                return;
            }
            Console.WriteLine("Enter 'exit' to close the application!");
            string input = Console.ReadLine(); // Get the input

            while (input != "exit")
            {
                DX9Overlay.TextSetString(overlayText, input); // Set 'overlayText' string to the value of 'input'
                input = Console.ReadLine();
            }

            DX9Overlay.TextDestroy(overlayText); // Destroy text if the input is 'exit'
        }
示例#4
0
 private void OverlayEnabled_Checked(object sender, RoutedEventArgs e)
 {
     if (OverlayEnabled.IsChecked.Value)
     {
         StatusLabel.Content = "Enabling Overlay...";
         DX9Overlay.SetParam("process", "SSFIV.exe");
         DX9Overlay.DestroyAllVisual();
         roundTimer = new TextLabel("Consolas", 10, TypeFace.NONE, new System.Drawing.Point(4, 700), Color.White, "", true, true);
         player1    = new TextLabel("Consolas", 10, TypeFace.NONE, new System.Drawing.Point(5, 0), Color.White, "", true, true);
         player2    = new TextLabel("Consolas", 10, TypeFace.NONE, new System.Drawing.Point(460, 0), Color.White, "", true, true);
         restartWorker();
     }
     else
     {
         StatusLabel.Content = "Disabling Overlay...";
         DX9Overlay.DestroyAllVisual();
         restartWorker();
     }
 }
示例#5
0
        static void Main(string[] args)
        {
            //DX9Overlay.SetParam("use_window", "1"); // Use the window name to find the process
            //DX9Overlay.SetParam("window", "GTA:SA:MP"); // Set the window name
            //DX9Overlay.SetParam("process", "CastlevaniaLoSUE.exe");

            if (args.Length < 1)
            {
                return;
            }

            var proc = args[0];

            DX9Overlay.SetParam("process", proc);
            DX9Overlay.DestroyAllVisual();

            overlayText = DX9Overlay.TextCreate("Consolas", 12, false, false, 10, 14, 0xFF00FFFF, "DualShock 3 #1 (USB, Battery: 80%)", true, true); // Initialize 'overlayText'
            if (overlayText == -1)
            {
                Console.WriteLine("A error is occurred at the intializing.");
                Console.WriteLine("Press any key to close the application!");

                Console.ReadKey();
                return;
            }

            DX9Overlay.ImageCreate(@"D:\Temp\battery_discharging_080.png", 165, 5, 0.7f, 0.7f, 90, 1, true);

            //DX9Overlay.BoxCreate(10, 50, 100, 100, 0x15FF0000, true);

            Console.WriteLine("Enter 'exit' to close the application!");
            string input = Console.ReadLine(); // Get the input

            while (input != "exit")
            {
                Console.WriteLine("FPS = {0}", DX9Overlay.GetFrameRate());
                DX9Overlay.TextSetString(overlayText, input); // Set 'overlayText' string to the value of 'input'
                input = Console.ReadLine();
            }

            DX9Overlay.DestroyAllVisual();
        }
示例#6
0
        /// <summary>
        /// Your own user code starts here.
        /// If this is your first time, do consider reading the notice above.
        /// It contains some very useful information.
        /// </summary>
        public static async void Init()
        {
            /*
             *  Reloaded Mod Loader Sample: DX9 Internal Overlay Example
             *  Architectures supported: X86
             *
             *  Demonstrates an example of drawing with Reloaded's DirectX 9 hooking mechanism,
             *  the API that's used by a large majority of the games out there at the time of writing.
             *
             *  Note: Debugging this might prove troublesome for this entry function, with async methods,
             *  local variable values are not exactly known to show in all configurations.
             *
             *  The following sample has been tested with Sonic Adventure 2 and Sonic Heroes (under Crosire's D3D8To9)
             *  as well as Tales of Berseria (X64 & Denuvo).
             */

            /*
             *  AnimInterpolator: A tool for generating intermediate LCH colours between two targets.
             *  ColorspaceConverter: Converts between System.Drawing.Color and LCH in batch.
             *
             *  Both of these have been shamelessly and lazily stolen from Reloaded's
             *  Reloaded-GUI project for the Launcher WinForms GUI, please do not heed them any mind.
             */

            // Calculate triangle render colours (for animation).
            // This isn't pretty, just a reuse of code from Reloaded-GUI.
            AnimInterpolator interpolator = new AnimInterpolator(1000, 60);

            Lch redColor   = ColorspaceConverter.ColorToLch(System.Drawing.Color.Red);
            Lch blueColor  = ColorspaceConverter.ColorToLch(System.Drawing.Color.Blue);
            Lch greenColor = ColorspaceConverter.ColorToLch(System.Drawing.Color.Green);

            List <Lch> redToGreenColour  = interpolator.CalculateIntermediateColours(redColor, greenColor);
            List <Lch> greenToBlueColour = interpolator.CalculateIntermediateColours(greenColor, blueColor);
            List <Lch> blueToRedColour   = interpolator.CalculateIntermediateColours(blueColor, redColor);

            _redToGreenColours  = new List <Color>();
            _greenToBlueColours = new List <Color>();
            _blueToRedColours   = new List <Color>();

            // Convert our Lch colours to SharpDX ones.
            foreach (var colour in redToGreenColour)
            {
                System.Drawing.Color colorRGB = ColorspaceConverter.LchToColor(colour);
                _redToGreenColours.Add(new SharpDX.Color(colorRGB.R, colorRGB.G, colorRGB.B));
            }

            foreach (var colour in greenToBlueColour)
            {
                System.Drawing.Color colorRGB = ColorspaceConverter.LchToColor(colour);
                _greenToBlueColours.Add(new SharpDX.Color(colorRGB.R, colorRGB.G, colorRGB.B));
            }

            foreach (var colour in blueToRedColour)
            {
                System.Drawing.Color colorRGB = ColorspaceConverter.LchToColor(colour);
                _blueToRedColours.Add(new SharpDX.Color(colorRGB.R, colorRGB.G, colorRGB.B));
            }

            /*
             *  This one's going to be embarrasingly short, sit tight.
             *  Make sure to add using SharpDX.Direct3D9; to the top of your file.
             *
             *  RenderDelegate: EndScene hook, this is where you will render stuff to the screen.
             *  ResetDelegate: Reset hook, this is called when the resolution of the window changes, or a switch from fullscreen to window is performed.
             *  HookDelay: Some games require this due to bad programming *cough* Sonic Adventure 2 *cough*.
             */

            _directX9Overlay = await DX9Overlay.CreateDirectXOverlay(RenderDelegate, ResetDelegate, 0);

            _directX9Overlay.EndSceneHook?.Activate();
            _directX9Overlay.ResetHook?.Activate();
            _directX9Overlay.EndSceneHook64?.Activate();
            _directX9Overlay.ResetHook64?.Activate();

            /*
             *  Warning: Amateur DirectX 9 Rendering Code.
             *  I've only provided the hooks, at the time of writing this, I was not familliar with DirectX
             *  nor SharpDX myself, below is (was) a basic example of rendering some text, a line and a basic arbitrary shape.
             *
             *  Protip: If looking for a SharpDX function, search the SharpDX repository with the C++ function.
             *  I would also highly advise looking at SharpDX examples https://github.com/sharpdx/SharpDX-Samples/tree/master/Desktop/Direct3D9
             */
        }
示例#7
0
 private void Window_Closing(object sender, CancelEventArgs e)
 {
     //Remove overlay from the game
     DX9Overlay.DestroyAllVisual();
 }