Example #1
0
            public virtual void Load(byte[] data, ref int offset)
            {
                Type      = FSHelpers.ReadString(data, offset, 4);
                ChunkSize = FSHelpers.Read32(data, offset + 4);

                _dataCopy = FSHelpers.ReadN(data, offset, ChunkSize);
            }
Example #2
0
            public void Load(byte[] data, ref int offset)
            {
                Magic      = FSHelpers.ReadString(data, 0, 4);
                Type       = FSHelpers.ReadString(data, 4, 4);
                FileSize   = FSHelpers.Read32(data, 8);
                ChunkCount = FSHelpers.Read32(data, 12);

                //Four variables are followed by an unused tag and some padding.
                offset += 32;
            }
Example #3
0
            public void Load(byte[] data, ref int offset)
            {
                NameOffset = FSHelpers.Read32(data, offset);
                Unknown1   = new Vector3(
                    FSHelpers.ConvertIEEE754Float((uint)FSHelpers.Read32(data, offset + 4)),
                    FSHelpers.ConvertIEEE754Float((uint)FSHelpers.Read32(data, offset + 8)),
                    FSHelpers.ConvertIEEE754Float((uint)FSHelpers.Read32(data, offset + 12)));
                Unknown2 = FSHelpers.Read32(data, offset + 16);
                Unknown3 = FSHelpers.Read32(data, offset + 20);
                Unknown4 = new Vector3(
                    FSHelpers.ConvertIEEE754Float((uint)FSHelpers.Read32(data, offset + 24)),
                    FSHelpers.ConvertIEEE754Float((uint)FSHelpers.Read32(data, offset + 28)),
                    FSHelpers.ConvertIEEE754Float((uint)FSHelpers.Read32(data, offset + 32)));
                Unknown5 = FSHelpers.Read32(data, (int)offset + 36);
                Unknown6 = FSHelpers.Read32(data, (int)offset + 40);
                Unknown7 = FSHelpers.Read32(data, (int)offset + 44);
                Unknown8 = FSHelpers.Read32(data, (int)offset + 48);

                Name = FSHelpers.ReadString(data, (int)NameOffset);

                offset += Size;
            }
Example #4
0
        public void Load(byte[] data)
        {
            int dataOffset = 0;

            var header = new Header();

            header.Load(data, ref dataOffset);

            for (int i = 0; i < header.ChunkCount; i++)
            {
                BaseChunk baseChunk;

                //Read the first four bytes to get the tag.
                string tagName = FSHelpers.ReadString(data, dataOffset, 4);

                switch (tagName)
                {
                case "INF1":
                    baseChunk = new InfoChunk();
                    Info      = baseChunk as InfoChunk;
                    break;

                case "VTX1":
                    baseChunk = new VertexChunk();
                    Vertexes  = baseChunk as VertexChunk;
                    break;

                case "EVP1":
                    baseChunk = new EnvelopeChunk();
                    Envelopes = baseChunk as EnvelopeChunk;
                    break;

                case "DRW1":
                    baseChunk = new DrawChunk();
                    Draw      = baseChunk as DrawChunk;
                    break;

                case "JNT1":
                    baseChunk = new JointChunk();
                    Joints    = baseChunk as JointChunk;
                    break;

                case "SHP1":
                    baseChunk = new ShapeChunk();
                    Shapes    = baseChunk as ShapeChunk;
                    break;

                case "TEX1":
                    baseChunk = new TextureChunk();
                    Textures  = baseChunk as TextureChunk;
                    break;

                case "MAT3":
                    baseChunk = new Material3Chunk();
                    Materials = baseChunk as Material3Chunk;
                    break;

                case "ANK1":
                default:
                    Console.WriteLine("Found unknown chunk {0}!", tagName);
                    baseChunk = new DefaultChunk();
                    break;
                }

                baseChunk.Load(data, ref dataOffset);
            }
        }
Example #5
0
 public string GetString(StringTableEntry entry)
 {
     return(FSHelpers.ReadString(_dataCopy, (int)_stringTableOffset + entry.StringOffset));
 }