示例#1
0
    private void BuildDatabase()
    {
        BIN DB = new BIN();

        List <string>[] texts = DB.BuildItems(VSPath + "MENU/ITEMNAME.BIN", VSPath + "MENU/ITEMHELP.BIN");
        DB.Parse(VSPath + "SMALL/MON.BIN");

        string[] files = Directory.GetFiles(VSPath + "MENU/", "*.SYD");
        foreach (string file in files)
        {
            SYD parser = new SYD();
            //parser.UseDebug = true;
            parser.Parse(file, texts);
        }
    }
示例#2
0
    void OnGUI()
    {
        if (conf == null)
        {
            conf = Memory.LoadConfig();
            if (conf == null)
            {
                Memory.SaveConfig(new VSPConfig());
                conf = Memory.LoadConfig();
            }
            if (conf.VSPath != null)
            {
                VSPath = conf.VSPath;
                if (conf.VS_Version == "")
                {
                    conf.VS_Version = LBA.checkVSROM(VSPath);
                    Memory.SaveConfig(conf);
                }
            }
        }

        GUILayout.Label("Vagrant Story Path", EditorStyles.boldLabel);
        GUILayoutOption[] options = { GUILayout.Width(300), GUILayout.MaxWidth(400) };
        VSPath = EditorGUILayout.TextField("Vagrant Story CD path :", VSPath, options);

        GUILayoutOption[] options2 = { GUILayout.MaxWidth(30) };
        bool VSPathTrigger         = GUILayout.Button(new GUIContent("..."), options2);

        if (VSPathTrigger)
        {
            string path = EditorUtility.OpenFolderPanel("Path to Vagrant Story CD", "", "");
            VSPath = path + "/";
        }

        GUILayoutOption[] options3 = { GUILayout.Width(200), GUILayout.MaxWidth(400) };
        bool VSSaveTrigger         = GUILayout.Button(new GUIContent("Save Path"), options3);

        if (VSSaveTrigger)
        {
            conf.VSPath     = VSPath;
            conf.VS_Version = LBA.checkVSROM(VSPath);
            Memory.SaveConfig(conf);
        }

        GUILayout.Label("Vagrant Story Version : " + conf.VS_Version);
        GUILayout.Space(10f);

        GUILayout.Label("| One File import", EditorStyles.boldLabel);
        FilePath = EditorGUILayout.TextField("File path (VS Path relativ) :", FilePath, options);
        bool filePathTrigger = GUILayout.Button(new GUIContent("..."), options2);

        if (filePathTrigger)
        {
            string path = EditorUtility.OpenFilePanel("Path to File", VSPath, "");
            FilePath = path.Replace(VSPath, "");
        }
        bool fileLoadTrigger = GUILayout.Button(new GUIContent("Load"), options3);

        if (fileLoadTrigger && VSPath != "" && FilePath != "")
        {
            string[] hash     = FilePath.Split("/"[0]);
            string[] h2       = hash[hash.Length - 1].Split("."[0]);
            string   folder   = hash[0];
            string   fileName = h2[0];
            string   ext      = h2[1];


            switch (folder)
            {
            case "BATTLE":
                // BATTLE.PRG
                // BOG.DAT
                // INITBTL.PRG
                // SYSTEM.DAT
                switch (ext)
                {
                case "PRG":
                    PRG parser = new PRG();
                    parser.Parse(VSPath + FilePath);
                    break;
                }
                break;

            case "BG":
                // 001OP01A.FAR & TIM
                // 002OP01A.FAR & TIM
                // 007OP01A.FAR & TIM
                // 008OP01A.FAR & TIM
                break;

            case "EFFECT":
                // EFFPURGE.BIN maybe the PLG for E000.P
                // E*.P
                // E*.FBC
                // E*.FBT
                // PLG*.BIN lot of empty
                switch (ext)
                {
                case "P":
                    EFFECT effect = new EFFECT(VSPath + FilePath);
                    break;
                }
                break;

            case "ENDING":
                // ENDING.PRG
                // ENDING.XA
                // ILLUST06.BIN -> ILLUST16.BIN
                // NULL.DAT
                switch (ext)
                {
                case "BIN":
                    TIM parser = new TIM();
                    parser.ParseIllust(VSPath + FilePath);
                    break;
                }
                break;

            case "EVENT":
                // ****.EVT
                ParseEVT(VSPath + FilePath, true);
                break;

            case "MAP":
                // MAP***.MPD
                // Z***U**.ZUD
                // ZONE***.ZND
                switch (ext)
                {
                case "MPD":
                    ParseMPD(VSPath + FilePath, true);
                    break;

                case "ZUD":
                    ParseZUD(VSPath + FilePath, fileName, true);
                    break;

                case "ZND":
                    ParseZND(VSPath + FilePath, true);
                    break;
                }
                break;

            case "MENU":
                break;

            case "MOV":
                break;

            case "MUSIC":
                ParseAKAO(VSPath + FilePath, AKAO.MUSIC, true);
                break;

            case "OBJ":
                // **.SHP
                // **.SEQ
                // **.WEP
                switch (ext)
                {
                case "SHP":
                    ParseSHP(VSPath + FilePath, fileName, true, true);
                    break;

                case "WEP":
                    ParseWEP(VSPath + FilePath, true);
                    break;
                }
                break;

            case "SOUND":
                ParseAKAO(VSPath + FilePath, AKAO.SOUND, true);
                break;
            }
        }



        GUILayout.Label("| Batch imports", EditorStyles.boldLabel);
        GUILayout.BeginVertical();
        GUILayout.Label("3D Model Formats : ");
        bool LoadARMTrigger = GUILayout.Button(new GUIContent("Load MiniMaps.ARM"));

        if (LoadARMTrigger && VSPath != "")
        {
            string[] files       = Directory.GetFiles(VSPath + "SMALL/", "*.ARM");
            float    fileToParse = files.Length;
            float    fileParsed  = 0;
            foreach (string file in files)
            {
                string[] h        = file.Split("/"[0]);
                string   filename = h[h.Length - 1];
                EditorUtility.DisplayProgressBar("VS Parsing", "Parsing : " + filename + ", " + fileParsed + " files parsed.", (fileParsed / fileToParse));
                ARM parser = new ARM();
                //parser.UseDebug = true;
                parser.Parse(file);
                parser.BuildPrefab(true);
                fileParsed++;
            }
            EditorUtility.ClearProgressBar();
        }

        bool LoadWEPTrigger = GUILayout.Button(new GUIContent("Load Weapons.WEP"));

        if (LoadWEPTrigger && VSPath != "")
        {
            BuildDatabase();
            string[] files       = Directory.GetFiles(VSPath + "OBJ/", "*.WEP");
            float    fileToParse = files.Length;
            float    fileParsed  = 0f;

            foreach (string file in files)
            {
                string[] h        = file.Split("/"[0]);
                string   filename = h[h.Length - 1];
                EditorUtility.DisplayProgressBar("VS Parsing", "Parsing : " + filename + ", " + fileParsed + " files parsed.", (fileParsed / fileToParse));
                ParseWEP(file, true);
                fileParsed++;
            }
            EditorUtility.ClearProgressBar();
        }

        bool LoadSHPTrigger = GUILayout.Button(new GUIContent("Load 3D Models.SHP"));

        if (LoadSHPTrigger && VSPath != "")
        {
            string[] files       = Directory.GetFiles(VSPath + "OBJ/", "*.SHP");
            float    fileToParse = files.Length;
            float    fileParsed  = 0f;

            foreach (string file in files)
            {
                string[] h        = file.Split("/"[0]);
                string   filename = h[h.Length - 1];
                EditorUtility.DisplayProgressBar("VS Parsing", "Parsing : " + filename + ", " + fileParsed + " files parsed.", (fileParsed / fileToParse));
                ParseSHP(file, filename, false);
                fileParsed++;
            }
            EditorUtility.ClearProgressBar();
        }

        bool LoadZUDTrigger = GUILayout.Button(new GUIContent("Load Zones Units Datas.ZUD"));

        if (LoadZUDTrigger && VSPath != "")
        {
            string[] files       = Directory.GetFiles(VSPath + "MAP/", "*.ZUD");
            float    fileToParse = files.Length;
            float    fileParsed  = 0f;
            foreach (string file in files)
            {
                string[] h        = file.Split("/"[0]);
                string   filename = h[h.Length - 1];
                EditorUtility.DisplayProgressBar("VS Parsing", "Parsing : " + filename + ", " + fileParsed + " files parsed.", (fileParsed / fileToParse));
                ParseZUD(file, filename, false);
                fileParsed++;
            }
            EditorUtility.ClearProgressBar();
        }

        bool LoadMPDTrigger = GUILayout.Button(new GUIContent("Load Map Datas.MPD"));

        if (LoadMPDTrigger && VSPath != "")
        {
            string[] files       = Directory.GetFiles(VSPath + "MAP/", "*.MPD");
            float    fileToParse = files.Length;
            float    fileParsed  = 0f;

            foreach (string file in files)
            {
                string[] h        = file.Split("/"[0]);
                string   filename = h[h.Length - 1];
                EditorUtility.DisplayProgressBar("VS Parsing", "Parsing : " + filename + ", " + fileParsed + " files parsed.", (fileParsed / fileToParse));
                ParseMPD(file, false);
                fileParsed++;
            }
            EditorUtility.ClearProgressBar();
        }

        bool LoadEFFECTTrigger = GUILayout.Button(new GUIContent("Load EFFECT/E0*.P, E0*.FBC, E0*.FBT (Only Texture right now)"));

        if (LoadEFFECTTrigger && VSPath != "")
        {
            string[] files       = Directory.GetFiles(VSPath + "EFFECT/", "*.P");
            float    fileToParse = files.Length;

            float fileParsed = 0;
            foreach (string file in files)
            {
                string[] h        = file.Split("/"[0]);
                string   filename = h[h.Length - 1];
                EditorUtility.DisplayProgressBar("VS Parsing", "Parsing : " + filename + ", " + fileParsed + " files parsed.", (fileParsed / fileToParse));
                EFFECT effect = new EFFECT(file);
                fileParsed++;
            }


            //EFFECT effect = new EFFECT(VSPath + "EFFECT/E008.P");

            EditorUtility.ClearProgressBar();
        }
        GUILayout.EndVertical();

        GUILayout.BeginVertical();
        GUILayout.Label("Texture Formats : ");

        bool LoadGIMTrigger = GUILayout.Button(new GUIContent("Load GIM/*.GIM"));

        if (LoadGIMTrigger && VSPath != "")
        {
            string[] files       = Directory.GetFiles(VSPath + "GIM/", "*.GIM");
            float    fileToParse = files.Length;

            float fileParsed = 0;
            foreach (string file in files)
            {
                string[] h        = file.Split("/"[0]);
                string   filename = h[h.Length - 1];
                EditorUtility.DisplayProgressBar("VS Parsing", "Parsing : " + filename + ", " + fileParsed + " files parsed.", (fileParsed / fileToParse));
                GIM gim = new GIM(file);
                fileParsed++;
            }


            EditorUtility.ClearProgressBar();
        }

        bool LoadMENUBGTrigger = GUILayout.Button(new GUIContent("Load MENU/*BG.BIN"));

        if (LoadMENUBGTrigger && VSPath != "")
        {
            string[] files       = new string[] { VSPath + "MENU/MAPBG.BIN", VSPath + "MENU/MENUBG.BIN" };
            float    fileToParse = files.Length;

            float fileParsed = 0;
            foreach (string file in files)
            {
                string[] h        = file.Split("/"[0]);
                string   filename = h[h.Length - 1];
                EditorUtility.DisplayProgressBar("VS Parsing", "Parsing : " + filename + ", " + fileParsed + " files parsed.", (fileParsed / fileToParse));
                TIM bg = new TIM();
                bg.ParseBG(file);
                fileParsed++;
            }


            EditorUtility.ClearProgressBar();
        }

        bool LoadDISTrigger = GUILayout.Button(new GUIContent("Load SMALL/*.DIS"));

        if (LoadDISTrigger && VSPath != "")
        {
            string[] files       = Directory.GetFiles(VSPath + "SMALL/", "*.DIS");
            float    fileToParse = files.Length;

            float fileParsed = 0;
            foreach (string file in files)
            {
                string[] h        = file.Split("/"[0]);
                string   filename = h[h.Length - 1];
                EditorUtility.DisplayProgressBar("VS Parsing", "Parsing : " + filename + ", " + fileParsed + " files parsed.", (fileParsed / fileToParse));
                DIS dis = new DIS();
                dis.Parse(file);
                fileParsed++;
            }


            EditorUtility.ClearProgressBar();
        }

        bool LoadTIMTrigger = GUILayout.Button(new GUIContent("BG/*.TIM"));

        if (LoadTIMTrigger && VSPath != "")
        {
            string[] files       = Directory.GetFiles(VSPath + "BG/", "*.TIM");
            float    fileToParse = files.Length;

            float fileParsed = 0;
            foreach (string file in files)
            {
                string[] h        = file.Split("/"[0]);
                string   filename = h[h.Length - 1];
                EditorUtility.DisplayProgressBar("VS Parsing", "Parsing : " + filename + ", " + fileParsed + " files parsed.", (fileParsed / fileToParse));
                TIM parser = new TIM();
                parser.Parse(file);
                fileParsed++;
            }


            EditorUtility.ClearProgressBar();
        }

        bool LoadILLUSTTrigger = GUILayout.Button(new GUIContent("ENDING/ILLUST*.BIN (Not Working Yet)"));

        if (LoadILLUSTTrigger && VSPath != "")
        {
            // not working yet
            string[] files       = Directory.GetFiles(VSPath + "ENDING/", "*.BIN");
            float    fileToParse = files.Length;

            float fileParsed = 0;
            foreach (string file in files)
            {
                string[] h        = file.Split("/"[0]);
                string   filename = h[h.Length - 1];
                EditorUtility.DisplayProgressBar("VS Parsing", "Parsing : " + filename + ", " + fileParsed + " files parsed.", (fileParsed / fileToParse));
                TIM parser = new TIM();
                parser.ParseIllust(file);
                fileParsed++;
            }


            EditorUtility.ClearProgressBar();
        }
        GUILayout.EndVertical();


        GUILayout.BeginVertical();
        GUILayout.Label("Audio Formats : ");

        /*
         * bool LoadAKAOTrigger = GUILayout.Button(new GUIContent("Load Akao SOUND/WAVE*.DAT"));
         * if (LoadAKAOTrigger && VSPath != "")
         * {
         *  string[] files = Directory.GetFiles(VSPath + "SOUND/", "*.DAT");
         *  float fileToParse = files.Length;
         *  float fileParsed = 0;
         *  foreach (string file in files)
         *  {
         *      string[] h = file.Split("/"[0]);
         *      string filename = h[h.Length - 1];
         *      EditorUtility.DisplayProgressBar("VS Parsing", "Parsing : " + filename + ", " + fileParsed + " files parsed.", (fileParsed / fileToParse));
         *      AKAO parser = new AKAO();
         *      parser.UseDebug = true;
         *      parser.Parse(file, AKAO.SOUND);
         *      fileParsed++;
         *  }
         *
         *  EditorUtility.ClearProgressBar();
         * }
         */

        midTrigger = GUILayout.Toggle(midTrigger, new GUIContent("output a MIDI file ?"));
        sf2Trigger = GUILayout.Toggle(sf2Trigger, new GUIContent("output a SF2 (soundfont) file ?"));
        dlsTrigger = GUILayout.Toggle(dlsTrigger, new GUIContent("output a DLS (soundfont) file ? (Not working well yet)"));
        wavTrigger = GUILayout.Toggle(wavTrigger, new GUIContent("output a WAV file ? ( /_!_\\ heavy files)"));
        bool LoadAKAO2Trigger = GUILayout.Button(new GUIContent("Load Akao MUSIC/MUSIC*.DAT"));

        if (LoadAKAO2Trigger && VSPath != "")
        {
            string[] files       = Directory.GetFiles(VSPath + "MUSIC/", "*.DAT");
            float    fileToParse = files.Length;

            float fileParsed = 0;
            foreach (string file in files)
            {
                string[] h        = file.Split("/"[0]);
                string   filename = h[h.Length - 1];
                EditorUtility.DisplayProgressBar("VS Parsing", "Parsing : " + filename + ", " + fileParsed + " files parsed.", (fileParsed / fileToParse));
                ParseAKAO(file, AKAO.MUSIC, false);
                fileParsed++;
            }
            EditorUtility.ClearProgressBar();
        }
        GUILayout.EndVertical();

        GUILayout.BeginVertical();
        GUILayout.Label("Data Formats : ");
        bool LoadSYDTrigger = GUILayout.Button(new GUIContent("Load MENU DataBase.SYD"));

        if (LoadSYDTrigger && VSPath != "")
        {
            BuildDatabase();
        }

        bool LoadITEMTrigger = GUILayout.Button(new GUIContent("Load MENU ITEM*.BIN"));

        if (LoadITEMTrigger && VSPath != "")
        {
            BIN itemDB = new BIN();
            itemDB.BuildItems(VSPath + "MENU/ITEMNAME.BIN", VSPath + "MENU/ITEMHELP.BIN");
        }

        bool LoadEVENTTrigger = GUILayout.Button(new GUIContent("Load EVENT/*.EVT"));

        if (LoadEVENTTrigger && VSPath != "")
        {
            string[] files       = Directory.GetFiles(VSPath + "EVENT/", "*.EVT");
            float    fileToParse = files.Length;

            float fileParsed = 0;
            foreach (string file in files)
            {
                string[] h        = file.Split("/"[0]);
                string   filename = h[h.Length - 1];
                EditorUtility.DisplayProgressBar("VS Parsing", "Parsing : " + filename + ", " + fileParsed + " files parsed.", (fileParsed / fileToParse));

                ParseEVT(file, false);
                fileParsed++;
            }


            EditorUtility.ClearProgressBar();
        }

        bool LoadHFTrigger = GUILayout.Button(new GUIContent("Load InGame Help SMALL/*.HF"));

        if (LoadHFTrigger && VSPath != "")
        {
            string[] files       = Directory.GetFiles(VSPath + "SMALL/", "*.HF0");
            float    fileToParse = files.Length;

            float fileParsed = 0;
            foreach (string file in files)
            {
                string[] h        = file.Split("/"[0]);
                string   filename = h[h.Length - 1];
                EditorUtility.DisplayProgressBar("VS Parsing", "Parsing : " + filename + ", " + fileParsed + " files parsed.", (fileParsed / fileToParse));
                HF0 parser = new HF0();
                parser.Parse(file);
                fileParsed++;
            }


            EditorUtility.ClearProgressBar();
        }
        GUILayout.EndVertical();


        bool LoadEXPLOTrigger = GUILayout.Button(new GUIContent("Explore..."));

        if (LoadEXPLOTrigger && VSPath != "")
        {
            //BIN parser = new BIN();
            //parser.Explore(VSPath + "SLES_027.55"); // spell and skills
            // "BATTLE/INITBTL.PRG" // Fandango
            //parser.Explore(VSPath + "BATTLE/BOG.DAT");

            /*
             * string[] files = Directory.GetFiles(VSPath + "MENU/", "*.PRG");
             * ToolBox.FeedDatabases(files);
             */
            BIN parser = new BIN();
            parser.Explore(VSPath + "SLES_027.55"); // spell and skills
            //PRG parser = new PRG();
            //parser.Parse(VSPath + "TITLE/TITLE.PRG"); // spell and skills
            //parser.Parse(VSPath + "ENDING/ENDING.PRG");
            //parser.Parse(VSPath + "BATTLE/BATTLE.PRG");
            //parser.Parse(VSPath + "BATTLE/INITBTL.PRG");
        }
    }