Example #1
0
 private static void ReadFRMS(tTexture lcTex, BinaryReader b)
 {
     int count = (int) (lcTex.Header.Width * lcTex.Header.Height);
     if ((lcTex.Header.Bits == 0) || (lcTex.Header.Bits == 2))
     {
         count *= 3;
     }
     else
     {
         count *= 4;
     }
     lcTex.imageData = new byte[lcTex.Header.MipMap][];
     for (int i = 0; i < lcTex.Header.MipMap; i++)
     {
         lcTex.imageData[i] = b.ReadBytes(count);
     }
 }
Example #2
0
 public static void ReadFile(string FileName)
 {
     Encoding encoding = Encoding.GetEncoding(0x4e3);
     FileStream input = new FileStream(FileName, FileMode.Open);
     BinaryReader b = new BinaryReader(input);
     lcTex = new tTexture();
     lcTex.Header = new tHeader();
     lcTex.Header.VersionChunk = b.ReadBytes(4);
     lcTex.Header.Version = b.ReadInt32();
     lcTex.Header.DataChunk = b.ReadBytes(4);
     lcTex.Header.Width = b.ReadUInt32() ^ 0x12143d3e;
     lcTex.Header.Shift = b.ReadUInt32() ^ 0x55578081;
     lcTex.Header.Height = b.ReadUInt32() ^ 0x989ac3c4;
     lcTex.Header.MipMap = b.ReadUInt32() ^ 0xdbdd0607;
     lcTex.Header.Bits = b.ReadUInt32() ^ 0x1e20494a;
     lcTex.Header.Unknown = b.ReadUInt32() ^ 0x61638c8d;
     lcTex.Header.Format = encoding.GetString(b.ReadBytes(4));
     lcTex.Header.AnimOffset = b.ReadInt32();
     lcTex.Header.Width = Shift(lcTex.Header.Width, lcTex.Header.Shift);
     lcTex.Header.Height = Shift(lcTex.Header.Height, lcTex.Header.Shift);
     if (lcTex.Header.Format == "FRMC")
     {
         ReadFRMC(lcTex, b);
     }
     else if (lcTex.Header.Format == "FRMS")
     {
         ReadFRMS(lcTex, b);
     }
     input.Close();
 }
Example #3
0
 private static void ReadFRMC(tTexture lcTex, BinaryReader b)
 {
     lcTex.imageData = new byte[lcTex.Header.MipMap][];
     for (int i = 0; i < lcTex.Header.MipMap; i++)
     {
         lcTex.imageData[i] = b.ReadBytes(b.ReadInt32());
     }
 }