Example #1
0
        private static void Dump(Metadata metadata, Il2Cpp il2Cpp)
        {
            Console.WriteLine("Dumping...");
            var writer     = new StreamWriter(new FileStream("dump.cs", FileMode.Create), new UTF8Encoding(false));
            var decompiler = new Il2CppDecompiler(metadata, il2Cpp);

            decompiler.Decompile(writer, config);
            Console.WriteLine("Done!");
            Console.WriteLine("Generate script...");
            var scriptwriter    = new StreamWriter(new FileStream("script.py", FileMode.Create), new UTF8Encoding(false));
            var scriptGenerator = new ScriptGenerator(decompiler);

            scriptGenerator.WriteScript(scriptwriter, config);
            Console.WriteLine("Done!");
            if (config.DummyDll)
            {
                Console.WriteLine("Generate dummy dll...");
                if (Directory.Exists("DummyDll"))
                {
                    Directory.Delete("DummyDll", true);
                }
                Directory.CreateDirectory("DummyDll");
                Directory.SetCurrentDirectory("DummyDll");
                var dummy = new DummyAssemblyGenerator(metadata, il2Cpp);
                foreach (var assembly in dummy.Assemblies)
                {
                    using (var stream = new MemoryStream())
                    {
                        assembly.Write(stream);
                        File.WriteAllBytes(assembly.MainModule.Name, stream.ToArray());
                    }
                }
                Console.WriteLine("Done!");
            }
        }
Example #2
0
        public static bool PerformDump(string gameAssemblyPath, string metadataDatPath, string outputDirectoryPath,
                                       Config config, Action <string> reportProgressAction)
        {
            Init(gameAssemblyPath, metadataDatPath, config, reportProgressAction, out var metadata, out var il2Cpp);

            reportProgressAction("Dumping...");
            var executor   = new Il2CppExecutor(metadata, il2Cpp);
            var decompiler = new Il2CppDecompiler(executor);

            reportProgressAction("Done!");
            if (config.GenerateScript)
            {
                decompiler.Decompile(config, outputDirectoryPath, reportProgressAction);
                reportProgressAction("Generate script...");
                var scriptGenerator = new ScriptGenerator(executor);
                scriptGenerator.WriteScript(outputDirectoryPath);
                reportProgressAction("Done!");
            }
            if (config.GenerateDummyDll)
            {
                reportProgressAction("Generate dummy dll...");
                DummyAssemblyExporter.Export(executor, outputDirectoryPath);
                reportProgressAction("Done!");
            }

            return(true);
        }
Example #3
0
        private static void Dump(Metadata metadata, Il2Cpp il2Cpp)
        {
            Console.WriteLine("Dumping...");
            var writer     = new StreamWriter(new FileStream("dump.cs", FileMode.Create), new UTF8Encoding(false));
            var decompiler = new Il2CppDecompiler(metadata, il2Cpp);

            decompiler.Decompile(writer, config);
            Console.WriteLine("Done!");
            Console.WriteLine("Generate script...");
            var scriptwriter    = new StreamWriter(new FileStream("script.py", FileMode.Create), new UTF8Encoding(false));
            var scriptGenerator = new ScriptGenerator(metadata, il2Cpp);

            scriptGenerator.WriteScript(scriptwriter, config);
            Console.WriteLine("Done!");
            if (config.DummyDll)
            {
                Console.WriteLine("Generate dummy dll...");
                Console.WriteLine("Select style: 1.Original 2.Original+NET_SDK");
                string netSDKPath = "";
                switch (int.Parse(Console.ReadKey(true).KeyChar.ToString()))
                {
                case 2:
                    Console.WriteLine("Enter path to NET_SDK.dll: ");
                    netSDKPath = Console.ReadLine().Trim();
                    break;
                }
                if (Directory.Exists("DummyDll"))
                {
                    Directory.Delete("DummyDll", true);
                }
                Directory.CreateDirectory("DummyDll");
                Directory.SetCurrentDirectory("DummyDll");
                var dummy = new DummyAssemblyGenerator(metadata, il2Cpp, netSDKPath);
                foreach (var assembly in dummy.Assemblies)
                {
                    using (var stream = new MemoryStream())
                    {
                        assembly.Write(stream);
                        File.WriteAllBytes(assembly.MainModule.Name, stream.ToArray());
                    }
                }
                Console.WriteLine("Done!");
            }
        }
Example #4
0
        private static void Dump(Metadata metadata, Il2Cpp il2Cpp)
        {
            Console.WriteLine("Dumping...");
            var decompiler = new Il2CppDecompiler(metadata, il2Cpp);

            decompiler.Decompile(config);
            Console.WriteLine("Done!");
            Console.WriteLine("Generate script...");
            var scriptGenerator = new ScriptGenerator(metadata, il2Cpp);

            scriptGenerator.WriteScript(config);
            Console.WriteLine("Done!");
            if (config.DummyDll)
            {
                Console.WriteLine("Generate dummy dll...");
                DummyAssemblyExporter.Export(metadata, il2Cpp);
                Console.WriteLine("Done!");
            }
        }
Example #5
0
        private static void Dump(Metadata metadata, Il2Cpp il2Cpp, string outputDir)
        {
            Console.WriteLine("Dumping...");
            var executor   = new Il2CppExecutor(metadata, il2Cpp);
            var decompiler = new Il2CppDecompiler(executor);

            decompiler.Decompile(config, outputDir);
            Console.WriteLine("Done!");
            if (true)
            {
                Console.WriteLine("Generate script...");
                var scriptGenerator = new ScriptGenerator(executor);
                scriptGenerator.WriteScript(outputDir);
                Console.WriteLine("Done!");
            }
            if (config.GenerateDummyDll)
            {
                Console.WriteLine("Generate dummy dll...");
                DummyAssemblyExporter.Export(executor, outputDir);
                Console.WriteLine("Done!");
            }
        }
Example #6
0
        private void Dump(Metadata metadata, Il2Cpp il2Cpp, string outputDir)
        {
            WriteLine("Dumping...");
            var executor   = new Il2CppExecutor(metadata, il2Cpp);
            var decompiler = new Il2CppDecompiler(executor);

            decompiler.Decompile(config, outputDir);
            WriteLine("Done!");
            if (config.GenerateScript)
            {
                WriteLine("Generate script...");
                var scriptGenerator = new ScriptGenerator(executor);
                scriptGenerator.WriteScript(outputDir);
                WriteLine("Done!");
            }
            if (config.GenerateDummyDll)
            {
                WriteLine("Generate dummy dll...");
                DummyAssemblyExporter.Export(executor, outputDir);
                WriteLine("Done!");
                Directory.SetCurrentDirectory(RealPath); //Fix read-only directory permission
            }
            WriteLine("");
        }