public void UpdateText(String[] Textlines) { if (Textlines == null) { return; } StringBuilder sb = new StringBuilder(); foreach (String line in Textlines) { sb.AppendLine(line); } String Text = sb.ToString(); Text = VesperiaUtil.RemoveTags(Text); if (BoxByBox) { List <string> lst = new List <string>(); int Last = 0; for (int i = 0; i < Text.Length; i++) { if (Text[i] == '\n') { if (!(i + 1 < Text.Length && Text[i + 1] == '\n')) { continue; } int This = i; lst.Add(Text.Substring(Last, i - Last)); while (i + 1 < Text.Length && Text[i + 1] == '\n') { i++; } Last = i + 1; } } lst.Add(Text.Substring(Last, Text.Length - Last)); int count = 0; foreach (string s in lst) { textBoxDisplayDelay.Text = s; UpdateAny(); SaveAsPng("textbox_" + String.Format("{0:0000}", count) + ".png"); count++; } } textBoxDisplayDelay.Text = Text; }
public string GetDataAsHtml(GameVersion version, TSS.TSSFile stringDic, Dictionary <uint, TSS.TSSEntry> inGameIdDict) { StringBuilder sb = new StringBuilder(); var synopsisEntry = inGameIdDict[TextStringDicId]; string jp = synopsisEntry.StringJpn != null ? synopsisEntry.StringJpn : ""; jp = Website.GenerateWebsite.ReplaceIconsWithHtml(new StringBuilder(jp), version, true).ToString(); string en = synopsisEntry.StringEng != null ? synopsisEntry.StringEng : ""; en = Website.GenerateWebsite.ReplaceIconsWithHtml(new StringBuilder(en), version, false).ToString(); string[] textJpn = jp.Split('\f'); string[] textEng = en.Split('\f'); for (int i = 0; i < textJpn.Length; ++i) { textJpn[i] = VesperiaUtil.RemoveTags(textJpn[i], true, true).Replace("\n", "<br />"); } for (int i = 0; i < textEng.Length; ++i) { textEng[i] = VesperiaUtil.RemoveTags(textEng[i], false, true).Replace("\n", "<br />"); } //sb.Append( "Unlocks between " + StoryIdMin + " and " + StoryIdMax + "<br>" ); sb.Append("<table class=\"synopsis\">"); sb.Append("<tr id=\"synopsis" + ID + "\"><td class=\"synopsistitle\" colspan=\"" + textJpn.Length + "\">"); if (version == GameVersion.PS3) { sb.Append("<img src=\"synopsis/U_" + RefString1 + ".png\"><br><br>"); } sb.Append(inGameIdDict[NameStringDicId].StringJpnHtml(version) + "</td></tr><tr>"); foreach (string s in textJpn) { sb.Append("<td>" + s + "</td>"); } sb.Append("</tr>"); sb.Append("</table>"); sb.Append("<br>"); sb.Append("<table class=\"synopsis\">"); sb.Append("<tr id=\"synopsis" + ID + "\"><td class=\"synopsistitle\" colspan=\"" + textEng.Length + "\">"); sb.Append(inGameIdDict[NameStringDicId].StringEngHtml(version) + "</td></tr><tr>"); foreach (string s in textEng) { sb.Append("<td>" + s + "</td>"); } sb.Append("</tr>"); sb.Append("</table>"); return(sb.ToString()); }
public string StringEngHtml(GameVersion version, Dictionary <uint, TSS.TSSEntry> inGameIdDict) { string en = StringEng != null ? StringEng : ""; return(VesperiaUtil.RemoveTags(Website.WebsiteGenerator.ReplaceIconsWithHtml(new StringBuilder(en), inGameIdDict, version, false).ToString(), inGameIdDict, false, true).Replace("\n", "<br />")); }
public static StringBuilder ReplaceIconsWithHtml(StringBuilder sb, Dictionary <uint, TSS.TSSEntry> inGameIdDict, GameVersion Version, bool japaneseStyle) { sb.Replace("\x06(ST1)", "<img src=\"text-icons/icon-status-01.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(ST2)", "<img src=\"text-icons/icon-status-02.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(ST3)", "<img src=\"text-icons/icon-status-03.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(ST4)", "<img src=\"text-icons/icon-status-04.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(ST5)", "<img src=\"text-icons/icon-status-05.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(ST6)", "<img src=\"text-icons/icon-status-06.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(ST7)", "<img src=\"text-icons/icon-status-07.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(SC1)", "<img src=\"text-icons/icon-status-08.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(SC2)", "<img src=\"text-icons/icon-status-09.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(SC3)", "<img src=\"text-icons/icon-status-10.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(SC4)", "<img src=\"text-icons/icon-status-11.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(SC5)", "<img src=\"text-icons/icon-status-17.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(SC6)", "<img src=\"text-icons/icon-status-13.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(SC7)", "<img src=\"text-icons/icon-status-18.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(EL1)", "<img src=\"text-icons/icon-element-02.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(EL2)", "<img src=\"text-icons/icon-element-04.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(EL3)", "<img src=\"text-icons/icon-element-01.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(EL4)", "<img src=\"text-icons/icon-element-05.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(EL5)", "<img src=\"text-icons/icon-element-03.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(EL6)", "<img src=\"text-icons/icon-element-06.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(EL7)", "<img src=\"text-icons/icon-element-07.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(FS1)", "<img src=\"text-icons/icon-fs-01.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(FS2)", "<img src=\"text-icons/icon-fs-02.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(FS3)", "<img src=\"text-icons/icon-fs-03.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(MC1)", "<img src=\"text-icons/icon-monster-01.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(MC2)", "<img src=\"text-icons/icon-monster-02.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(MC3)", "<img src=\"text-icons/icon-monster-03.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(MC4)", "<img src=\"text-icons/icon-monster-04.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(MC5)", "<img src=\"text-icons/icon-monster-05.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(MC6)", "<img src=\"text-icons/icon-monster-06.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(MC7)", "<img src=\"text-icons/icon-monster-07.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(MC8)", "<img src=\"text-icons/icon-monster-08.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(MC9)", "<img src=\"text-icons/icon-monster-09.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(COS)", "<img src=\"text-icons/icon-costume.png\" height=\"16\" width=\"16\">"); sb.Replace("\x06(STA)", "<img src=\"text-icons/" + Version.ToString() + "/button-Start.png\" height=\"16\" title=\"" + VesperiaUtil.GetButtonName(Version, ControllerButton.Start) + "\">"); sb.Replace("\x06(SEL)", "<img src=\"text-icons/" + Version.ToString() + "/button-Select.png\" height=\"16\" title=\"" + VesperiaUtil.GetButtonName(Version, ControllerButton.Select) + "\">"); sb.Replace("\x06(L3)", "<img src=\"text-icons/" + Version.ToString() + "/ls-push.png\" height=\"16\" title=\"" + VesperiaUtil.GetButtonName(Version, ControllerButton.L3) + "\">"); sb.Replace("\x06(R3)", "<img src=\"text-icons/" + Version.ToString() + "/rs-push.png\" height=\"16\" title=\"" + VesperiaUtil.GetButtonName(Version, ControllerButton.R3) + "\">"); sb.Replace("\x06(MVN)", "<img src=\"text-icons/" + Version.ToString() + "/ls.png\" height=\"16\" title=\"Character Movement\">"); sb.Replace("\x06(MVR)", "<img src=\"text-icons/" + Version.ToString() + "/ls-right.png\" height=\"16\" title=\"Character Movement Right\">"); sb.Replace("\x06(MVL)", "<img src=\"text-icons/" + Version.ToString() + "/ls-left.png\" height=\"16\" title=\"Character Movement Left\">"); sb.Replace("\x06(MVU)", "<img src=\"text-icons/" + Version.ToString() + "/ls-up.png\" height=\"16\" title=\"Character Movement Up\">"); sb.Replace("\x06(MVD)", "<img src=\"text-icons/" + Version.ToString() + "/ls-down.png\" height=\"16\" title=\"Character Movement Down\">"); sb.Replace("\x06(MVH)", "<img src=\"text-icons/" + Version.ToString() + "/ls-side.png\" height=\"16\" title=\"Character Movement Side\">"); sb.Replace("\x06(LTN)", "<img src=\"text-icons/" + Version.ToString() + "/ls.png\" height=\"16\" title=\"" + VesperiaUtil.GetButtonName(Version, ControllerButton.LeftStick) + "\">"); sb.Replace("\x06(LTR)", "<img src=\"text-icons/" + Version.ToString() + "/ls-right.png\" height=\"16\" title=\"" + VesperiaUtil.GetButtonName(Version, ControllerButton.LeftStick) + " Right\">"); sb.Replace("\x06(LTL)", "<img src=\"text-icons/" + Version.ToString() + "/ls-left.png\" height=\"16\" title=\"" + VesperiaUtil.GetButtonName(Version, ControllerButton.LeftStick) + " Left\">"); sb.Replace("\x06(LTU)", "<img src=\"text-icons/" + Version.ToString() + "/ls-up.png\" height=\"16\" title=\"" + VesperiaUtil.GetButtonName(Version, ControllerButton.LeftStick) + " Up\">"); sb.Replace("\x06(LTD)", "<img src=\"text-icons/" + Version.ToString() + "/ls-down.png\" height=\"16\" title=\"" + VesperiaUtil.GetButtonName(Version, ControllerButton.LeftStick) + " Down\">"); sb.Replace("\x06(LTH)", "<img src=\"text-icons/" + Version.ToString() + "/ls-side.png\" height=\"16\" title=\"" + VesperiaUtil.GetButtonName(Version, ControllerButton.LeftStick) + " Side\">"); sb.Replace("\x06(RTN)", "<img src=\"text-icons/" + Version.ToString() + "/rs.png\" height=\"16\" title=\"" + VesperiaUtil.GetButtonName(Version, ControllerButton.RightStick) + "\">"); sb.Replace("\x06(RTR)", "<img src=\"text-icons/" + Version.ToString() + "/rs-right.png\" height=\"16\" title=\"" + VesperiaUtil.GetButtonName(Version, ControllerButton.RightStick) + " Right\">"); sb.Replace("\x06(RTL)", "<img src=\"text-icons/" + Version.ToString() + "/rs-left.png\" height=\"16\" title=\"" + VesperiaUtil.GetButtonName(Version, ControllerButton.RightStick) + " Left\">"); sb.Replace("\x06(RTU)", "<img src=\"text-icons/" + Version.ToString() + "/rs-up.png\" height=\"16\" title=\"" + VesperiaUtil.GetButtonName(Version, ControllerButton.RightStick) + " Up\">"); sb.Replace("\x06(RTD)", "<img src=\"text-icons/" + Version.ToString() + "/rs-down.png\" height=\"16\" title=\"" + VesperiaUtil.GetButtonName(Version, ControllerButton.RightStick) + " Down\">"); sb.Replace("\x06(RTH)", "<img src=\"text-icons/" + Version.ToString() + "/rs-side.png\" height=\"16\" title=\"" + VesperiaUtil.GetButtonName(Version, ControllerButton.RightStick) + " Side\">"); sb.Replace("\x06(LBN)", "<img src=\"text-icons/" + Version.ToString() + "/dpad.png\" height=\"16\" title=\"" + VesperiaUtil.GetButtonName(Version, ControllerButton.DPad) + "\">"); sb.Replace("\x06(LBR)", "<img src=\"text-icons/" + Version.ToString() + "/dpad-right.png\" height=\"16\" title=\"" + VesperiaUtil.GetButtonName(Version, ControllerButton.DPad) + " Right\">"); sb.Replace("\x06(LBL)", "<img src=\"text-icons/" + Version.ToString() + "/dpad-left.png\" height=\"16\" title=\"" + VesperiaUtil.GetButtonName(Version, ControllerButton.DPad) + " Left\">"); sb.Replace("\x06(LBU)", "<img src=\"text-icons/" + Version.ToString() + "/dpad-up.png\" height=\"16\" title=\"" + VesperiaUtil.GetButtonName(Version, ControllerButton.DPad) + " Up\">"); sb.Replace("\x06(LBD)", "<img src=\"text-icons/" + Version.ToString() + "/dpad-down.png\" height=\"16\" title=\"" + VesperiaUtil.GetButtonName(Version, ControllerButton.DPad) + " Down\">"); sb.Replace("\x06(LBH)", "<img src=\"text-icons/" + Version.ToString() + "/dpad-side.png\" height=\"16\" title=\"" + VesperiaUtil.GetButtonName(Version, ControllerButton.DPad) + " Side\">"); sb.Replace("\x06(MVNR)", "<img src=\"text-icons/" + Version.ToString() + "/dpad.png\" height=\"16\" title=\"Non-Character Movement\">"); sb.Replace("\x06(MVRR)", "<img src=\"text-icons/" + Version.ToString() + "/dpad-right.png\" height=\"16\" title=\"Non-Character Movement Right\">"); sb.Replace("\x06(MVLR)", "<img src=\"text-icons/" + Version.ToString() + "/dpad-left.png\" height=\"16\" title=\"Non-Character Movement Left\">"); sb.Replace("\x06(MVUR)", "<img src=\"text-icons/" + Version.ToString() + "/dpad-up.png\" height=\"16\" title=\"Non-Character Movement Up\">"); sb.Replace("\x06(MVDR)", "<img src=\"text-icons/" + Version.ToString() + "/dpad-down.png\" height=\"16\" title=\"Non-Character Movement Down\">"); sb.Replace("\x06(MVHR)", "<img src=\"text-icons/" + Version.ToString() + "/dpad-side.png\" height=\"16\" title=\"Non-Character Movement Side\">"); sb.Replace("\x06(RBL)", "<img src=\"text-icons/" + Version.ToString() + "/button-action.png\" height=\"16\" title=\"" + VesperiaUtil.GetButtonName(Version, ControllerButton.LeftButton) + "\">"); sb.Replace("\x06(RBU)", "<img src=\"text-icons/" + Version.ToString() + "/button-menu.png\" height=\"16\" title=\"" + VesperiaUtil.GetButtonName(Version, ControllerButton.UpperButton) + "\">"); sb.Replace("\x06(RBR)", "<img src=\"text-icons/" + Version.ToString() + "/button-cancel.png\" height=\"16\" title=\"" + VesperiaUtil.GetButtonName(Version, ControllerButton.RightButton) + "\">"); sb.Replace("\x06(RBD)", "<img src=\"text-icons/" + Version.ToString() + "/button-confirm.png\" height=\"16\" title=\"" + VesperiaUtil.GetButtonName(Version, ControllerButton.LowerButton) + "\">"); if (japaneseStyle && Version.SwapsConfirmAndCancelDependingOnRegion()) { // in JP PS3 version, swap circle/cross for confirm/cancel sb.Replace("\x06(CCL)", "<img src=\"text-icons/" + Version.ToString() + "/button-confirm.png\" height=\"16\" title=\"Cancel\">"); sb.Replace("\x06(ETR)", "<img src=\"text-icons/" + Version.ToString() + "/button-cancel.png\" height=\"16\" title=\"Confirm\">"); } else { sb.Replace("\x06(CCL)", "<img src=\"text-icons/" + Version.ToString() + "/button-cancel.png\" height=\"16\" title=\"Cancel\">"); sb.Replace("\x06(ETR)", "<img src=\"text-icons/" + Version.ToString() + "/button-confirm.png\" height=\"16\" title=\"Confirm\">"); } sb.Replace("\x06(ATK)", "<img src=\"text-icons/" + Version.ToString() + "/button-cancel.png\" height=\"16\" title=\"Attack\">"); sb.Replace("\x06(ART)", "<img src=\"text-icons/" + Version.ToString() + "/button-confirm.png\" height=\"16\" title=\"Arte\">"); sb.Replace("\x06(GUD)", "<img src=\"text-icons/" + Version.ToString() + "/button-action.png\" height=\"16\" title=\"Guard\">"); sb.Replace("\x06(MEN)", "<img src=\"text-icons/" + Version.ToString() + "/button-menu.png\" height=\"16\" title=\"Menu\">"); sb.Replace("\x06(CBR1)", "<img src=\"text-icons/" + Version.ToString() + "/button-R1.png\" height=\"16\" title=\"Enemy Target Switch\">"); sb.Replace("\x06(CBR2)", "<img src=\"text-icons/" + Version.ToString() + "/button-R2.png\" height=\"16\" title=\"Fatal Strike\">"); sb.Replace("\x06(CBL1)", "<img src=\"text-icons/" + Version.ToString() + "/button-L1.png\" height=\"16\" title=\"Alternate Attack\">"); sb.Replace("\x06(CBL2)", "<img src=\"text-icons/" + Version.ToString() + "/button-L2.png\" height=\"16\" title=\"Free Run\">"); sb.Replace("\x06(R1)", "<img src=\"text-icons/" + Version.ToString() + "/button-R1.png\" height=\"16\" title=\"" + VesperiaUtil.GetButtonName(Version, ControllerButton.R1) + "\">"); sb.Replace("\x06(R2)", "<img src=\"text-icons/" + Version.ToString() + "/button-R2.png\" height=\"16\" title=\"" + VesperiaUtil.GetButtonName(Version, ControllerButton.R2) + "\">"); sb.Replace("\x06(L1)", "<img src=\"text-icons/" + Version.ToString() + "/button-L1.png\" height=\"16\" title=\"" + VesperiaUtil.GetButtonName(Version, ControllerButton.L1) + "\">"); sb.Replace("\x06(L2)", "<img src=\"text-icons/" + Version.ToString() + "/button-L2.png\" height=\"16\" title=\"" + VesperiaUtil.GetButtonName(Version, ControllerButton.L2) + "\">"); sb.Replace('∀', '♥'); sb.Replace('‡', 'é'); sb.Replace('†', 'í'); return(sb); }
public void UpdateText(string Text) { Text = VesperiaUtil.RemoveTags(Text); if (LastText == Text) { return; } LastText = Text; int CurrentFontInfoToUse = (int)numericUpDownTileNumber.Value; int CharacterIDSelected = (int)TownMapIDBox.Value; int x = 0; int y = 0; int xsize = 0; int ysize = 0; for (int i = 0; i < Text.Length; i++) { if (Text[i] == '\n') { xsize = Math.Max(xsize, x + 34); x = 0; y += 43; continue; } int CharacterID = FontInfos[CurrentFontInfoToUse].GetCharacterIdFromCharacter(Text[i]); int Length = FontInfos[CurrentFontInfoToUse].CharacterLengths[CharacterID]; x += Length + 2; } xsize = Math.Max(xsize, x + 34); ysize = y + 43; //if (xsize > 10000) xsize = 10000; //if (ysize > 10000) ysize = 40000; Image img = new System.Drawing.Bitmap(xsize, ysize); Color cc; if (this.checkBoxApproxDialogue.Checked) { cc = bgcolor; } else { cc = Color.Black; } Graphics.FromImage(img).Clear(cc); pictureBox2.Image = img; x = 0; y = 0; for (int i = 0; i < Text.Length; i++) { if (Text[i] == '\n') { x = 0; y += 43; continue; } int CharacterID = FontInfos[CurrentFontInfoToUse].GetCharacterIdFromCharacter(Text[i]); int Length = FontInfos[CurrentFontInfoToUse].CharacterLengths[CharacterID]; Draw(CharacterID, x, y); if (CharacterID == CharacterIDSelected) { DrawLineBelowLetter(x, y, Length); } x += Length; x += 2; } }
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); }
public static int Parse(List <string> args) { if (args.Count < 2) { Console.WriteLine("Usage: SaveDataParser savefile gamedatapath"); Console.WriteLine("Save must be decrypted."); Console.WriteLine("Game data path should point to a directory or other container with the game files, which is needed to parse things like item, title, and enemy data correctly."); return(-1); } IContainer gameContainer = Website.GenerateWebsite.ContainerFromPath(args[1]); if (gameContainer == null) { Console.WriteLine("Invalid game data path given."); return(-1); } GameVersion?maybeVersion = Website.GenerateWebsite.GuessGameVersionFromContainer(gameContainer); if (!maybeVersion.HasValue) { Console.WriteLine("Failed to determine game version from given data path."); return(-1); } GameVersion version = maybeVersion.Value; IContainer gameDir = Website.GenerateWebsite.FindGameDataDirectory(gameContainer, version); if (gameDir == null) { Console.WriteLine("Failed to find correct file container -- is your game dump incomplete?"); return(-1); } GameLocale locale = VesperiaUtil.GetValidLocales(version).First(); EndianUtils.Endianness endian = VesperiaUtil.GetEndian(version); TextUtils.GameTextEncoding encoding = VesperiaUtil.GetEncoding(version); BitUtils.Bitness bits = VesperiaUtil.GetBitness(version); TSS.TSSFile stringDic = new TSS.TSSFile(Website.GenerateWebsite.TryGetStringDic(gameDir, locale, version), encoding, endian); Dictionary <uint, TSS.TSSEntry> inGameDic = stringDic.GenerateInGameIdDictionary(); ItemDat.ItemDat itemData = new ItemDat.ItemDat(Website.GenerateWebsite.TryGetItemDat(gameDir, locale, version), Website.GenerateWebsite.TryGetItemSortDat(gameDir, locale, version), EndianUtils.Endianness.BigEndian); List <ItemDat.ItemDatSingle> itemDataSorted = itemData.GetSortedByInGameSorting(); FAMEDAT.FAMEDAT titles = new FAMEDAT.FAMEDAT(Website.GenerateWebsite.TryGetTitles(gameDir, locale, version), endian); T8BTEMST.T8BTEMST enemies = new T8BTEMST.T8BTEMST(Website.GenerateWebsite.TryGetEnemies(gameDir, locale, version), endian, bits); using (DuplicatableFileStream file = new DuplicatableFileStream(args[0])) { var savedata = new SaveData(file, endian); savedata.SavePoint.PrintData(); savedata.PartyData.PrintData(endian, inGameDic, itemDataSorted, enemies); foreach (var characterBlock in savedata.CharacterData) { characterBlock.PrintData(endian, version, inGameDic, titles); Console.WriteLine("====="); } //savedata.ExportTo( args[0] + ".ext" ); } return(0); }
public string StringEngHtml(GameVersion version) { string en = StringEng != null ? StringEng : ""; return(VesperiaUtil.RemoveTags(Website.GenerateWebsite.ReplaceIconsWithHtml(new StringBuilder(en), version, false).ToString(), false, true).Replace("\n", "<br />")); }
public string StringJpnHtml(GameVersion version) { string jp = StringJpn != null ? StringJpn : ""; return(VesperiaUtil.RemoveTags(Website.GenerateWebsite.ReplaceIconsWithHtml(new StringBuilder(jp), version, true).ToString(), true, true).Replace("\n", "<br />")); }