Exemplo n.º 1
0
        public static int Execute(List <string> args)
        {
            string string_dic     = args[0];
            string databasename   = args[1];
            string gracesjapanese = args[2];

            TSSFile TSS;

            try {
                TSS = new TSSFile(System.IO.File.ReadAllBytes(string_dic));
            } catch (System.IO.FileNotFoundException) {
                Console.WriteLine("Could not open STRING_DIC.SO, exiting.");
                return(-1);
            }


            List <GraceNoteDatabaseEntry> entries = new List <GraceNoteDatabaseEntry>();

            foreach (TSSEntry e in TSS.Entries)
            {
                GraceNoteDatabaseEntry g = new GraceNoteDatabaseEntry(e.StringJpn, e.StringEng);
                entries.Add(g);
            }

            GraceNoteUtil.GenerateEmptyDatabase(databasename);
            GraceNoteDatabaseEntry.InsertSQL(entries.ToArray(), "Data Source=" + databasename, "Data Source=" + gracesjapanese);


            return(0);
        }
Exemplo n.º 2
0
        public static int Execute(List <string> args)
        {
            if (args.Count < 2)
            {
                Console.WriteLine("Usage: credits.dat STRING_DIC.SO");
                return(-1);
            }

            Console.WriteLine("Opening STRING_DIC.SO...");
            TSSFile TSS;

            try {
                TSS = new TSSFile(System.IO.File.ReadAllBytes(args[1]));
            } catch (System.IO.FileNotFoundException) {
                Console.WriteLine("Could not open STRING_DIC.SO, exiting.");
                return(-1);
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            CreditsForm itemForm = new CreditsForm(args[0], TSS);

            Application.Run(itemForm);
            return(0);
        }
Exemplo n.º 3
0
        public CreditsForm(string itemDatFilename, TSSFile TSS)
        {
            InitializeComponent();

            LoadCreditsInfoFile(itemDatFilename);
            this.TSS = TSS;

            labels    = new List <Label>();
            textboxes = new List <TextBox>();

            for (int i = 0; i < CreditsInfoSingle.Size / 4; ++i)
            {
                Label l = new Label();
                l.Text = "";
                l.Size = new System.Drawing.Size(80, 20);
                TextBox b = new TextBox();
                b.Size = new System.Drawing.Size(80, 20);
                b.Text = "";

                labels.Add(l);
                textboxes.Add(b);

                FlowLayoutPanel p = new FlowLayoutPanel();
                p.Size          = new System.Drawing.Size(200, 20);
                p.FlowDirection = FlowDirection.LeftToRight;
                p.Controls.Add(l);
                p.Controls.Add(b);

                flowLayoutPanel1.Controls.Add(p);
            }

            Reload();
        }
Exemplo n.º 4
0
        public string GetDataAsHtml(GameVersion version, ItemDat.ItemDat items, TSSFile stringDic, Dictionary <uint, TSSEntry> inGameIdDict, List <SearchPointContent> searchPointContents, List <SearchPointItem> searchPointItems, int index, bool phpLinks = false)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("<tr id=\"searchpoint").Append(Index).Append("\">");
            sb.Append("<td colspan=\"5\">");
            sb.Append("[#").Append(index).Append("] ");
            switch (SearchPointType)
            {
            case 0: sb.Append("Tree Stump"); break;

            case 1: sb.Append("Shell"); break;

            case 2: sb.Append("Bones"); break;

            case 3: sb.Append("Seagulls"); break;

            default: sb.Append(SearchPointType); break;
            }
            if (CoordY < 0)
            {
                sb.Append(" (Underwater)");
            }
            if (ScenarioBegin > 1000999)
            {
                switch (ScenarioBegin)
                {
                case 3000000: sb.Append(" (Chapter 3 only)"); break;

                case 3590000: sb.Append(" (once Erealumen Crystallands accessible)"); break;

                default: sb.Append(" (Appears after scenario ").Append(ScenarioBegin).Append(")"); break;
                }
            }
            //sb.Append( "<br>" )
            //sb.Append( "9: " ).Append( Unknown9 ).Append( "<br>" );
            //sb.Append( "11: " ).Append( Unknown11 ).Append( "<br>" );
            //sb.Append( "14a: " ).Append( Unknown14a ).Append( "<br>" );

            sb.Append("</td>");
            sb.Append("</tr>");

            sb.Append("<tr>");
            for (uint i = 0; i < SearchPointContentCount; ++i)
            {
                sb.Append("<td>");
                sb.Append(searchPointContents[(int)(SearchPointContentIndex + i)].GetDataAsHtml(version, items, stringDic, inGameIdDict, searchPointItems, phpLinks: phpLinks));
                sb.Append("</td>");
            }
            for (uint i = SearchPointContentCount; i < 5; ++i)
            {
                sb.Append("<td>");
                sb.Append("</td>");
            }
            sb.Append("</tr>");

            return(sb.ToString());
        }
