Esempio n. 1
0
        public static void ConvertA3D(string path, string acpath, a3ds a3db, divamodgen divamods = null)
        {
            maxWorker = Environment.ProcessorCount - 2;

            foreach (string file in Directory.EnumerateFiles("a3d\\", "*.a3da", SearchOption.AllDirectories))
            {
                while (currentWorker > maxWorker)
                {
                    Thread.Sleep(33);
                }
                new Thread(() =>
                {
                    string ext      = Path.GetExtension(file);
                    string filepath = file.Replace(ext, "");

                    KKtMain.Format Format = KKtMain.Format.FT;
                    KKtA3DA A             = new KKtA3DA();
                    A.A3DAReader(filepath);
                    bool MP = false;

                    if (!MP || Format > KKtMain.Format.NULL)
                    {
                        A.IO = KKtLib.IO.OpenWriter(filepath + ".a3da", true);
                    }
                    if (Format > KKtMain.Format.NULL)
                    {
                        if (A.Data.Header.Format < KKtMain.Format.F2LE)
                        {
                            A.Data._.CompressF16 = Format == KKtMain.Format.MGF ? 2 : 1;
                        }
                        A.Data.Header.Format = Format;
                    }
                    if (!MP && A.Data.Header.Format > KKtMain.Format.DT && A.Data.Header.Format != KKtMain.Format.FT)
                    {
                        A.A3DCWriter(filepath);
                    }
                    else if (!MP || Format > KKtMain.Format.NULL)
                    {
                        A.A3DC = false;
                        A.A3DAWriter(filepath);
                    }
                    else
                    {
                        A.MsgPackWriter(filepath);
                    }
                    Interlocked.Decrement(ref currentWorker);
                }).Start();
                Interlocked.Increment(ref currentWorker);
            }

            while (currentWorker != 0)
            {
                Thread.Sleep(33);
            }
        }
Esempio n. 2
0
        public static void Processor()
        {
            Console.Title = "PD_Tool: Converter Tools: A3DA Converter";
            KKtMain.Choose(1, "a3da", out string[] FileNames);

            bool MP = true;

            foreach (string file in FileNames)
            {
                if (file.EndsWith(".mp"))
                {
                    MP = false;
                    break;
                }
            }

            KKtMain.Format Format = KKtMain.Format.NULL;
            Console.Clear();
            KKtMain.ConsoleDesign(true);
            KKtMain.ConsoleDesign(" Choose type of format to export for MP files:");
            KKtMain.ConsoleDesign(false);
            KKtMain.ConsoleDesign("1. DT   PS3");
            KKtMain.ConsoleDesign("2. F    PS3/PSV");
            KKtMain.ConsoleDesign("3. FT   PS4");
            KKtMain.ConsoleDesign("4. F2nd PS3/PSV");
            KKtMain.ConsoleDesign("5. X    PS4/PSV");
            KKtMain.ConsoleDesign("6. MGF      PSV");
            if (MP)
            {
                KKtMain.ConsoleDesign("9. MessagePack");
            }
            KKtMain.ConsoleDesign(false);
            KKtMain.ConsoleDesign(true);
            Console.WriteLine();
            string a = Console.ReadLine();

            if (a == "1")
            {
                Format = KKtMain.Format.DT;
            }
            else if (a == "2")
            {
                Format = KKtMain.Format.F;
            }
            else if (a == "3")
            {
                Format = KKtMain.Format.FT;
            }
            else if (a == "4")
            {
                Format = KKtMain.Format.F2LE;
            }
            else if (a == "5")
            {
                Format = KKtMain.Format.X;
            }
            else if (a == "6")
            {
                Format = KKtMain.Format.MGF;
            }

            foreach (string file in FileNames)
            {
                try
                {
                    string ext      = Path.GetExtension(file);
                    string filepath = file.Replace(ext, "");
                    Console.Title = "PD_Tool: Converter Tools: A3DA Tools: " +
                                    Path.GetFileNameWithoutExtension(file);
                    KKtA3DA A = new KKtA3DA();
                    if (ext.ToLower() == ".a3da")
                    {
                        A.A3DAReader(filepath);
                    }
                    if (ext.ToLower() == ".mp")
                    {
                        A.MsgPackReader(filepath);
                    }

                    if (!MP || Format > KKtMain.Format.NULL)
                    {
                        A.IO = KKtLib.IO.OpenWriter(filepath + ".a3da", true);
                    }
                    if (Format > KKtMain.Format.NULL)
                    {
                        if (A.Data.Header.Format < KKtMain.Format.F2LE)
                        {
                            A.Data._.CompressF16 = Format == KKtMain.Format.MGF ? 2 : 1;
                        }
                        A.Data.Header.Format = Format;
                    }
                    if (!MP && A.Data.Header.Format > KKtMain.Format.DT && A.Data.Header.Format != KKtMain.Format.FT)
                    {
                        A.A3DCWriter(filepath);
                    }
                    else if (!MP || Format > KKtMain.Format.NULL)
                    {
                        A.A3DC = false;
                        A.A3DAWriter(filepath);
                    }
                    else
                    {
                        A.MsgPackWriter(filepath);
                    }
                }
                catch (Exception e)
                { Console.WriteLine(e); }
            }
        }