protected override void Initialize() { FFmpeg.AutoGen.Example.FFmpegBinariesHelper.RegisterFFmpegBinaries(); Memory.graphics = graphics; Memory.spriteBatch = spriteBatch; Memory.content = Content; init_debugger_Audio.DEBUG(); //this initializes the DirectAudio, it's true that it gets loaded AFTER logo, but we will do the opposite init_debugger_Audio.DEBUG_SoundAudio(); //this initalizes the WAVE format audio.dat Init_debugger_fields.DEBUG(); //this initializes the field module, it's worth to have this at the beginning Init_debugger_battle.DEBUG(); //this initializes the encounters Memory.font = new Font(); //this initializes the fonts and drawing system- holds fonts in-memory ArchiveWorker aw = new ArchiveWorker(Memory.Archives.A_MENU); TEX tex = new TEX(ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU, aw.GetListOfFiles().First(x => x.ToLower().Contains("icon.tex")))); Memory.iconsTex = new Texture2D[tex.TextureData.NumOfPalettes]; for (int i = 0; i < Memory.iconsTex.Length; i++) { Memory.iconsTex[i] = tex.GetTexture(i); } Memory.FieldHolder.FieldMemory = new int[1024]; base.Initialize(); }
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 = 1, uint rows = 1, int pallet = -1) { 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(ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU, filename)); Init(filename, tex, cols, rows); } else { Init(filename, null, cols, rows); } }
internal 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")); string sysfnt00Filepath = aw.GetListOfFiles().First(x => x.ToLower().Contains("sysfnt00.tex")); TEX tex = new TEX(ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU, sysfntFilepath)); sysfnt = tex.GetTexture(); tex = new TEX(ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU, sysfnt00Filepath)); sysfnt00 = tex.GetTexture(); ReadTdw(ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU, sysfntTdwFilepath)); }
public void Init(string filename, TEX classic, uint cols = 1, uint rows = 1, int pallet = -1) { Classic = classic; Size = Vector2.Zero; Count = cols * rows; Textures = new Texture2D[cols, rows]; StartOffset = 0; Rows = rows; Cols = cols; Filename = filename; Pallet = pallet; //load textures; Init(); //unload Classic Classic = null; }
protected override void InitTextures(ArchiveWorker aw = null) { TEX tex; tex = new TEX(ArchiveWorker.GetBinaryFile(ArchiveString, aw.GetListOfFiles().First(x => x.IndexOf(TextureFilename[0], StringComparison.OrdinalIgnoreCase) >= 0))); Textures = new List <TextureHandler>(tex.TextureData.NumOfPalettes); for (int i = 0; i < tex.TextureData.NumOfPalettes; i++) { if (FORCE_ORIGINAL == false && TextureBigFilename != null && TextureBigSplit != null) { Textures.Add(new TextureHandler(TextureBigFilename[0], tex, 2, TextureBigSplit[0] / 2, i)); } else { Textures.Add(new TextureHandler(TextureFilename[0], tex, 1, 1, i)); } } }
public Faces() { if (entries == null) { ArchiveWorker aw = new ArchiveWorker(Memory.Archives.A_MENU); byte[] test = ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU, aw.GetListOfFiles().First(x => x.ToLower().Contains("face.sp2"))); using (MemoryStream ms = new MemoryStream(test)) { ushort[] locs; using (BinaryReader br = new BinaryReader(ms)) { ms.Seek(4, SeekOrigin.Begin); locs = new UInt16[32];//br.ReadUInt32(); 32 valid values in face.sp2 rest is invalid entries = new Entry[locs.Length]; for (int i = 0; i < locs.Length; i++) { locs[i] = br.ReadUInt16(); ms.Seek(2, SeekOrigin.Current); } byte fid = 0; for (int i = 0; i < locs.Length; i++) { entries[i] = new Entry(); fid = entries[i].LoadfromStreamSP2(br, locs[i], (byte)(i - 1 < 0 ? 0: entries[i - 1].Y), fid); } } } //using (FileStream fs = File.OpenWrite(Path.Combine("d:\\", "face.sp2"))) //{ // fs.Write(test, 0, test.Length); //} TEX tex; tex = new TEX(ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU, aw.GetListOfFiles().First(x => x.ToLower().Contains("face1.tex")))); faces[0] = tex.GetTexture(); tex = new TEX(ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU, aw.GetListOfFiles().First(x => x.ToLower().Contains("face2.tex")))); faces[1] = tex.GetTexture(); } }
protected virtual void InitTextures(ArchiveWorker aw = null) { if (Textures == null) { Textures = new List <TextureHandler>(TextureCount.Sum()); } if (Textures.Count <= 0) { if (aw == null) { aw = new ArchiveWorker(ArchiveString); } TEX tex; Scale = new Dictionary <uint, Vector2>(TextureCount.Sum()); int b = 0; for (int j = 0; j < TextureCount.Length; j++) { for (uint i = 0; i < TextureCount[j]; i++) { string path = aw.GetListOfFiles().First(x => x.ToLower().Contains(string.Format(TextureFilename[j], i + TextureStartOffset))); tex = new TEX(ArchiveWorker.GetBinaryFile(ArchiveString, path)); if (TextureBigFilename != null && FORCE_ORIGINAL == false && b < TextureBigFilename.Length && b < TextureBigSplit.Length) { TextureHandler th = new TextureHandler(TextureBigFilename[b], tex, 2, TextureBigSplit[b++] / 2); Textures.Add(th); Scale[i] = Vector2.One;//th.GetScale(); } else { TextureHandler th = new TextureHandler(path, tex); Textures.Add(th); Scale[i] = th.GetScale(); } } } } }
public TextureHandler(string filename, TEX classic, uint cols = 1, uint rows = 1, int pallet = -1) => Init(filename, classic, cols, rows, pallet);
public Icons() { if (entries == null) { ArchiveWorker aw = new ArchiveWorker(Memory.Archives.A_MENU); TEX tex; byte[] test = ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU, aw.GetListOfFiles().First(x => x.ToLower().Contains("icon.tex"))); tex = new TEX(test); PalletCount = tex.TextureData.NumOfPalettes; icons = new Texture2D[PalletCount]; for (int i = 0; i < PalletCount; i++) { icons[i] = tex.GetTexture(i); //using (FileStream fs = File.OpenWrite($"d:\\icons.{i}.png")) //{ // //fs.Write(test, 0, test.Length); // icons[i].SaveAsPng(fs, 256, 256); //} } test = ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU, aw.GetListOfFiles().First(x => x.ToLower().Contains("icon.sp1"))); //using (FileStream fs = File.OpenWrite(Path.Combine("d:\\", "icons.sp1"))) //{ // fs.Write(test, 0, test.Length); //} //read from icon.sp1 using (MemoryStream ms = new MemoryStream(test)) { using (BinaryReader br = new BinaryReader(ms)) { Count = br.ReadUInt32(); Loc[] locs = new Loc[Count]; for (int i = 0; i < Count; i++) { locs[i].pos = br.ReadUInt16(); locs[i].count = br.ReadUInt16(); //if (locs[i].count > 1) Count += (uint)(locs[i].count - 1); } entries = new Dictionary <ID, EntryGroup>((int)Count + 10); for (int i = 0; i < Count; i++) { ms.Seek(locs[i].pos, SeekOrigin.Begin); byte c = (byte)locs[i].count; 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); } } } //custom stuff not in sp1 Entry BG = new Entry { X = 0, Y = 48, Width = 256, Height = 16, CustomPallet = 1, Tile = Vector2.UnitY, }; Entry Border_TopLeft = new Entry { X = 16, Y = 0, Width = 8, Height = 8, CustomPallet = 0, }; Entry Border_Top = new Entry { X = 24, Y = 0, Width = 8, Height = 8, Tile = Vector2.UnitX, Offset_X = 8, Offset_X2 = -8, CustomPallet = 0 }; Entry Border_Bottom = new Entry { X = 24, Y = 16, Width = 8, Height = 8, Tile = Vector2.UnitX, Snap_Bottom = true, Offset_Y = -8, Offset_X = 8, Offset_X2 = -8, CustomPallet = 0 }; Entry Border_TopRight = new Entry { X = 32, Y = 0, Width = 8, Height = 8, Snap_Right = true, Offset_X = -8, CustomPallet = 0 }; Entry Border_Left = new Entry { X = 16, Y = 8, Width = 8, Height = 8, Tile = Vector2.UnitY, Offset_Y = 8, Offset_Y2 = -8, CustomPallet = 0 }; Entry Border_Right = new Entry { X = 32, Y = 8, Width = 8, Height = 8, Tile = Vector2.UnitY, Snap_Right = true, Offset_X = -8, Offset_Y = 8, Offset_Y2 = -8, CustomPallet = 0 }; Entry Border_BottomLeft = new Entry { X = 16, Y = 16, Width = 8, Height = 8, Snap_Bottom = true, Offset_Y = -8, CustomPallet = 0 }; Entry Border_BottomRight = new Entry { X = 32, Y = 16, Width = 8, Height = 8, Snap_Bottom = true, Snap_Right = true, Offset_X = -8, Offset_Y = -8, CustomPallet = 0 }; entries[ID.Bar_BG] = new EntryGroup(new Entry { X = 16, Y = 24, Width = 8, Height = 8, Tile = Vector2.UnitX, CustomPallet = 0 }); entries[ID.Bar_Fill] = new EntryGroup(new Entry { X = 0, Y = 16, Width = 8, Height = 8, Tile = Vector2.UnitX, Offset_Y = 1, CustomPallet = 5 }); entries[ID.Menu_BG_256] = new EntryGroup(BG, Border_Top, Border_Left, Border_Right, Border_Bottom, Border_TopLeft, Border_TopRight, Border_BottomLeft, Border_BottomRight); entries[ID.Menu_BG_368] = new EntryGroup(BG, new Entry { X = 0, Y = 64, Offset_X = 256, Width = 112, Height = 16, CustomPallet = 1, Tile = Vector2.UnitY }, Border_Top, Border_Left, Border_Right, Border_Bottom, Border_TopLeft, Border_TopRight, Border_BottomLeft, Border_BottomRight); Count = (uint)entries.Count; entries[ID.DEBUG] = new EntryGroup( new Entry { X = 128, Y = 24, Width = 7, Height = 8 }, new Entry { X = 65, Y = 8, Width = 6, Height = 8, Offset_X = 7 }, new Entry { X = 147, Y = 24, Width = 6, Height = 8, Offset_X = 13 }, new Entry { X = 141, Y = 24, Width = 6, Height = 8, Offset_X = 19 }, new Entry { X = 104, Y = 16, Width = 6, Height = 8, Offset_X = 25 } ); } } }