Exemplo n.º 5
0
        public string GetDataAsHtml(GameVersion version, ItemDat.ItemDat items, TSSFile stringDic, Dictionary <uint, TSSEntry> inGameIdDict, bool phpLinks = false)
        {
            StringBuilder sb   = new StringBuilder();
            var           item = items.itemIdDict[Item];

            sb.Append("<img src=\"item-icons/ICON" + item.Data[(int)ItemData.Icon] + ".png\" height=\"16\" width=\"16\"> ");
            sb.Append("<a href=\"" + Website.GenerateWebsite.GetUrl(Website.WebsiteSection.Item, version, phpLinks, id: (int)item.Data[(int)ItemData.ID], icon: (int)item.Data[(int)ItemData.Icon]) + "\">");
            sb.Append(inGameIdDict[item.NamePointer].StringEngOrJpnHtml(version) + "</a> x" + Count);
            return(sb.ToString());
        }
Exemplo n.º 6
0
        public string GetDataAsHtml(GameVersion version, ItemDat.ItemDat items, TSSFile stringDic, Dictionary <uint, TSSEntry> inGameIdDict, List <SearchPointItem> searchPointItems, bool phpLinks = false)
        {
            StringBuilder sb = new StringBuilder();

            //sb.Append( "Percentage: " ).Append( Percentage ).Append( "%" ).Append( "<br>" );
            for (uint i = 0; i < SearchPointItemCount; ++i)
            {
                //sb.Append( "Item #" ).Append( i ).Append( ":" );
                sb.Append(searchPointItems[(int)(SearchPointItemIndex + i)].GetDataAsHtml(version, items, stringDic, inGameIdDict, phpLinks: phpLinks));
                sb.Append("<br>");
            }
            return(sb.ToString());
        }
Exemplo n.º 7
0
        public static int Execute(List <string> args)
        {
            if (args.Count < 7)
            {
                Console.WriteLine("Usage: [360/PS3] ITEM.DAT STRING_DIC.SO T8BTSK T8BTEMST COOKDAT WRLDDAT");
                return(-1);
            }

            GameVersion version = GameVersion.None;

            switch (args[0].ToUpperInvariant())
            {
            case "360":
                version = GameVersion.X360;
                break;

            case "PS3":
                version = GameVersion.PS3;
                break;
            }

            if (version == GameVersion.None)
            {
                Console.WriteLine("First parameter must indicate game version!");
                return(-1);
            }

            ItemDat items = new ItemDat(args[1]);

            TSSFile TSS;

            try {
                TSS = new TSSFile(System.IO.File.ReadAllBytes(args[2]));
            } catch (System.IO.FileNotFoundException) {
                Console.WriteLine("Could not open STRING_DIC.SO, exiting.");
                return(-1);
            }

            T8BTSK.T8BTSK     skills    = new T8BTSK.T8BTSK(args[3]);
            T8BTEMST.T8BTEMST enemies   = new T8BTEMST.T8BTEMST(args[4]);
            COOKDAT.COOKDAT   cookdat   = new COOKDAT.COOKDAT(args[5]);
            WRLDDAT.WRLDDAT   locations = new WRLDDAT.WRLDDAT(args[6]);

            Console.WriteLine("Initializing GUI...");
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            ItemForm itemForm = new ItemForm(version, items, TSS, skills, enemies, cookdat, locations);

            Application.Run(itemForm);
            return(0);
        }
