Exemple #1
0
        public override void Read(BinaryReader file, uint size)
        {
            base.Read(file, size);

            unk.Read(file, 4);
            MipsCount.Read(file, 4);

            // Imported and Cooked xbms have a different file structure.
            // Imported xbms can be identified by their Sourcedata being not null
            var SourceData = this.GetVariableByName("sourceData");

            if (SourceData != null)
            {
                //dbg
                var ResidentMipIndex = this.GetVariableByName("residentMipIndex");
                if (ResidentMipIndex != null)
                {
                    throw new NotImplementedException();
                }

                for (int i = 0; i < MipsCount.val; i++)
                {
                    var mipdata = new SMipData(cr2w);
                    mipdata.Read(file, 16);
                    Mipdata.AddVariable(mipdata);

                    var img = new CByteArray(cr2w);
                    //img.SetParent(this);
                    img.Read(file, 0);
                    Mips.AddVariable(img);
                }
                unk2.Read(file, 4);
            }
            else
            {
                //if (ResidentMipIndex == null)
                //throw new NotImplementedException();


                Mipdata.Read(file, size, (int)MipsCount.val);

                ResidentmipSize.Read(file, 4);

                unk2.Read(file, 4);

                //Residentmip.SetParent(this);
                Residentmip.Read(file, ResidentmipSize.val);
            }

            //if (MipsCount.val > 0)
            //    mips.Read(file, size, (int)MipsCount.val);
            //else
            //    mips.Read(file, size, 1);

            //ResidentmipSize.Read(file, 4);
            //unk2.Read(file, 4);

            //Residentmip.Bytes = file.ReadBytes((int)ResidentmipSize.val);
        }
Exemple #2
0
 public override void Read(BinaryReader file, uint size)
 {
     offset.Read(file, 16);
     count.Read(file, 4);
     nullbytes.Read(file, 4);
     groupIdx.Read(file, 4);
 }
 public override void Read(BinaryReader file, uint size)
 {
     startingIndex.Read(file, size);
     endingIndex.Read(file, size);
     chunkIndex.Read(file, size);
     boneIndex.Read(file, size);
 }
        public override void Read(BinaryReader file, uint size)
        {
            base.Read(file, size);

            unk1.Read(file, 0);
            animevents.Read(file, 0);
        }
        public override void Read(BinaryReader file, uint size)
        {
            //Read the 8 unknown bytes.
            Unknown1.Read(file, 4);
            Unknown2.Read(file, 4);

            //Read the resources list.
            var numresources = file.ReadVLQInt32();

            for (int i = 0; i < numresources; i++)
            {
                var temp = new CSectorDataResource(cr2w);
                temp.Read(file, 24);
                Resources.AddVariable(temp);
            }

            //Read the Objects list.
            var numobjects = file.ReadVLQInt32();

            for (int i = 0; i < numobjects; i++)
            {
                var temp = new CSectorDataObject(cr2w);
                temp.Read(file, 32);
                Objects.AddVariable(temp);
            }

            //Read the data block.
            var datasize = file.ReadVLQInt32();

            BlockData.Bytes = file.ReadBytes(datasize);
        }
Exemple #6
0
 public override void Read(BinaryReader file, uint size)
 {
     time.Read(file, size);
     value.Read(file, size);
     controlPoint1.Read(file, size);
     controlPoint2.Read(file, size);
     curveTypeL.Read(file, size);
     curveTypeR.Read(file, size);
     //unk3.Read(file, size);
     //unk4.Read(file, size);
 }
Exemple #7
0
        public override void Read(BinaryReader file, uint size)
        {
            rotationMatrix.Read(file, 36);
            position.Read(file, (uint)12);
            streamingRadius.Read(file, 2);
            flags.Read(file, 2);
            occlusionSystemID.Read(file, 4);
            resourceIndex.Read(file, 4);

            tail.Read(file, size - 60);
        }
        public override void Read(BinaryReader file, uint size)
        {
            var startpos = file.BaseStream.Position;

            Unk1.Read(file, 4);
            Collisiontypes.Read(file, 0);

            var endpos = file.BaseStream.Position;

            Data.Read(file, (uint)(size - (endpos - startpos)));
        }
Exemple #9
0
        public override void Read(BinaryReader file, uint size)
        {
            base.Read(file, size);

            unk.Read(file, 4);
            mips.Read(file, size);
            filesize.Read(file, 4);
            unk2.Read(file, 4);


            Image.Bytes = file.ReadBytes((int)filesize.val);
        }
Exemple #10
0
        public override void Read(BinaryReader file, uint size)
        {
            base.Read(file, size);
            swfResource.Read(file, size);
            unk1.Read(file, 0);

            //dbg
            if (unk1.val > 0)
            {
                throw new NotImplementedException();
            }
        }
        public override void Read(BinaryReader file, uint size)
        {
            base.Read(file, size);

            unk1.Read(file, 0);

            //dbg
            if (unk1.val > 0)
            {
                //Debugger.Break();
            }
        }
Exemple #12
0
        public override void Read(BinaryReader file, uint size)
        {
            base.Read(file, size);

            unk1.Read(file, 0);

            //dbg
            if (unk1.val > 0)
            {
                Debugger.Break();
                throw new NotImplementedException();
            }
        }
