public byte[] Serialize() { List <byte> Serialized = new List <byte>((int)Header.Filesize); Serialized.AddRange(System.BitConverter.GetBytes(EndianUtils.SwapEndian(Header.Identify))); Serialized.AddRange(System.BitConverter.GetBytes(EndianUtils.SwapEndian(Header.Filesize))); Serialized.AddRange(System.BitConverter.GetBytes(EndianUtils.SwapEndian(Header.Lines))); Serialized.AddRange(System.BitConverter.GetBytes(EndianUtils.SwapEndian(Header.Unknown))); Serialized.AddRange(System.BitConverter.GetBytes(EndianUtils.SwapEndian(Header.TextStart))); Serialized.AddRange(System.BitConverter.GetBytes(EndianUtils.SwapEndian(Header.Empty))); foreach (ChatFileLine Line in Lines) { Serialized.AddRange(System.BitConverter.GetBytes(EndianUtils.SwapEndian((uint)Line.NamePointer))); Serialized.AddRange(System.BitConverter.GetBytes(EndianUtils.SwapEndian((uint)Line.ENG))); Serialized.AddRange(System.BitConverter.GetBytes(EndianUtils.SwapEndian((uint)Line.ENG))); Serialized.AddRange(System.BitConverter.GetBytes(EndianUtils.SwapEndian(Line.Unknown))); } byte ByteNull = 0x00; foreach (ChatFileLine Line in Lines) { Serialized.AddRange(TextUtils.StringToBytesShiftJis(Line.SName)); Serialized.Add(ByteNull); Serialized.AddRange(TextUtils.StringToBytesShiftJis(Line.SENG)); Serialized.Add(ByteNull); } return(Serialized.ToArray()); }
public FontInfo(byte[] File, int Offset) { CharacterLengths = new int[0x220]; for (int i = 0; i < 0x220; i++) { CharacterLengths[i] = EndianUtils.SwapEndian(BitConverter.ToInt32(File, Offset + i * 4)); } BuildCharacterMap(); }
public void WriteCharacterLengths(String Filename, int Offset) { byte[] File = System.IO.File.ReadAllBytes(Filename); for (int i = 0; i < CharacterLengths.Length; i++) { int c = EndianUtils.SwapEndian(CharacterLengths[i]); byte[] b = BitConverter.GetBytes(c); b.CopyTo(File, Offset + i * 4); } System.IO.File.WriteAllBytes(Filename, File); }
private void Initialize(byte[] file) { this.File = file; CreditInfoStartOffset = EndianUtils.SwapEndian(BitConverter.ToUInt32(file, 0x24)); CreditInfoCount = EndianUtils.SwapEndian(BitConverter.ToUInt32(file, (int)CreditInfoStartOffset)); CreditInfoCount = 2995; // PS3 // not accurate in file...? //CreditInfoCount = 0x1ACE8 / 40; // 360 items = new List <CreditsInfoSingle>((int)CreditInfoCount); for (int i = 0; i < CreditInfoCount; ++i) { items.Add(new CreditsInfoSingle(this, (int)CreditInfoStartOffset + 4 + i * 40, file)); } }
public byte[] Serialize() { List <byte> Serialized = new List <byte>(0x20); Serialized.AddRange(System.BitConverter.GetBytes(EndianUtils.SwapEndian(Magic))); Serialized.AddRange(System.BitConverter.GetBytes(EndianUtils.SwapEndian(CodeStart))); Serialized.AddRange(System.BitConverter.GetBytes(EndianUtils.SwapEndian(CodeLength))); Serialized.AddRange(System.BitConverter.GetBytes(EndianUtils.SwapEndian(TextStart))); Serialized.AddRange(System.BitConverter.GetBytes(EndianUtils.SwapEndian(EntryCodeStart))); Serialized.AddRange(System.BitConverter.GetBytes(EndianUtils.SwapEndian(EntryPointerEnd))); Serialized.AddRange(System.BitConverter.GetBytes(EndianUtils.SwapEndian(TextLength))); Serialized.AddRange(System.BitConverter.GetBytes(EndianUtils.SwapEndian(SectorSize))); return(Serialized.ToArray()); }
public TownMapInfo(byte[] File, int TilesLocationJPN, int TilesLocationENG, int InfoLocation) { Filename = TextUtils.GetTextAscii(File, InfoLocation); this.InfoLocation = InfoLocation; TileAmountJPN = EndianUtils.SwapEndian(BitConverter.ToInt32(File, InfoLocation + 0xA4)); TileAmountENG = EndianUtils.SwapEndian(BitConverter.ToInt32(File, InfoLocation + 0xA8)); TownMapTilesJPN = new TownMapTile[TileAmountJPN]; TownMapTilesENG = new TownMapTile[TileAmountENG]; for (int i = 0; i < TileAmountJPN; i++) { TownMapTilesJPN[i] = new TownMapTile(File, TilesLocationJPN + (i * 0x20)); } for (int i = 0; i < TileAmountENG; i++) { TownMapTilesENG[i] = new TownMapTile(File, TilesLocationENG + (i * 0x20)); } }