Exemplo n.º 8
0
        public static int Execute(List <string> args)
        {
            if (args.Count < 7)
            {
                Console.WriteLine("Usage: [360/PS3] ITEM.DAT STRING_DIC.SO T8BTSK T8BTEMST COOKDAT WRLDDAT");
                return(-1);
            }

            GameVersion?version = null;

            switch (args[0].ToUpperInvariant())
            {
            case "360":
                version = GameVersion.X360_EU;
                break;

            case "PS3":
                version = GameVersion.PS3;
                break;
            }

            if (version == null)
            {
                Console.WriteLine("First parameter must indicate game version!");
                return(-1);
            }

            HyoutaTools.Tales.Vesperia.ItemDat.ItemDat items = new HyoutaTools.Tales.Vesperia.ItemDat.ItemDat(args[1], Util.Endianness.BigEndian);

            TSSFile TSS;

            try {
                TSS = new TSSFile(args[2], Util.GameTextEncoding.ShiftJIS, Util.Endianness.BigEndian);
            } catch (System.IO.FileNotFoundException) {
                Console.WriteLine("Could not open STRING_DIC.SO, exiting.");
                return(-1);
            }

            HyoutaTools.Tales.Vesperia.T8BTSK.T8BTSK     skills    = new HyoutaTools.Tales.Vesperia.T8BTSK.T8BTSK(args[3], Util.Endianness.BigEndian, Util.Bitness.B32);
            HyoutaTools.Tales.Vesperia.T8BTEMST.T8BTEMST enemies   = new HyoutaTools.Tales.Vesperia.T8BTEMST.T8BTEMST(args[4], Util.Endianness.BigEndian, Util.Bitness.B32);
            HyoutaTools.Tales.Vesperia.COOKDAT.COOKDAT   cookdat   = new HyoutaTools.Tales.Vesperia.COOKDAT.COOKDAT(args[5], Util.Endianness.BigEndian);
            HyoutaTools.Tales.Vesperia.WRLDDAT.WRLDDAT   locations = new HyoutaTools.Tales.Vesperia.WRLDDAT.WRLDDAT(args[6], Util.Endianness.BigEndian);

            Console.WriteLine("Initializing GUI...");
            ItemForm itemForm = new ItemForm(version.Value, items, TSS, skills, enemies, cookdat, locations);

            itemForm.Show();
            return(0);
        }
Exemplo n.º 9
0
        public static int Execute(List <string> args)
        {
            if (args.Count < 2)
            {
                Console.WriteLine("Usage: credits.dat STRING_DIC.SO");
                return(-1);
            }

            Console.WriteLine("Opening STRING_DIC.SO...");
            TSSFile TSS;

            try {
                TSS = new TSSFile(args[1], TextUtils.GameTextEncoding.ShiftJIS, EndianUtils.Endianness.BigEndian);
            } catch (System.IO.FileNotFoundException) {
                Console.WriteLine("Could not open STRING_DIC.SO, exiting.");
                return(-1);
            }

            CreditsForm itemForm = new CreditsForm(args[0], TSS);

            itemForm.Show();
            return(0);
        }
