protected override void InitEntries(ArchiveWorker aw = null) { if (Entries == null) { //read from icon.sp1 using (MemoryStream ms = new MemoryStream(ArchiveWorker.GetBinaryFile(ArchiveString, aw.GetListOfFiles().First(x => x.IndexOf(IndexFilename, StringComparison.OrdinalIgnoreCase) >= 0)))) { using (BinaryReader br = new BinaryReader(ms)) { Loc[] locs = new Loc[br.ReadUInt32()]; for (int i = 0; i < locs.Length; i++) { locs[i].seek = br.ReadUInt16(); locs[i].length = br.ReadUInt16(); } Entries = new Dictionary <ID, EntryGroup>(locs.Length + 10); for (int i = 0; i < locs.Length; i++) { ms.Seek(locs[i].seek, SeekOrigin.Begin); byte c = (byte)locs[i].length; Entries[(ID)i] = new EntryGroup(c); for (int e = 0; e < c; e++) { Entry tmp = new Entry(); tmp.LoadfromStreamSP1(br); tmp.Part = (byte)e; tmp.SetLoc(locs[i]); Entries[(ID)i].Add(tmp); } } } } } }
protected override void InitTextures(ArchiveWorker aw = null) { Textures = new List <TextureHandler>(); for (int t = 0; t < Props.Count; t++) { TEX tex; tex = new TEX(ArchiveWorker.GetBinaryFile(ArchiveString, aw.GetListOfFiles().First(x => x.IndexOf(Props[t].Filename, StringComparison.OrdinalIgnoreCase) >= 0))); if (Props[t].Colors == null || Props[t].Colors.Length == 0) { for (ushort i = 0; i < tex.GetClutCount; i++) { if (FORCE_ORIGINAL == false && Props[t].Big != null && Props[t].Big.Count > 0) { Textures.Add(TextureHandler.Create(Props[t].Big[0].Filename, tex, 2, Props[t].Big[0].Split / 2, i)); } else { Textures.Add(TextureHandler.Create(Props[t].Filename, tex, 1, 1, i)); } } } else { if (FORCE_ORIGINAL == false && Props[t].Big != null && Props[t].Big.Count > 0) { Textures.Add(TextureHandler.Create(Props[t].Big[0].Filename, tex, 2, Props[t].Big[0].Split / 2, (ushort)Textures.Count, colors: Props[t].Big[0].Colors ?? Props[t].Colors)); } else { Textures.Add(TextureHandler.Create(Props[t].Filename, tex, 1, 1, (ushort)Textures.Count, colors: Props[t].Colors)); } } } }
//Splash is 640x400 16BPP typical TIM with palette of ggg bbbbb a rrrrr gg public static void ReadSplash(bool bLogo = false) { string[] lof = aw.GetListOfFiles(); string filename; if (splashName > 0x0f) { return; } filename = !bLogo ? bNames ? lof.First(x => x.ToLower().Contains($"{names}{splashName.ToString("D2")}")) : lof.First(x => x.ToLower().Contains($"{loops}{splashLoop.ToString("D2")}")) : lof.First(x => x.ToLower().Contains($"ff8.lzs")); byte[] buffer = ArchiveWorker.GetBinaryFile(Memory.Archives.A_MAIN, filename); uint uncompSize = BitConverter.ToUInt32(buffer, 0); buffer = buffer.Skip(4).ToArray(); //hotfix for new LZSS buffer = LZSS.DecompressAllNew(buffer); if (splashTex != null && !splashTex.IsDisposed) { splashTex.Dispose(); } splashTex = TIM2.Overture(buffer); //using (FileStream fs = File.Create(Path.Combine("D:\\main", Path.GetFileNameWithoutExtension(filename) + ".png"))) // splashTex.SaveAsPng(fs, splashTex.Width, splashTex.Height); GC.Collect(); GC.WaitForPendingFinalizers(); }
public static void Init() { Memory.Log.WriteLine($"{nameof(Init_debugger_battle)} :: {nameof(Init)}"); ArchiveWorker aw = new ArchiveWorker(Memory.Archives.A_BATTLE); byte[] sceneOut = aw.GetBinaryFile("scene.out"); Memory.Encounters = Battle.Encounters.Read(sceneOut); //Memory.Encounters.CurrentIndex = 87; }
/// <summary> /// Fetch strings from kernel.bin /// </summary> /// <see cref="http://www.balamb.pl/qh/kernel-pointers.htm"/> protected override void LoadArchiveFiles() { Settings = (FF8StringReference.Settings.MultiCharByte | FF8StringReference.Settings.Namedic); ArchiveWorker aw = new ArchiveWorker(Archive); Files = new StringFile(56); MemoryStream ms = null; byte[] buffer = aw.GetBinaryFile(Filenames[0], true); if (buffer != null) { using (BinaryReader br = new BinaryReader(ms = new MemoryStream(buffer))) { GetFileLocations(br); //index, grab, skip StringLocations = new Dictionary <uint, Tuple <uint, uint, uint> > { //working { 0, new Tuple <uint, uint, uint>(31, 2, 4) }, { 1, new Tuple <uint, uint, uint>(32, 2, 56) }, { 2, new Tuple <uint, uint, uint>(33, 2, 128) }, { 3, new Tuple <uint, uint, uint>(34, 1, 18) },//38,58,178, or 78 { 4, new Tuple <uint, uint, uint>(35, 1, 10) }, { 5, new Tuple <uint, uint, uint>(36, 2, 20) }, { 6, new Tuple <uint, uint, uint>(37, 1, 34) },//+1interval 70 //character names here. { 7, new Tuple <uint, uint, uint>(38, 2, 20) }, { 8, new Tuple <uint, uint, uint>(39, 1, 0) }, { 9, new Tuple <uint, uint, uint>(40, 1, 18) }, { 11, new Tuple <uint, uint, uint>(41, 2, 4) }, { 12, new Tuple <uint, uint, uint>(42, 2, 4) }, { 13, new Tuple <uint, uint, uint>(43, 2, 4) }, { 14, new Tuple <uint, uint, uint>(44, 2, 4) }, { 15, new Tuple <uint, uint, uint>(45, 2, 4) }, { 16, new Tuple <uint, uint, uint>(46, 2, 4) }, { 17, new Tuple <uint, uint, uint>(47, 2, 4) }, { 18, new Tuple <uint, uint, uint>(48, 2, 20) }, { 19, new Tuple <uint, uint, uint>(49, 2, 12) }, { 21, new Tuple <uint, uint, uint>(50, 2, 20) }, { 22, new Tuple <uint, uint, uint>(51, 2, 28) }, { 24, new Tuple <uint, uint, uint>(52, 2, 4) }, { 25, new Tuple <uint, uint, uint>(53, 1, 18) }, { 28, new Tuple <uint, uint, uint>(54, 1, 10) }, { 30, new Tuple <uint, uint, uint>(55, 1, 0) }, }; for (uint key = 0; key < Files.subPositions.Count; key++) { Loc fpos = Files.subPositions[(int)key]; if (StringLocations.ContainsKey(key)) { Get_Strings_BinMSG(br, Filenames[0], key, Files.subPositions[(int)(StringLocations[key].Item1)].seek, StringLocations[key].Item2, StringLocations[key].Item3); } } ms = null; } } }
protected void GetFileLocations() { ArchiveWorker aw = new ArchiveWorker(Archive, true); using (MemoryStream ms = new MemoryStream(aw.GetBinaryFile(Filenames[1], true))) using (BinaryReader br = new BinaryReader(ms)) { GetFileLocations(br); } }
protected override void LoadArchiveFiles() { Files = new StringFile(118); GetFileLocations(); ArchiveWorker aw = new ArchiveWorker(Archive, true); MemoryStream ms = null; byte[] buffer = aw.GetBinaryFile(Filenames[0], true); if (buffer != null) { using (BinaryReader br = new BinaryReader(ms = new MemoryStream(buffer))) { //string contain padding values at start of file //then location data before strings StringsPadLoc = new uint[] { (uint)SectionID.tkmnmes1, (uint)SectionID.tkmnmes2, (uint)SectionID.tkmnmes3 }; //only location data before strings StringsLoc = new uint[] { 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 81, 82, 83, 84, 85, 86, 87, 88, 116 }; //complexstr has locations in first file, //and they have 8 bytes of stuff at the start of each entry, 6 bytes UNK and ushort length? //also can have multiple null ending strings per entry. ComplexStr = new Dictionary <uint, List <uint> > { { 74, new List <uint> { 75, 76, 77, 78, 79, 80 } } }; //these files come in pairs. the bin has string offsets and 6 bytes of other data //msg is where the strings are. BinMSG = new Dictionary <uint, uint> { { 106, 111 }, { 107, 112 }, { 108, 113 }, { 109, 114 }, { 110, 115 } }; for (uint key = 0; key < Files.subPositions.Count; key++) { Loc fpos = Files.subPositions[(int)key]; bool pad = (Array.IndexOf(StringsPadLoc, key) >= 0); if (pad || Array.IndexOf(StringsLoc, key) >= 0) { Get_Strings_Offsets(br, Filenames[0], key, pad); } else if (BinMSG.ContainsKey(key)) { Get_Strings_BinMSG(br, Filenames[0], key, Files.subPositions[(int)BinMSG[key]].seek, 1, 6); } else if (ComplexStr.ContainsKey(key)) { Get_Strings_ComplexStr(br, Filenames[0], key, ComplexStr[key]); } } ms = null; } } }
/// <summary> /// Should be called only once /// </summary> public static void Init() { ArchiveWorker aw = new ArchiveWorker(Memory.Archives.A_FIELD); string[] lists = aw.GetListOfFiles(); string maplist = lists.First(x => x.ToLower().Contains("mapdata.fs")); maplist = maplist.Substring(0, maplist.Length - 3); byte[] fs = aw.GetBinaryFile($"{maplist}{Memory.Archive.B_FileArchive}"); byte[] fl = aw.GetBinaryFile($"{maplist}{Memory.Archive.B_FileList}"); byte[] fi = aw.GetBinaryFile($"{maplist}{Memory.Archive.B_FileIndex}"); string map = System.Text.Encoding.UTF8.GetString(fl).TrimEnd(); string[] maplistb = System.Text.Encoding.UTF8.GetString( aw.FileInTwoArchives(fi, fs, fl, map)) .Replace("\r", "") .Split('\n'); Memory.FieldHolder.fields = maplistb; FieldId.FieldId_ = maplistb; }
public void LoadFonts() { ArchiveWorker aw = new ArchiveWorker(Memory.Archives.A_MENU); string sysfntTdwFilepath = aw.GetListOfFiles().First(x => x.ToLower().Contains("sysfnt.tdw")); string sysfntFilepath = aw.GetListOfFiles().First(x => x.ToLower().Contains("sysfnt.tex")); TEX tex = new TEX(ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU, sysfntFilepath)); sysfnt = tex.GetTexture((int)ColorID.White); sysfntbig = new TextureHandler("sysfld{0:00}.tex", tex, 2, 1, (int)ColorID.White); ReadTdw(ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU, sysfntTdwFilepath)); }
public TextureHandler(string filename, uint cols, uint rows) { if (cols == 1 && rows == 1) { ArchiveWorker aw = new ArchiveWorker(Memory.Archives.A_MENU); filename = aw.GetListOfFiles().First(x => x.IndexOf(filename, StringComparison.OrdinalIgnoreCase) >= 0); TEX tex = new TEX(aw.GetBinaryFile(filename)); Init(filename, tex, cols, rows); } else { Init(filename, null, cols, rows); } }
protected void simple_init() { ArchiveWorker aw = new ArchiveWorker(Archive, true); using (MemoryStream ms = new MemoryStream(aw.GetBinaryFile(Filenames[0], true))) using (BinaryReader br = new BinaryReader(ms)) { Files = new StringFile(1); Files.subPositions.Add(new Loc { seek = 0, length = uint.MaxValue }); Get_Strings_Offsets(br, Filenames[0], 0); } }
public void LoadFonts() { ArchiveWorker aw = new ArchiveWorker(Memory.Archives.A_MENU); string sysfntTdwFilepath = aw.GetListOfFiles().First(x => x.ToLower().Contains("sysfnt.tdw")); string sysfntFilepath = aw.GetListOfFiles().First(x => x.ToLower().Contains("sysfnt.tex")); TEX tex = new TEX(ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU, sysfntFilepath)); sysfnt = tex.GetTexture((int)ColorID.White); sysfntbig = TextureHandler.Create("sysfld{0:00}.tex", tex, 2, 1, (int)ColorID.White); TDW tim = new TDW(ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU, sysfntTdwFilepath), 0); charWidths = tim.CharWidths; menuFont = tim.GetTexture((ushort)ColorID.White); }
//Splash is 640x400 16BPP typical TIM with palette of ggg bbbbb a rrrrr gg private void ReadSplash() { byte[] buffer = ArchiveWorker.GetBinaryFile(Memory.Archives.A_MAIN, filename); uint uncompSize = BitConverter.ToUInt32(buffer, 0); buffer = buffer.Skip(4).ToArray(); //hotfix for new LZSS buffer = LZSS.DecompressAllNew(buffer); tex = TIM2.Overture(buffer); //using (FileStream fs = File.Create(Path.Combine("D:\\main", Path.GetFileNameWithoutExtension(filename) + ".png"))) // splashTex.SaveAsPng(fs, splashTex.Width, splashTex.Height); GC.Collect(); GC.WaitForPendingFinalizers(); }
protected void GetFileLocations() { ArchiveWorker aw = new ArchiveWorker(Archive, true); MemoryStream ms = null; byte[] buffer = aw.GetBinaryFile(Filenames[1], true); if (buffer != null) { using (BinaryReader br = new BinaryReader(ms = new MemoryStream(buffer))) { GetFileLocations(br); ms = null; } } }
public void LoadFonts() { Memory.Log.WriteLine($"{nameof(Font)} :: {nameof(LoadFonts)} "); ArchiveWorker aw = new ArchiveWorker(Memory.Archives.A_MENU); string[] filelist = aw.GetListOfFiles(); if (filelist != null) { string sysfntTdwFilepath = filelist.First(x => x.ToLower().Contains("sysfnt.tdw")); string sysfntFilepath = filelist.First(x => x.ToLower().Contains("sysfnt.tex")); TEX tex = new TEX(ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU, sysfntFilepath)); sysfnt = tex.GetTexture((int)ColorID.White); sysfntbig = TextureHandler.Create("sysfld{0:00}.tex", tex, 2, 1, (int)ColorID.White); TDW tim = new TDW(ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU, sysfntTdwFilepath), 0); charWidths = tim.CharWidths; menuFont = tim.GetTexture((ushort)ColorID.White); } }
protected virtual void InitEntries(ArchiveWorker aw = null) { if (Entries == null) { if (aw == null) { aw = new ArchiveWorker(ArchiveString); } using (MemoryStream ms = new MemoryStream(ArchiveWorker.GetBinaryFile(ArchiveString, aw.GetListOfFiles().First(x => x.IndexOf(IndexFilename, StringComparison.OrdinalIgnoreCase) >= 0)))) { ushort[] locs; using (BinaryReader br = new BinaryReader(ms)) { Count = br.ReadUInt32(); locs = new ushort[Count];//br.ReadUInt32(); 32 valid values in face.sp2 rest is invalid Entries = new Dictionary <uint, Entry>((int)Count); for (uint i = 0; i < Count; i++) { locs[i] = br.ReadUInt16(); ms.Seek(2, SeekOrigin.Current); } byte fid = 0; Entry Last = null; for (uint i = 0; i < Count; i++) { ms.Seek(locs[i] + 6, SeekOrigin.Begin); byte t = br.ReadByte(); if (t == 0 || t == 96) // known invalid entries in sp2 files have this value. there might be more to it. { Count = i; break; } Entries[i] = new Entry(); Entries[i].LoadfromStreamSP2(br, locs[i], Last, ref fid); Last = Entries[i]; } } } } }
protected void LoadArchiveFiles_Simple() { ArchiveWorker aw = new ArchiveWorker(Archive, true); MemoryStream ms; byte[] buffer = aw.GetBinaryFile(Filenames[0]); if (buffer != null) { using (BinaryReader br = new BinaryReader(ms = new MemoryStream(buffer, true))) { Files = new StringFile(1); Files.subPositions.Add(new Loc { seek = 0, length = uint.MaxValue }); Get_Strings_Offsets(br, Filenames[0], 0); ms = null; } } }
//Splash is 640x400 16BPP typical TIM with palette of ggg bbbbb a rrrrr gg private void ReadSplash() { byte[] buffer = ArchiveWorker.GetBinaryFile(Memory.Archives.A_MAIN, filename); string fn = Path.GetFileNameWithoutExtension(filename); uint uncompSize = BitConverter.ToUInt32(buffer, 0); buffer = buffer.Skip(4).ToArray(); //hotfix for new LZSS buffer = LZSS.DecompressAllNew(buffer); TIM_OVERTURE tim = new TIM_OVERTURE(buffer); if ((fn.Equals("ff8", StringComparison.OrdinalIgnoreCase)) || (fn.IndexOf("loop", StringComparison.OrdinalIgnoreCase) >= 0)) { tim.IgnoreAlpha = true; } tex = (Texture2D)TextureHandler.Create(fn, tim, 0);//TIM2.Overture(buffer); //using (FileStream fs = File.Create(Path.Combine("D:\\main", Path.GetFileNameWithoutExtension(filename) + ".png"))) // splashTex.SaveAsPng(fs, splashTex.Width, splashTex.Height); GC.Collect(); GC.WaitForPendingFinalizers(); }
private static void Init() { ArchiveWorker aw = new ArchiveWorker(Memory.Archives.A_FIELD); string[] test = aw.GetListOfFiles(); //TODO fix endless look on FieldID 50. if (Memory.FieldHolder.FieldID >= Memory.FieldHolder.fields.Length || Memory.FieldHolder.FieldID < 0) { return; } var CollectionEntry = test.Where(x => x.ToLower().Contains(Memory.FieldHolder.fields[Memory.FieldHolder.FieldID])); if (!CollectionEntry.Any()) { return; } string fieldArchive = CollectionEntry.First(); int fieldLen = fieldArchive.Length - 3; fieldArchive = fieldArchive.Substring(0, fieldLen); byte[] fs = aw.GetBinaryFile($"{fieldArchive}{Memory.Archive.B_FileArchive}"); byte[] fi = aw.GetBinaryFile($"{fieldArchive}{Memory.Archive.B_FileIndex}"); byte[] fl = aw.GetBinaryFile($"{fieldArchive}{Memory.Archive.B_FileList}"); if (fs == null || fi == null || fl == null) { return; } string[] test_ = aw.GetBinaryFileList(fl); string mim = null; string map = null; try { mim = test_.First(x => x.ToLower().Contains(".mim")); } catch {} try { map = test_.First(x => x.ToLower().Contains(".map")); } catch {} if (mim != null && map != null) { byte[] mimb = aw.FileInTwoArchives(fi, fs, fl, mim); byte[] mapb = aw.FileInTwoArchives(fi, fs, fl, map); ParseBackground(mimb, mapb); } //let's start with scripts byte[] jsm = null; byte[] sy = null; string s_jsm = null; string s_sy = null; try { s_jsm = test_.First(x => x.ToLower().Contains(".jsm")); } catch { } try { s_sy = test_.First(x => x.ToLower().Contains(".sy")); } catch { } if (s_jsm != null && s_sy != null) { jsm = aw.FileInTwoArchives(fi, fs, fl, s_jsm); sy = aw.FileInTwoArchives(fi, fs, fl, s_sy); } else { return; // one or both values are null } List <Jsm.GameObject> jsmObjects = Jsm.File.Read(jsm); if (sy == null) { return; } Sym.GameObjects symObjects = Sym.Reader.FromBytes(sy); services = FieldInitializer.GetServices(); eventEngine = ServiceId.Field[services].Engine; eventEngine.Reset(); for (var objIndex = 0; objIndex < jsmObjects.Count; objIndex++) { Jsm.GameObject obj = jsmObjects[objIndex]; FieldObject fieldObject = new FieldObject(obj.Id, symObjects.GetObjectOrDefault(objIndex).Name); foreach (Jsm.GameScript script in obj.Scripts) { fieldObject.Scripts.Add(script.ScriptId, script.Segment.GetExecuter()); } eventEngine.RegisterObject(fieldObject); } //string mch = test_.Where(x => x.ToLower().Contains(".mch")).First(); //string one = test_.Where(x => x.ToLower().Contains(".one")).First(); //string msd = test_.Where(x => x.ToLower().Contains(".msd")).First(); //string inf = test_.Where(x => x.ToLower().Contains(".inf")).First(); //string id = test_.Where(x => x.ToLower().Contains(".id")).First(); //string ca = test_.Where(x => x.ToLower().Contains(".ca")).First(); //string tdw = test_.Where(x => x.ToLower().Contains(".tdw")).First(); //string msk = test_.Where(x => x.ToLower().Contains(".msk")).First(); //string rat = test_.Where(x => x.ToLower().Contains(".rat")).First(); //string pmd = test_.Where(x => x.ToLower().Contains(".pmd")).First(); //string sfx = test_.Where(x => x.ToLower().Contains(".sfx")).First(); //byte[] mchb = ArchiveWorker.FileInTwoArchives(fi, fs, fl, mch); //Field character models //byte[] oneb = ArchiveWorker.FileInTwoArchives(fi, fs, fl, one); //Field character models container //byte[] msdb = ArchiveWorker.FileInTwoArchives(fi, fs, fl, msd); //dialogs //byte[] infb = ArchiveWorker.FileInTwoArchives(fi, fs, fl, inf); //gateways //byte[] idb = ArchiveWorker.FileInTwoArchives(fi, fs, fl, id); //walkmesh //byte[] cab = ArchiveWorker.FileInTwoArchives(fi, fs, fl, ca); //camera //byte[] tdwb = ArchiveWorker.FileInTwoArchives(fi, fs, fl, tdw); //extra font //byte[] mskb = ArchiveWorker.FileInTwoArchives(fi, fs, fl, msk); //movie cam //byte[] ratb = ArchiveWorker.FileInTwoArchives(fi, fs, fl, rat); //battle on field //byte[] pmdb = ArchiveWorker.FileInTwoArchives(fi, fs, fl, pmd); //particle info //byte[] sfxb = ArchiveWorker.FileInTwoArchives(fi, fs, fl, sfx); //sound effects mod++; return; }
public static IReadOnlyDictionary <Abilities, Equipable_Ability> EquipableAbilities => s_equipableAbilities; // contains 4 types; /// <summary> /// Read binary data from into structures and arrays /// </summary> /// <see cref="http://forums.qhimm.com/index.php?topic=16923.msg240609#msg240609"/> /// <seealso cref="https://github.com/alexfilth/doomtrain"/> /// <seealso cref="https://github.com/alexfilth/doomtrain/wiki/Kernel.bin"/> public Kernel_bin() { Memory.Log.WriteLine($"{nameof(Kernel_bin)} :: new "); aw = new ArchiveWorker(ArchiveString); byte[] buffer = aw.GetBinaryFile(Memory.Strings[Strings.FileID.KERNEL].GetFilenames()[0]); List <Loc> subPositions = Memory.Strings[Strings.FileID.KERNEL].GetFiles().subPositions; MemoryStream ms = null; if (buffer != null) { using (BinaryReader br = new BinaryReader(ms = new MemoryStream(buffer))) { ms.Seek(subPositions[Battle_Commands.id], SeekOrigin.Begin); s_battleCommands = Battle_Commands.Read(br); ms.Seek(subPositions[Magic_Data.id], SeekOrigin.Begin); s_magicData = Magic_Data.Read(br); ms.Seek(subPositions[Junctionable_GFs_Data.id], SeekOrigin.Begin); s_junctionableGFsData = Junctionable_GFs_Data.Read(br); ms.Seek(subPositions[Enemy_Attacks_Data.id], SeekOrigin.Begin); s_enemyAttacksData = Enemy_Attacks_Data.Read(br); ms.Seek(subPositions[Weapons_Data.id], SeekOrigin.Begin); s_weaponsData = Weapons_Data.Read(br); ms.Seek(subPositions[Renzokuken_Finishers_Data.id], SeekOrigin.Begin); s_renzokukenFinishersData = Renzokuken_Finishers_Data.Read(br); ms.Seek(subPositions[Character_Stats.id], SeekOrigin.Begin); s_characterStats = Character_Stats.Read(br); ms.Seek(subPositions[Battle_Items_Data.id], SeekOrigin.Begin); s_battleItemsData = Battle_Items_Data.Read(br); s_nonbattleItemsData = Non_battle_Items_Data.Read(); ms.Seek(subPositions[Non_Junctionable_GFs_Attacks_Data.id], SeekOrigin.Begin); s_nonJunctionableGFsAttacksData = Non_Junctionable_GFs_Attacks_Data.Read(br); ms.Seek(subPositions[Command_ability_data.id], SeekOrigin.Begin); s_commandabilitydata = Command_ability_data.Read(br); ms.Seek(subPositions[Junction_abilities.id], SeekOrigin.Begin); s_junctionabilities = Junction_abilities.Read(br); ms.Seek(subPositions[Command_abilities.id], SeekOrigin.Begin); s_commandabilities = Command_abilities.Read(br); ms.Seek(subPositions[Stat_percent_abilities.id], SeekOrigin.Begin); s_statpercentabilities = Stat_percent_abilities.Read(br); ms.Seek(subPositions[Character_abilities.id], SeekOrigin.Begin); s_characterabilities = Character_abilities.Read(br); ms.Seek(subPositions[Party_abilities.id], SeekOrigin.Begin); s_partyabilities = Party_abilities.Read(br); ms.Seek(subPositions[GF_abilities.id], SeekOrigin.Begin); s_gFabilities = GF_abilities.Read(br); ms.Seek(subPositions[Menu_abilities.id], SeekOrigin.Begin); s_menuabilities = Menu_abilities.Read(br); ms.Seek(subPositions[Temporary_character_limit_breaks.id], SeekOrigin.Begin); s_temporarycharacterlimitbreaks = Temporary_character_limit_breaks.Read(br); ms.Seek(subPositions[Blue_magic_Quistis_limit_break.id], SeekOrigin.Begin); s_bluemagicQuistislimitbreak = Blue_magic_Quistis_limit_break.Read(br); //ms.Seek(subPositions[Quistis_limit_break_parameters.id], SeekOrigin.Begin); //Quistislimitbreakparameters = Quistis_limit_break_parameters.Read(br); ms.Seek(subPositions[Shot_Irvine_limit_break.id], SeekOrigin.Begin); s_shotIrvinelimitbreak = Shot_Irvine_limit_break.Read(br); ms.Seek(subPositions[Duel_Zell_limit_break.id], SeekOrigin.Begin); s_duelZelllimitbreak = Duel_Zell_limit_break.Read(br); ms.Seek(subPositions[Zell_limit_break_parameters.id], SeekOrigin.Begin); s_zelllimitbreakparameters = Zell_limit_break_parameters.Read(br); ms.Seek(subPositions[Rinoa_limit_breaks_part_1.id], SeekOrigin.Begin); s_rinoalimitbreakspart1 = Rinoa_limit_breaks_part_1.Read(br); ms.Seek(subPositions[Rinoa_limit_breaks_part_2.id], SeekOrigin.Begin); s_rinoalimitbreakspart2 = Rinoa_limit_breaks_part_2.Read(br); ms.Seek(subPositions[Slot_array.id], SeekOrigin.Begin); s_slotarray = Slot_array.Read(br); ms.Seek(subPositions[Selphie_limit_break_sets.id], SeekOrigin.Begin); s_selphielimitbreaksets = Selphie_limit_break_sets.Read(br); ms.Seek(subPositions[Devour.id], SeekOrigin.Begin); s_devour_ = Devour.Read(br); s_devour_.Add(new Devour { Description = Memory.Strings.Read(Strings.FileID.KERNEL, 30, 112) }); ms.Seek(subPositions[Misc_section.id], SeekOrigin.Begin); s_miscsection = Misc_section.Read(br); s_misctextpointers = Misc_text_pointers.Read(); s_allAbilities = new Dictionary <Abilities, Ability>( Menu_abilities.count + Junction_abilities.count + Command_abilities.count + Stat_percent_abilities.count + Character_abilities.count + Party_abilities.count + GF_abilities.count); foreach (Abilities ability in (Abilities[])(Enum.GetValues(typeof(Abilities)))) { combine(Menuabilities); combine(Statpercentabilities); combine(Junctionabilities); combine(Commandabilities); combine(Characterabilities); combine(Partyabilities); combine(GFabilities); bool combine <T>(IReadOnlyDictionary <Abilities, T> dict) where T : Ability { if (dict.TryGetValue(ability, out T a)) { s_allAbilities.Add(ability, a); return(true); } return(false); } } s_equipableAbilities = new Dictionary <Abilities, Equipable_Ability>( Stat_percent_abilities.count + Character_abilities.count + Party_abilities.count + GF_abilities.count); foreach (Abilities ability in (Abilities[])(Enum.GetValues(typeof(Abilities)))) { if (Statpercentabilities.ContainsKey(ability)) { s_equipableAbilities[ability] = Statpercentabilities[ability]; } else if (Characterabilities.ContainsKey(ability)) { s_equipableAbilities[ability] = Characterabilities[ability]; } else if (Partyabilities.ContainsKey(ability)) { s_equipableAbilities[ability] = Partyabilities[ability]; } else if (Characterabilities.ContainsKey(ability)) { s_equipableAbilities[ability] = Characterabilities[ability]; } } ms = null; } } }
/// <summary> /// Generate archive worker and get file /// </summary> /// <param name="archive">which archive you want to read from</param> /// <param name="fileName">name of file you want to recieve</param> /// <returns>Uncompressed binary file data</returns> public static byte[] GetBinaryFile(Memory.Archive archive, string fileName) { ArchiveWorker tmp = new ArchiveWorker(archive, true); return(tmp.GetBinaryFile(fileName)); }