Esempio n. 1
0
        public void Generate()
        {
            if (!Directory.Exists(directoryBox.Text))
                Directory.CreateDirectory(directoryBox.Text);

            var methods = new List<MethodBase>();
            foreach (var node in methodsBox.Nodes)
                ProcessNode(node as TreeNode, methods);

            var injector = new Injector("debugger.exe");
            if (!injector.GenerateTemplates(methods, directoryBox.Text))
                MessageBox.Show(injector.Errors);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            var left = new Vector4 { X = 1, Y = 2, Z = 3, W = 4 };
            var right = new Vector4 { X = 5, Y = 6, Z = 7, W = 8 };

            float result1;
            Vector4.DotProduct(ref left, ref right, out result1);

            var injector = new Injector("../../../Debugger/x64/Release/debugger.exe");
            injector.ProcessAssemblies(typeof(Program).Assembly);

            Console.WriteLine(injector.Errors);

            float result2;
            Vector4.DotProduct(ref left, ref right, out result2);

            Console.WriteLine("{0} == {1}", result1, result2);
            Console.ReadLine();
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            float result = 0.0f;
            var injector = new Injector("debugger.exe");

            var watch = Stopwatch.StartNew();
            for (int i = 0; i < 100000; i++)
                result += Vector4.Dot(new Vector4(1.0f, 2.0f, 3.0f, 4.0f), new Vector4(5.0f, 6.0f, 7.0f, 8.0f));
            watch.Stop();
            Console.WriteLine("normal: " + watch.ElapsedTicks);

            var method = new MethodReplacement(typeof(Vector4).GetMethod("Dot"), Platform.X64, InstructionSets.SSE41, new[] { File.ReadAllBytes("dot_movups.bin") });
            injector.Replace(new[] { method });

            watch = Stopwatch.StartNew();
            for (int i = 0; i < 100000; i++)
                result += Vector4.Dot(new Vector4(1.0f, 2.0f, 3.0f, 4.0f), new Vector4(5.0f, 6.0f, 7.0f, 8.0f));
            watch.Stop();
            Console.WriteLine("movups: " + watch.ElapsedTicks);

            method = new MethodReplacement(typeof(Vector4).GetMethod("Dot"), Platform.X64, InstructionSets.SSE41, new[] { File.ReadAllBytes("dot_lddqu.bin") });
            injector.Replace(new[] { method });

            watch = Stopwatch.StartNew();
            for (int i = 0; i < 100000; i++)
                result += Vector4.Dot(new Vector4(1.0f, 2.0f, 3.0f, 4.0f), new Vector4(5.0f, 6.0f, 7.0f, 8.0f));
            watch.Stop();
            Console.WriteLine("lddqu: " + watch.ElapsedTicks);

            method = new MethodReplacement(typeof(Vector4).GetMethod("Dot"), Platform.X64, InstructionSets.SSE41, new[] { File.ReadAllBytes("dot_movaps.bin") });
            injector.Replace(new[] { method });

            watch = Stopwatch.StartNew();
            for (int i = 0; i < 100000; i++)
                result += Vector4.Dot(new Vector4(1.0f, 2.0f, 3.0f, 4.0f), new Vector4(5.0f, 6.0f, 7.0f, 8.0f));
            watch.Stop();
            Console.WriteLine("movaps: " + watch.ElapsedTicks);
        }