Exemplo n.º 10
0
        public ItemForm(GameVersion version, HyoutaTools.Tales.Vesperia.ItemDat.ItemDat itemDat, TSSFile TSS, HyoutaTools.Tales.Vesperia.T8BTSK.T8BTSK skills, HyoutaTools.Tales.Vesperia.T8BTEMST.T8BTEMST enemies, HyoutaTools.Tales.Vesperia.COOKDAT.COOKDAT cookdat, HyoutaTools.Tales.Vesperia.WRLDDAT.WRLDDAT locations)
        {
            InitializeComponent();

            this.Version      = version;
            this.itemDat      = itemDat;
            this.TSS          = TSS;
            this.Skills       = skills;
            this.Enemies      = enemies;
            this.Recipes      = cookdat;
            this.Locations    = locations;
            this.InGameIdDict = TSS.GenerateInGameIdDictionary();

            labels    = new List <Label>();
            textboxes = new List <TextBox>();

            for (int i = 0; i < HyoutaTools.Tales.Vesperia.ItemDat.ItemDatSingle.size / 4; ++i)
            {
                Label l = new Label();
                l.Text = "";
                l.Size = new System.Drawing.Size(100, 20);
                TextBox b = new TextBox();
                b.Size = new System.Drawing.Size(50, 20);
                b.Text = "";

                labels.Add(l);
                textboxes.Add(b);

                FlowLayoutPanel p = new FlowLayoutPanel();
                p.Size          = new System.Drawing.Size(200, 20);
                p.FlowDirection = FlowDirection.LeftToRight;
                p.Controls.Add(l);
                p.Controls.Add(b);

                switch ((HyoutaTools.Tales.Vesperia.ItemDat.ItemData)i)
                {
                case HyoutaTools.Tales.Vesperia.ItemDat.ItemData.NamePointer:
                case HyoutaTools.Tales.Vesperia.ItemDat.ItemData.DescriptionPointer:
                case HyoutaTools.Tales.Vesperia.ItemDat.ItemData.UnknownTextPointer:
                case HyoutaTools.Tales.Vesperia.ItemDat.ItemData.TextIDPart1:
                case HyoutaTools.Tales.Vesperia.ItemDat.ItemData.TextIDPart2:
                case HyoutaTools.Tales.Vesperia.ItemDat.ItemData.TextIDPart3:
                case HyoutaTools.Tales.Vesperia.ItemDat.ItemData.TextIDPart4:
                case HyoutaTools.Tales.Vesperia.ItemDat.ItemData.TextIDPart5:
                case HyoutaTools.Tales.Vesperia.ItemDat.ItemData.TextIDPart6:
                case HyoutaTools.Tales.Vesperia.ItemDat.ItemData.TextIDPart7:
                case HyoutaTools.Tales.Vesperia.ItemDat.ItemData.TextIDPart8:
                    break;

                default:
                    flowLayoutPanel1.Controls.Add(p);
                    break;
                }
            }

            foreach (HyoutaTools.Tales.Vesperia.ItemDat.ItemDatSingle i in itemDat.items)
            {
                var entry = GetEntry(i.Data[(int)HyoutaTools.Tales.Vesperia.ItemDat.ItemData.NamePointer]);
                listBox1.Items.Add(entry.StringEngOrJpn);
            }
        }
Exemplo n.º 11
0
        public static int Execute(List <string> args)
        {
            bool RealMode              = false;
            bool UpdateInGameId        = false;
            bool GenerateGracesEnglish = false;

            if (args.Contains("-real"))
            {
                Console.WriteLine("Real Mode activated, resulting file will contain both English and Japanese data as expected by an unmodified game.");
                RealMode = true;
            }
            if (args.Contains("-updateInGameId"))
            {
                Console.WriteLine("Updating InGameIDs in the database.");
                UpdateInGameId = true;
            }
            if (args.Contains("-generateGracesEnglish"))
            {
                Console.WriteLine("Generating English version of GracesJapanese.");
                GenerateGracesEnglish = true;
            }


            Console.WriteLine("Opening STRING_DIC.SO...");
            TSSFile TSS;

            try {
                TSS = new TSSFile("STRING_DIC.SO", Util.GameTextEncoding.ShiftJIS, Util.Endianness.BigEndian);
            } catch (System.IO.FileNotFoundException) {
                Console.WriteLine("Could not open STRING_DIC.SO, exiting.");
                return(-1);
            }


            if (args.Contains("-engorigdmp"))
            {
                Console.WriteLine("Exporting original text (english)...");
                System.IO.File.WriteAllBytes("STRING_DIC_original_eng_export.txt", TSS.ExportTextForEnglishDump());
            }
            if (args.Contains("-origdmp"))
            {
                Console.WriteLine("Exporting original text (all)...");
                System.IO.File.WriteAllBytes("STRING_DIC_original_export.txt", TSS.ExportText());
            }


            Console.WriteLine("Importing databases...");
            if (!TSS.ImportSQL(placeEnglishInJpnEntry: !RealMode, updateDatabaseWithInGameStringId: UpdateInGameId, generateGracesEnglish: GenerateGracesEnglish))
            {
                Console.WriteLine("Could not import all databases! Exiting...");
                return(-1);
            }


            // Empty unused strings
            if (!RealMode)
            {
                foreach (TSSEntry e in TSS.Entries)
                {
                    if (e.StringEng != null)
                    {
                        e.StringEng = "";
                    }
                }
            }


            Console.WriteLine("Writing translated file...");
            System.IO.File.WriteAllBytes("STRING_DIC_translated.SO", TSS.Serialize());


            Console.WriteLine("Writing text dump...");
            System.IO.File.WriteAllBytes("STRING_DIC_translated_export.txt", TSS.ExportText());


            Console.WriteLine("Done!");
            return(0);
        }
