public override void Read(string fileIn) { BinaryReader br = new BinaryReader(File.OpenRead(fileIn)); dsig = new sDSIG(); dsig.id = br.ReadChars(4); dsig.type = br.ReadByte(); if (dsig.type != 0x02) dsig.unk4 = br.ReadByte(); dsig.num_colors = br.ReadByte(); // Number of palettes of 16 colors dsig.unk1 = br.ReadByte(); dsig.unk2 = br.ReadUInt16(); dsig.unk3 = br.ReadUInt16(); ColorFormat depth = (dsig.unk1 == 0 ? ColorFormat.colors16 : ColorFormat.colors256); if (dsig.unk1 != 0) System.Windows.Forms.MessageBox.Show("Found different depth!"); TileForm form = (dsig.unk4 == 0x10 ? TileForm.Horizontal : TileForm.Lineal); Color[] colors = Actions.BGR555ToColor(br.ReadBytes(dsig.num_colors * 2)); palette = new RawPalette(colors, false, depth, FileName); byte[] tiles = br.ReadBytes((int)(br.BaseStream.Length - br.BaseStream.Position)); Set_Tiles(tiles, 0x100, 0xc0, depth, form, false); br.Close(); }
public override void Read(string fileIn) { BinaryReader br = new BinaryReader(File.OpenRead(fileIn)); dsig = new sDSIG(); dsig.id = br.ReadChars(4); dsig.type = br.ReadByte(); if (dsig.type != 0x02) { dsig.unk4 = br.ReadByte(); } dsig.num_colors = br.ReadByte(); // Number of palettes of 16 colors dsig.unk1 = br.ReadByte(); dsig.unk2 = br.ReadUInt16(); dsig.unk3 = br.ReadUInt16(); ColorFormat depth = (dsig.unk1 == 0 ? ColorFormat.colors16 : ColorFormat.colors256); if (dsig.unk1 != 0) { System.Windows.Forms.MessageBox.Show("Found different depth!"); } TileForm form = (dsig.unk4 == 0x10 ? TileForm.Horizontal : TileForm.Lineal); Color[] colors = Actions.BGR555ToColor(br.ReadBytes(dsig.num_colors * 2)); palette = new RawPalette(colors, false, depth, FileName); byte[] tiles = br.ReadBytes((int)(br.BaseStream.Length - br.BaseStream.Position)); Set_Tiles(tiles, 0x100, 0xc0, depth, form, false); br.Close(); }