예제 #1
0
        private static void Main(string[] args)
        {
            Console.WriteLine("TOD1RSCE sceWork v0.9 - Cross-Platform");
            string exeDir = Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);

            exeDir = new Uri(exeDir).LocalPath;

            if (File.Exists(Path.Combine(exeDir, "jpcodes.txt")))
            {
                jpcodes = new tableModule(Path.Combine(exeDir, "jpcodes.txt"));
            }
            if (File.Exists(Path.Combine(exeDir, "codes.txt")))
            {
                codes = new tableModule(Path.Combine(exeDir, "codes.txt"), true);
            }

            if (args.Length == 0)
            {
                Console.WriteLine("Generously donated by Temple of Tales Translations team");
                Console.WriteLine("http://temple-tales.ru/translations.html\n");
                Console.WriteLine("Usage:");
                Console.WriteLine("    extract: .exe -e *.tod1rsce");
                Console.WriteLine("    extract: .exe -e *.tod1rsce4");
                Console.WriteLine("    extract: .exe -e *.rsce");
                Console.WriteLine("    extract: .exe -e <dir>");
                Console.WriteLine("    repack : .exe -r *.tod1rsce");
                Console.WriteLine("    repack : .exe -r *.tod1rsce4");
                Console.WriteLine("    repack : .exe -r *.rsce");
                Console.WriteLine("    repack : .exe -r <dir>");
                Console.WriteLine("Add params:");
                Console.WriteLine("    -i : Specify a diferent input file");
                Console.WriteLine("    -v : Verbose failed string output");
                Console.WriteLine("    -as <count> : Add <count> bytes to start file");
                Console.WriteLine("    -ae : Seek file to 16 bytes");
                Console.WriteLine("    -sjis : Use CP-932 (SHIFT-JIS) encoding");
                Console.WriteLine("    -dedup : deduplicate strings on insertion");
                Console.WriteLine("    -count : Dump byte count (debug)");
                Console.WriteLine("    -raw : Dump/insert raw bytes ignoring JPCODES and CODES");
                //Console.ReadKey();
                Environment.Exit(0);
            }

            ParseArgs(args);
            string str = args[0];

            //Do extraction
            if (str == "-e")
            {
                if (Path.GetExtension(args[1]) == ".rsce" || Path.GetExtension(args[1]) == ".tod1rsce" || Path.GetExtension(args[1]) == ".tod1rsce4")
                {
                    if (jpcodes == null)
                    {
                        MiscUtils.Warn("No JPCODES.txt file! Dumping raw bytes...");
                    }

                    Extract(args[1]);
                }
                else if (Directory.Exists(args[1]))
                {
                    foreach (string fileName in ((IEnumerable <string>)Directory.GetFiles(args[1], "*.*", SearchOption.AllDirectories)).Where <string>((Func <string, bool>)(s => s.EndsWith(".rsce") || s.EndsWith(".tod1rsce") || s.EndsWith(".tod1rsce4"))).ToArray <string>())
                    {
                        Extract(fileName);
                    }
                }
            }

            //Do insertion
            if (str == "-r")
            {
                if (Path.GetExtension(args[1]) == ".rsce" || Path.GetExtension(args[1]) == ".tod1rsce" || Path.GetExtension(args[1]) == ".tod1rsce4")
                {
                    if (jpcodes == null)
                    {
                        MiscUtils.Warn("No JPCODES.txt file! Assuming dump is raw...");
                    }

                    Repack(args[1]);
                    AddBytes(args[1], args);
                }
                else if (Directory.Exists(args[1]))
                {
                    string[] array = ((IEnumerable <string>)Directory.GetFiles(args[1], "*.*", SearchOption.AllDirectories)).Where <string>((Func <string, bool>)(s => s.EndsWith(".rsce") || s.EndsWith(".tod1rsce") || s.EndsWith(".tod1rsce4"))).ToArray <string>();
                    for (int index = 0; index < array.Length; ++index)
                    {
                        Repack(array[index]);
                        AddBytes(array[index], args);
                    }
                }
            }
            Console.WriteLine("Complete!");
            //Console.ReadKey();
        }
예제 #2
0
 private static void Main(string[] args)
 {
     if (File.Exists("jpcodes.txt"))
     {
         Program.jpcodes = new tableModule("jpcodes.txt");
     }
     if (File.Exists("codes.txt"))
     {
         Program.codes = new tableModule("codes.txt");
     }
     if (args.Length != 0)
     {
         ParseArgs(args);
         string str = args[0];
         if (!(str == "-e"))
         {
             if (str == "-r")
             {
                 if (Path.GetExtension(args[1]) == ".rsce" || Path.GetExtension(args[1]) == ".tod1rsce" || Path.GetExtension(args[1]) == ".tod1rsce4")
                 {
                     Program.Repack(args[1]);
                     Program.AddBytes(args[1], args);
                 }
                 else if (Directory.Exists(args[1]))
                 {
                     string[] array = ((IEnumerable <string>)Directory.GetFiles(args[1], "*.*", SearchOption.AllDirectories)).Where <string>((Func <string, bool>)(s => s.EndsWith(".rsce") || s.EndsWith(".tod1rsce") || s.EndsWith(".tod1rsce4"))).ToArray <string>();
                     for (int index = 0; index < array.Length; ++index)
                     {
                         Program.Repack(array[index]);
                         Program.AddBytes(array[index], args);
                     }
                 }
             }
         }
         else if (Path.GetExtension(args[1]) == ".rsce" || Path.GetExtension(args[1]) == ".tod1rsce" || Path.GetExtension(args[1]) == ".tod1rsce4")
         {
             Program.Extract(args[1]);
         }
         else if (Directory.Exists(args[1]))
         {
             foreach (string fileName in ((IEnumerable <string>)Directory.GetFiles(args[1], "*.*", SearchOption.AllDirectories)).Where <string>((Func <string, bool>)(s => s.EndsWith(".rsce") || s.EndsWith(".tod1rsce") || s.EndsWith(".tod1rsce4"))).ToArray <string>())
             {
                 Program.Extract(fileName);
             }
         }
         Console.WriteLine("Complete!");
         //Console.ReadKey();
     }
     else
     {
         Console.WriteLine("TOD1RSCE Module Clone v0.3");
         Console.WriteLine("Decompiled by Peter Nguyen");
         Console.WriteLine("I have no idea what I am doing.\n");
         Console.WriteLine("Usage:");
         Console.WriteLine("    extract : .exe -e *.tod1rsce");
         Console.WriteLine("    extract : .exe -e *.tod1rsce4");
         Console.WriteLine("    extract : .exe -e *.rsce");
         Console.WriteLine("    extract : .exe -e <dir>");
         Console.WriteLine("    repack  : .exe -r *.tod1rsce");
         Console.WriteLine("    repack  : .exe -r *.tod1rsce4");
         Console.WriteLine("    repack  : .exe -r *.rsce");
         Console.WriteLine("    repack  : .exe -r <dir>");
         Console.WriteLine("Add params:");
         Console.WriteLine("    -as <count> : Add <count> bytes to start file");
         Console.WriteLine("    -ae : Seek file to 16 bytes");
         Console.WriteLine("    -sjis : Use CP-932 (SHIFT-JIS) encoding");
         Console.WriteLine("    -count : Dump byte count");
         Console.WriteLine("    -raw : Dump/insert raw bytes ignoring JPCODES and CODES");
         Console.ReadKey();
     }
 }