Exemplo n.º 12
0
        public static int Execute(List <string> args)
        {
            bool gamedirmode = args.Count == 3 || args.Count == 4;
            bool manualmode  = args.Count == 9;

            if (!gamedirmode && !manualmode)
            {
                System.Windows.Forms.MessageBox.Show(
                    "Requires arguments:\n\n" +
                    "  For automatically fetching files from game directory (point at folder containing item.svo):\n" +
                    "    Version Locale GameDirectory [STRING_DIC.SO]\n" +
                    "  STRING_DIC.SO can be overridden to select a different language file.\n" +
                    "\n" +
                    "  For manually providing files:\n" +
                    "    Version Locale ITEM.DAT STRING_DIC.SO T8BTSK T8BTEMST COOKDAT WRLDDAT ITEMSORT.DAT\n" +
                    "\n" +
                    "'Version' should be one of: 360, 360EU, PS3, PC\n" +
                    "'Locale' should be 1 for the 1st language in the given STRING_DIC, or 2 for the second"
                    );
                return(-1);
            }

            GameVersion?version = null;

            EndianUtils.Endianness     endian   = EndianUtils.Endianness.BigEndian;
            BitUtils.Bitness           bits     = BitUtils.Bitness.B32;
            TextUtils.GameTextEncoding encoding = TextUtils.GameTextEncoding.ShiftJIS;
            switch (args[0].ToUpperInvariant())
            {
            case "360":
                version = GameVersion.X360_US;
                break;

            case "360EU":
                version  = GameVersion.X360_EU;
                encoding = TextUtils.GameTextEncoding.UTF8;
                break;

            case "PS3":
                version = GameVersion.PS3;
                break;

            case "PC":
                version  = GameVersion.PC;
                endian   = EndianUtils.Endianness.LittleEndian;
                bits     = BitUtils.Bitness.B64;
                encoding = TextUtils.GameTextEncoding.UTF8;
                break;
            }
            int locale = 0;

            if (args[1] == "1")
            {
                locale = 1;
            }
            else if (args[1] == "2")
            {
                locale = 2;
            }

            if (version == null || locale == 0)
            {
                Console.WriteLine("First parameter must indicate game version, second parameter must indicate locale!");
                return(-1);
            }

            DuplicatableStream itemDatStream;
            DuplicatableStream itemSortStream;
            DuplicatableStream stringDicStream;
            DuplicatableStream skillsStream;
            DuplicatableStream enemiesStream;
            DuplicatableStream cookdatStream;
            DuplicatableStream locationsStream;

            if (manualmode)
            {
                itemDatStream   = new DuplicatableFileStream(args[2]).CopyToByteArrayStreamAndDispose();
                itemSortStream  = new DuplicatableFileStream(args[8]).CopyToByteArrayStreamAndDispose();
                stringDicStream = new DuplicatableFileStream(args[3]).CopyToByteArrayStreamAndDispose();
                skillsStream    = new DuplicatableFileStream(args[4]).CopyToByteArrayStreamAndDispose();
                enemiesStream   = new DuplicatableFileStream(args[5]).CopyToByteArrayStreamAndDispose();
                cookdatStream   = new DuplicatableFileStream(args[6]).CopyToByteArrayStreamAndDispose();
                locationsStream = new DuplicatableFileStream(args[7]).CopyToByteArrayStreamAndDispose();
            }
            else
            {
                bool hasCooksvo = VesperiaUtil.Is360(version.Value);

                using (var itemsvo = new FPS4(Path.Combine(args[2], "item.svo"))) {
                    itemDatStream  = itemsvo.GetChildByName("ITEM.DAT").AsFile.DataStream.CopyToByteArrayStreamAndDispose();
                    itemSortStream = itemsvo.GetChildByName("ITEMSORT.DAT").AsFile.DataStream.CopyToByteArrayStreamAndDispose();
                }
                using (var menusvo = new FPS4(Path.Combine(args[2], "menu.svo"))) {
                    if (!hasCooksvo)
                    {
                        cookdatStream = menusvo.GetChildByName("COOKDATA.BIN").AsFile.DataStream.CopyToByteArrayStreamAndDispose();
                    }
                    else
                    {
                        using (var cooksvo = new FPS4(Path.Combine(args[2], "cook.svo"))) {
                            cookdatStream = cooksvo.GetChildByName("COOKDATA.BIN").AsFile.DataStream.CopyToByteArrayStreamAndDispose();
                        }
                    }
                    locationsStream = menusvo.GetChildByName("WORLDDATA.BIN").AsFile.DataStream.CopyToByteArrayStreamAndDispose();
                }
                if (args.Count == 3)
                {
                    if (version == GameVersion.X360_EU)
                    {
                        stringDicStream = new DuplicatableFileStream(Path.Combine(args[2], "language", "string_dic_uk.so")).CopyToByteArrayStreamAndDispose();
                    }
                    else if (version == GameVersion.PC)
                    {
                        stringDicStream = new DuplicatableFileStream(Path.Combine(args[2], "language", "string_dic_ENG.so")).CopyToByteArrayStreamAndDispose();
                    }
                    else
                    {
                        using (var stringsvo = new FPS4(Path.Combine(args[2], "string.svo"))) {
                            stringDicStream = stringsvo.GetChildByName("STRING_DIC.SO").AsFile.DataStream.CopyToByteArrayStreamAndDispose();
                        }
                    }
                }
                else
                {
                    stringDicStream = new DuplicatableFileStream(args[3]).CopyToByteArrayStreamAndDispose();
                }
                using (var btlsvo = new FPS4(Path.Combine(args[2], "btl.svo"))) {
                    using (var btlpack = new FPS4(btlsvo.GetChildByName(version == GameVersion.X360_EU ? "BTL_PACK_UK.DAT" : "BTL_PACK.DAT").AsFile.DataStream)) {
                        using (var all = new FPS4(btlpack.GetChildByIndex(10).AsFile.DataStream)) {
                            skillsStream = all.GetChildByIndex(0).AsFile.DataStream.CopyToByteArrayStreamAndDispose();
                        }
                        using (var all = new FPS4(btlpack.GetChildByIndex(5).AsFile.DataStream)) {
                            enemiesStream = all.GetChildByIndex(0).AsFile.DataStream.CopyToByteArrayStreamAndDispose();
                        }
                    }
                }
            }


            HyoutaTools.Tales.Vesperia.ItemDat.ItemDat items = new HyoutaTools.Tales.Vesperia.ItemDat.ItemDat(itemDatStream, itemSortStream, EndianUtils.Endianness.BigEndian);

            TSSFile TSS;

            try {
                TSS = new TSSFile(stringDicStream, encoding, endian);
            } catch (System.IO.FileNotFoundException) {
                Console.WriteLine("Could not open STRING_DIC.SO, exiting.");
                return(-1);
            }

            HyoutaTools.Tales.Vesperia.T8BTSK.T8BTSK     skills    = new HyoutaTools.Tales.Vesperia.T8BTSK.T8BTSK(skillsStream, endian, bits);
            HyoutaTools.Tales.Vesperia.T8BTEMST.T8BTEMST enemies   = new HyoutaTools.Tales.Vesperia.T8BTEMST.T8BTEMST(enemiesStream, endian, bits);
            HyoutaTools.Tales.Vesperia.COOKDAT.COOKDAT   cookdat   = new HyoutaTools.Tales.Vesperia.COOKDAT.COOKDAT(cookdatStream, endian);
            HyoutaTools.Tales.Vesperia.WRLDDAT.WRLDDAT   locations = new HyoutaTools.Tales.Vesperia.WRLDDAT.WRLDDAT(locationsStream, endian);

            Console.WriteLine("Initializing GUI...");
            ItemForm itemForm = new ItemForm(version.Value, locale - 1, items, TSS, skills, enemies, cookdat, locations);

            itemForm.Show();
            return(0);
        }