Example #1
0
        public unsafe void ReadFromStream(Stream stream)
        {
            byte[] name = stream.EnsureRead(NameSize);
            fixed (byte* namePtr = &name[0])
                Name = new string((sbyte*)namePtr, 0, NameSize, YkdFile.NamesEncoding).TrimEnd('\0');

            Offsets = stream.ReadContent<YkdOffsets>();
            Frames = new YkdFrames[Offsets.Count];
            for (int i = 0; i < Frames.Length; i++)
                Frames[i] = stream.ReadContent<YkdFrames>();
        }
Example #2
0
        public void ReadFromStream(Stream stream)
        {
            BinaryReader br = new BinaryReader(stream);

            IsFirstBlock = stream.Position == YkdHeader.Size;

            Type = br.ReadUInt32();
            Index = br.ReadUInt32();
            AssociatedIndex = br.ReadUInt32();
            Unknown = br.ReadUInt32();

            for (int i = 0; i < TransformationMatrix.Length; i++)
                TransformationMatrix[i] = br.ReadBigInt32();

            Offsets = stream.ReadContent<YkdOffsets>();
            Entries = new YkdBlockEntry[Offsets.Count];
            for (int i = 0; i < Offsets.Count; i++)
            {
                stream.SetPosition(Offsets[i]);
                Entries[i] = stream.ReadContent<YkdBlockEntry>();
            }

            if (!IsFirstBlock)
            {
                switch (Type)
                {
                    case 0:
                        ZeroTail = stream.ReadContent<YkdBlockOptionalTail>();
                        break;
                    case 4:
                        Tails4 = stream.ReadContent<YkdBlockOptionalTails>();
                        break;
                    case 5:
                    case 6:
                        Tail56 = new int[12];
                        for (int i = 0; i < Tail56.Length; i++)
                            Tail56[i] = br.ReadInt32();
                        break;
                }
            }
        }
Example #3
0
        public void ReadFromStream(Stream stream)
        {
            Offsets = stream.ReadContent<YkdOffsets>();

            Resources = new YkdResource[Offsets.Count];
            for (int i = 0; i < Resources.Length; i++)
            {
                YkdResource resource = Resources[i] = new YkdResource();

                stream.SetPosition(Offsets[i]);
                resource.ReadFromStream(stream);
            }

            if (!stream.IsEndOfStream())
                throw new InvalidDataException();
        }
Example #4
0
        public void ReadFromStream(Stream input)
        {
            BinaryReader br = new BinaryReader(input);

            Magic = br.ReadInt64();
            Unknown1 = br.ReadInt32();
            Unknown2 = br.ReadInt32();

            br.Read(UnknownBuff, 0, UnknownBuff.Length);

            Count = br.ReadInt32();
            Unknown3 = br.ReadInt32();
            Unknown4 = br.ReadInt32();
            Unknown5 = br.ReadInt32();

            Entries = input.ReadContent<SeDbResEntry>(Count);
        }
Example #5
0
 private static GtexData ReadGtexFromVtex(Stream headers)
 {
     VtexHeader textureHeader = headers.ReadContent<VtexHeader>();
     headers.Seek(textureHeader.GtexOffset - VtexHeader.Size, SeekOrigin.Current);
     return headers.ReadContent<GtexData>();
 }
Example #6
0
 private static GtexData ReadGtexFromTxb(Stream headers)
 {
     TextureHeader textureHeader = headers.ReadContent<TextureHeader>();
     return headers.ReadContent<GtexData>();
 }