Exemple #13
0
        public override void Read(BinaryReader file, uint size)
        {
            //Read the 8 unknown bytes.
            Unknown1.Read(file, 4);
            Unknown2.Read(file, 4);

            //Read the resources list.
            var numresources = file.ReadVLQInt32();

            for (int i = 0; i < numresources; i++)
            {
                var temp = new CSectorDataResource(cr2w);
                temp.Read(file, 24);
                Resources.AddVariable(temp);
            }

            //Read the Objects list.
            var numobjects = file.ReadVLQInt32();

            for (int i = 0; i < numobjects; i++)
            {
                var temp = new CSectorDataObject(cr2w);
                temp.Read(file, 32);
                Objects.AddVariable(temp);
            }

            // Read the data block.
            var datasize = file.ReadVLQInt32();

            BlockData.Bytes = file.ReadBytes(datasize);

            // add blockdata per object instead of in the end of the file
            // we do it after we read the array for easier writing
            for (int i = 0; i < numobjects; i++)
            {
                CSectorDataObject curobj = (CSectorDataObject)Objects.GetEditableVariables()[i];
                int curoffset            = int.Parse(curobj.offset.ToString());
                int nextoffset           = datasize;
                if (i != numobjects - 1)
                {
                    CSectorDataObject nextobj = (CSectorDataObject)Objects.GetEditableVariables()[i + 1];
                    nextoffset = int.Parse(nextobj.offset.ToString());
                }
                int length = nextoffset - curoffset;

                byte[] cutoutdata = new byte[length];
                Array.Copy(BlockData.Bytes, curoffset, cutoutdata, 0, length);

                curobj.blockdata.Bytes = cutoutdata;
            }
        }
Exemple #14
0
        public override void Read(BinaryReader file, uint size)
        {
            base.Read(file, size);

            //lazy check if Cvariable is first chunk (= resource) or derived
            if (ParentVar != null || this is CSkeletalAnimationSet)
            {
                return;
            }
            Unk1 = new CUInt32(cr2w, this, nameof(Unk1))
            {
                IsSerialized = true
            };
            Unk1.Read(file, size);
        }
Exemple #15
0
        public override void Read(BinaryReader file, uint size)
        {
            base.Read(file, size);

            texturecachekey.Read(file, 4);
            residentmip.Read(file, 2);
            encodedformat.Read(file, 2);
            edge.Read(file, 2);
            mipmapscount.Read(file, 2);

            filesize.Read(file, 4);
            ffffffff.Read(file, 4);

            rawfile.Read(file, filesize.val);
        }
Exemple #16
0
        public override void Read(BinaryReader file, uint size)
        {
            base.Read(file, size);

            unk1.Read(file, 0);
            unk2.Read(file, 0);

            var elementcount = file.ReadBit6();

            for (var i = 0; i < elementcount; i++)
            {
                var handle = new CHandle(cr2w);
                handle.Read(file, 0);
                components.AddVariable(handle);
            }
        }
Exemple #17
0
        public override void Read(BinaryReader file, uint size)
        {
            base.Read(file, size);

            unk1.Read(file, 0);

            unk2.Read(file, 0);
            variables1.Read(file, 0);

            unk3.Read(file, 0);
            descriptions.Read(file, 0);

            unk4.Read(file, 0);
            vectorvariables1.Read(file, 0);

            unk5.Read(file, 0);
            variables2.Read(file, 0);

            unk6.Read(file, 0);
            vectorvariables2.Read(file, 0);
        }
        public override void Read(BinaryReader file, uint size)
        {
            base.Read(file, size);

            unk.Read(file, 4);
            MipsCount.Read(file, 4);

            if (MipsCount.val > 0)
            {
                mips.Read(file, size, (int)MipsCount.val);
            }
            else
            {
                mips.Read(file, size, 1);
            }

            filesize.Read(file, 4);
            unk2.Read(file, 4);

            Image.Bytes = file.ReadBytes((int)filesize.val);
        }
Exemple #19
0
        public override void Read(BinaryReader file, uint size)
        {
            //Read the 8 unknown bytes.
            Unknown1.Read(file, 4);
            Unknown2.Read(file, 4);

            Resources.Read(file, 0);
            Objects.Read(file, 0);

            // Read the data block.
            blocksize.Read(file, 0);

            for (int i = 0; i < Objects.elements.Count; i++)
            {
                CSectorDataObject curobj = (CSectorDataObject)Objects.GetEditableVariables()[i];

                ulong curoffset = curobj.offset.val;
                byte  type      = curobj.type.val;
                if (!(type == 0x1 || type == 0x2))
                {
                    //System.Diagnostics.Debugger.Break();
                    //throw new NotImplementedException();
                }

                ulong len;
                if (i < Objects.elements.Count - 1)
                {
                    CSectorDataObject nextobj    = (CSectorDataObject)Objects.GetEditableVariables()[i + 1];
                    ulong             nextoffset = nextobj.offset.val;
                    len = nextoffset - curoffset;
                }
                else
                {
                    len = (ulong)blocksize.val - curoffset;
                }
                var blockdata = new SBlockData(cr2w);
                blockdata.Read(file, (uint)len);
                BlockData.AddVariable(blockdata);
            }
        }
Exemple #20
0
        public override void Read(BinaryReader file, uint size)
        {
            base.Read(file, size);

            //components array

            /* this fails for (some) CLayer Entities
             * that have no components but still data behind their class
             * one possible solution: check if entity has children (tiresome)
             */

            unk1.Read(file, 0);
            unk2.Read(file, 0);

            var elementcount = file.ReadBit6();

            for (var i = 0; i < elementcount; i++)
            {
                var handle = new CHandle(cr2w);
                handle.Read(file, 0);
                components.AddVariable(handle);
            }
        }
Exemple #21
0
 public override void Read(BinaryReader file, uint size)
 {
     Width.Read(file, 4);
     Height.Read(file, 4);
     Blocksize.Read(file, 4);
 }
Exemple #22
0
 public override void Read(BinaryReader file, uint size)
 {
     key.Read(file, size);
     val.Read(file, size);
 }
Exemple #23
0
 public override void Read(BinaryReader file, uint size)
 {
     index.Read(file, 4);
     blendvalue.Read(file, 4);
 }