public ParticleTexture(EndianBinaryReader er, out bool OK) { this.Type = er.ReadString(Encoding.ASCII, 4); if (this.Type != " TPS") { OK = false; } else { this.TextureInfo = er.ReadUInt16(); this.Width = (ushort)(8 << ((int)this.TextureInfo >> 4 & 15)); this.Height = (ushort)(8 << ((int)this.TextureInfo >> 8 & 15)); this.TextureFormat = (Graphic.GXTexFmt)((int)this.TextureInfo & 7); this.RepeatS = ((int)this.TextureInfo >> 12 & 1) == 1; this.RepeatT = ((int)this.TextureInfo >> 13 & 1) == 1; this.FlipS = ((int)this.TextureInfo >> 14 & 1) == 1; this.FlipT = ((int)this.TextureInfo >> 15 & 1) == 1; this.Unknown1 = er.ReadUInt16(); this.TextureDataLength = er.ReadUInt32(); this.PaletteOffset = er.ReadUInt32(); this.PaletteDataLength = er.ReadUInt32(); this.Unknown2 = er.ReadUInt32(); this.Unknown3 = er.ReadUInt32(); this.Unknown4 = er.ReadUInt32(); this.ImageData = er.ReadBytes((int)this.TextureDataLength); this.PaletteData = er.ReadBytes((int)this.PaletteDataLength); OK = true; } }
public BMDTexture(EndianBinaryReader er) { this.OffsetTexName = er.ReadUInt32(); long position1 = er.BaseStream.Position; er.BaseStream.Position = (long)this.OffsetTexName; this.Name = er.ReadStringNT(Encoding.ASCII); er.BaseStream.Position = position1; this.OffsetTexData = er.ReadUInt32(); this.TexDataSize = er.ReadUInt32(); this.Width = er.ReadUInt16(); this.Height = er.ReadUInt16(); this.texImageParam = er.ReadUInt32(); this.S = (ushort)(8U << (int)((this.texImageParam & 7340032U) >> 20)); this.T = (ushort)(8U << (int)((this.texImageParam & 58720256U) >> 23)); this.Fmt = (Graphic.GXTexFmt)((this.texImageParam & 469762048U) >> 26); this.TransparentColor = ((int)(this.texImageParam >> 29) & 1) == 1; long position2 = er.BaseStream.Position; er.BaseStream.Position = (long)this.OffsetTexData; this.Data = er.ReadBytes((int)this.TexDataSize); if (this.Fmt == Graphic.GXTexFmt.GX_TEXFMT_COMP4x4) { this.Data4x4 = er.ReadBytes((int)this.TexDataSize / 2); } er.BaseStream.Position = position2; }
public Palettedata(byte[] Palette, Graphic.GXTexFmt mode) { this.Header = new DataBlockHeader("TTLP", (uint)(24 + Palette.Length)); this.fmt = mode; this.bExtendedPlt = false; this.szByte = (uint)Palette.Length; this.pRawData = 16U; this.Data = Palette; }
public override void Read(EndianBinaryReader er) { this.texImageParam = er.ReadUInt32(); this.Offset = (uint)(((int)this.texImageParam & (int)ushort.MaxValue) << 3); this.S = (ushort)(8U << (int)((this.texImageParam & 7340032U) >> 20)); this.T = (ushort)(8U << (int)((this.texImageParam & 58720256U) >> 23)); this.Fmt = (Graphic.GXTexFmt)((this.texImageParam & 469762048U) >> 26); this.TransparentColor = ((int)(this.texImageParam >> 29) & 1) == 1; this.extraParam = er.ReadUInt32(); }
public Characterdata(byte[] data, int width, int height, Graphic.GXTexFmt fmt) { this.Header = new DataBlockHeader("RAHC", 0U); this.W = (ushort)(width / 8); this.H = (ushort)(height / 8); this.pixelFmt = fmt; this.mapingType = Graphic.GXOBJVRamModeChar.GX_OBJVRAMMODE_CHAR_2D; this.characterFmt = Graphic.NNSG2dCharacterFmt.NNS_G2D_CHARACTER_FMT_CHAR; this.szByte = (uint)data.Length; this.pRawData = 24U; this.Data = data; }
public Palettedata(EndianBinaryReader er, out bool OK) { bool OK1; this.Header = new DataBlockHeader(er, "TTLP", out OK1); if (!OK1) { OK = false; } else { this.fmt = (Graphic.GXTexFmt)er.ReadUInt32(); this.bExtendedPlt = er.ReadUInt32() == 1U; this.szByte = er.ReadUInt32(); this.pRawData = er.ReadUInt32(); this.Data = er.ReadBytes((int)this.Header.size - 24); OK = true; } }
public Characterdata(EndianBinaryReader er, out bool OK) { bool OK1; this.Header = new DataBlockHeader(er, "RAHC", out OK1); if (!OK1) { OK = false; } else { this.H = er.ReadUInt16(); this.W = er.ReadUInt16(); this.pixelFmt = (Graphic.GXTexFmt)er.ReadUInt32(); this.mapingType = (Graphic.GXOBJVRamModeChar)er.ReadUInt32(); this.characterFmt = (Graphic.NNSG2dCharacterFmt)er.ReadUInt32(); this.szByte = er.ReadUInt32(); this.pRawData = er.ReadUInt32(); this.Data = er.ReadBytes((int)this.szByte); OK = true; } }
public TEXHeader(EndianBinaryReader er, out bool OK) { this.Type = er.ReadString(Encoding.ASCII, 4); if (this.Type != "tex\0") { OK = false; } else { this.Unknown1 = er.ReadUInt16(); this.TextureFormat = (Graphic.GXTexFmt)er.ReadUInt16(); this.Width = (ushort)(8U << (int)er.ReadUInt16()); this.Height = (ushort)(8U << (int)er.ReadUInt16()); this.PaletteDataOffset = er.ReadUInt32(); this.PaletteDataSize = er.ReadUInt32(); this.NrPalettes = er.ReadUInt32(); this.TextureDataOffset = er.ReadUInt32(); this.TextureDataSize = er.ReadUInt32(); this.Texture4x4DataOffset = er.ReadUInt32(); this.Texture4x4DataSize = er.ReadUInt32(); OK = true; } }
public NCLR(byte[] Palette, Graphic.GXTexFmt mode) { this.Header = new FileHeader.HeaderInfo("RLCN", (ushort)1); this.PaletteData = new NCLR.Palettedata(Palette, mode); }
public NCGR(byte[] data, int width, int height, Graphic.GXTexFmt fmt) { this.Header = new FileHeader.HeaderInfo("RGCN", (ushort)1); this.CharacterData = new NCGR.Characterdata(data, width, height, fmt); }