Example #1
0
            public OverlayReference(int apiVersion, EventHandler handler, Stream s) : base(apiVersion, handler)
            {
                BinaryReader r = new BinaryReader(s);

                this.ageGender        = (AgeGenderFlags)r.ReadUInt32();
                this.textureReference = r.ReadUInt64();
            }
Example #2
0
 internal void UnParse(Stream s)
 {
     if (ageGender == null)
     {
         ageGender = new AgeGenderFlags(0, handler);
     }
     ageGender.UnParse(s);
     new BinaryWriter(s).Write((uint)facialRegion);
     if (lod1 == null)
     {
         lod1 = new LODSection(0, handler);
     }
     lod1.UnParse(s);
     if (lod2 == null)
     {
         lod2 = new LODSection(0, handler);
     }
     lod2.UnParse(s);
     if (lod3 == null)
     {
         lod3 = new LODSection(0, handler);
     }
     lod3.UnParse(s);
     if (lod4 == null)
     {
         lod4 = new LODSection(0, handler);
     }
     lod4.UnParse(s);
 }
Example #3
0
        void Parse(Stream s)
        {
            BinaryReader r = new BinaryReader(s);

            s.Position          = 0;
            this.version        = r.ReadUInt32();
            this.doubledWidth   = r.ReadUInt32();
            this.height         = r.ReadUInt32();
            this.ageGender      = (AgeGenderFlags)r.ReadUInt32();
            this.physique       = (Physiques)r.ReadByte();
            this.shapeOrNormals = (ShapeOrNormals)r.ReadByte();
            this.minCol         = r.ReadUInt32();
            this.maxCol         = r.ReadUInt32();
            this.minRow         = r.ReadUInt32();
            this.maxRow         = r.ReadUInt32();
            this.robeChannel    = (RobeChannel)r.ReadByte();
            int totalBytes = r.ReadInt32();

            if (totalBytes == 0)
            {
                this.scanLines = new ScanLine[0];
            }
            else
            {
                int  width        = (int)(maxCol - minCol + 1);
                uint numScanLines = maxRow - minRow + 1;
                this.scanLines = new ScanLine[numScanLines];
                for (int i = 0; i < numScanLines; i++)
                {
                    scanLines[i] = new ScanLine(recommendedApiVersion, OnResourceChanged, s, width);
                }
            }
        }
Example #4
0
            void Parse(Stream s)
            {
                BinaryReader r = new BinaryReader(s);

                ageGender = new AgeGenderFlags(0, handler, s);
                amount    = r.ReadSingle();
                index     = r.ReadInt32();
            }
Example #5
0
 public Entry(int APIversion, EventHandler handler, AgeGenderFlags ageGender, float amount, int index, DependentList <TGIBlock> ParentTGIBlocks = null)
     : base(APIversion, handler)
 {
     this.ParentTGIBlocks = ParentTGIBlocks;
     this.ageGender       = new AgeGenderFlags(0, handler, ageGender);
     this.amount          = amount;
     this.index           = index;
 }
Example #6
0
 void Parse(Stream s)
 {
     ageGender    = new AgeGenderFlags(0, handler, s);
     facialRegion = (FacialRegionFlags) new BinaryReader(s).ReadUInt32();
     lod1         = new LODSection(0, handler, s);
     lod2         = new LODSection(0, handler, s);
     lod3         = new LODSection(0, handler, s);
     lod4         = new LODSection(0, handler, s);
 }
Example #7
0
 public Section1Entry(int APIversion, EventHandler handler)
     : base(APIversion, handler)
 {
     ageGender = new AgeGenderFlags(requestedApiVersion, handler);
     lod1      = new LODSection(requestedApiVersion, handler);
     lod2      = new LODSection(requestedApiVersion, handler);
     lod3      = new LODSection(requestedApiVersion, handler);
     lod4      = new LODSection(requestedApiVersion, handler);
 }
Example #8
0
            internal void UnParse(Stream s)
            {
                BinaryWriter w = new BinaryWriter(s);

                if (ageGender == null)
                {
                    ageGender = new AgeGenderFlags(0, handler);
                }
                ageGender.UnParse(s);
                w.Write(amount);
                w.Write(index);
            }
Example #9
0
        void Parse(Stream s)
        {
            int tgiPosn;

            BinaryReader r = new BinaryReader(s);

            version               = r.ReadUInt32();
            tgiPosn               = r.ReadInt32() + 8;
            presets               = new PresetList(OnResourceChanged, s);
            unknown1              = BigEndianUnicodeString.Read(s);
            sortPriority          = r.ReadSingle();
            unknown2              = r.ReadByte();
            clothing              = (ClothingType)r.ReadUInt32();
            dataType              = (DataTypeFlags)r.ReadUInt32();
            ageGender             = new AgeGenderFlags(0, OnResourceChanged, s);
            clothingCategory      = (ClothingCategoryFlags)r.ReadUInt32();
            casPart1Index         = r.ReadByte();
            casPart2Index         = r.ReadByte();
            blendInfoFatIndex     = r.ReadByte();
            blendInfoFitIndex     = r.ReadByte();
            blendInfoThinIndex    = r.ReadByte();
            blendInfoSpecialIndex = r.ReadByte();
            overlayPriority       = r.ReadUInt32();
            vpxyIndexes           = new ByteIndexList(OnResourceChanged, s, ReadByte, WriteByte);
            lodInfo               = new LODInfoEntryList(OnResourceChanged, s);
            diffuse1Indexes       = new ByteIndexList(OnResourceChanged, s, ReadByte, WriteByte);
            specular1Indexes      = new ByteIndexList(OnResourceChanged, s, ReadByte, WriteByte);
            diffuse2Indexes       = new ByteIndexList(OnResourceChanged, s, ReadByte, WriteByte);
            specular2Indexes      = new ByteIndexList(OnResourceChanged, s, ReadByte, WriteByte);
            bondIndexes           = new ByteIndexList(OnResourceChanged, s, ReadByte, WriteByte);
            unknown4              = BigEndianUnicodeString.Read(s);

            if (checking)
            {
                if (tgiPosn != s.Position)
                {
                    throw new InvalidDataException(String.Format("Position of TGIBlock read: 0x{0:X8}, actual: 0x{1:X8}",
                                                                 tgiPosn, s.Position));
                }
            }

            byte count = r.ReadByte();

            tgiBlocks = new CountedTGIBlockList(OnResourceChanged, "IGT", count, s);

            vpxyIndexes.ParentTGIBlocks         = diffuse1Indexes.ParentTGIBlocks = specular1Indexes.ParentTGIBlocks =
                diffuse2Indexes.ParentTGIBlocks = specular2Indexes.ParentTGIBlocks = bondIndexes.ParentTGIBlocks = tgiBlocks;
        }
Example #10
0
        void Parse(Stream s)
        {
            BinaryReader r = new BinaryReader(s);

            s.Position               = 0;
            this.version             = r.ReadUInt32();
            this.ageGender           = (AgeGenderFlags)r.ReadUInt32();
            this.groupingID          = r.ReadUInt64();
            this.unknown1            = r.ReadByte();
            this.simOutfitReference  = r.ReadUInt64();
            this.textureReference    = r.ReadUInt64();
            this.simDataReference    = r.ReadUInt64();
            this.nameHash            = r.ReadUInt32();
            this.descHash            = r.ReadUInt32();
            this.unknown2            = new DataBlobHandler(recommendedApiVersion, OnResourceChanged, r.ReadBytes(14));
            this.unknown3            = r.ReadUInt32();
            this.animationReference1 = r.ReadUInt64();
            this.animationStateName1 = System.Text.Encoding.ASCII.GetString(r.ReadBytes(r.ReadInt32()));
            this.animationReference2 = r.ReadUInt64();
            this.animationStateName2 = System.Text.Encoding.ASCII.GetString(r.ReadBytes(r.ReadInt32()));
            this.colorList           = new CASPartResource.SwatchColorList(OnResourceChanged, s);
            this.flagList            = new CASPartResource.FlagList(OnResourceChanged, s);
        }
Example #11
0
 public Entry(int APIversion, EventHandler handler, DependentList <TGIBlock> ParentTGIBlocks = null)
     : base(APIversion, handler)
 {
     this.ParentTGIBlocks = ParentTGIBlocks;
     ageGender            = new AgeGenderFlags(requestedApiVersion, handler);
 }
Example #12
0
        void Parse(Stream s)
        {
            s.Position = 0;
            BinaryReader r = new BinaryReader(s);

            version     = r.ReadUInt32();
            tgiOffset   = r.ReadUInt32() + 8;
            presetCount = r.ReadUInt32();
            if (presetCount != 0)
            {
                throw new Exception("Found non-zero one");
            }
            name = BigEndianUnicodeString.Read(s);

            sortPriority            = r.ReadSingle();
            this.secondarySortIndex = r.ReadUInt16();
            propertyID                      = r.ReadUInt32();
            this.auralMaterialHash          = r.ReadUInt32();
            this.parmFlags                  = (ParmFlag)r.ReadByte();
            this.excludePartFlags           = (ExcludePartFlag)r.ReadUInt64();
            this.excludeModifierRegionFlags = r.ReadUInt32();

            flagList = new FlagList(OnResourceChanged, s);

            this.simlolencePrice    = r.ReadUInt32();
            this.partTitleKey       = r.ReadUInt32();
            this.partDesptionKey    = r.ReadUInt32();
            this.uniqueTextureSpace = r.ReadByte();
            this.bodyType           = r.ReadInt32();
            this.unused1            = r.ReadInt32();
            this.ageGender          = (AgeGenderFlags)r.ReadUInt32();
            this.unused2            = r.ReadByte();
            this.unused3            = r.ReadByte();

            swatchColorCode = new SwatchColorList(OnResourceChanged, s);

            this.buffResKey          = r.ReadByte();
            this.varientThumbnailKey = r.ReadByte();
            if (this.version >= 0x1C)
            {
                this.voiceEffectHash = r.ReadUInt64();
            }
            this.nakedKey  = r.ReadByte();
            this.parentKey = r.ReadByte();
            this.sortLayer = r.ReadInt32();

            // Don't move any of this before the -----
            // TGI block list
            long currentPosition = r.BaseStream.Position;

            r.BaseStream.Position = tgiOffset;
            byte count4 = r.ReadByte();

            tgiList = new CountedTGIBlockList(OnResourceChanged, "IGT", count4, s);
            r.BaseStream.Position = currentPosition;
            lodBlockList          = new LODBlockList(null, s, tgiList);
            //-------------

            byte count = r.ReadByte();

            this.slotKey = new SimpleList <byte>(null);
            for (byte i = 0; i < count; i++)
            {
                this.slotKey.Add(r.ReadByte());
            }

            this.diffuseShadowKey  = r.ReadByte();
            this.shadowKey         = r.ReadByte();
            this.compositionMethod = r.ReadByte();
            this.regionMapKey      = r.ReadByte();
            this.overrides         = r.ReadByte();
            this.normalMapKey      = r.ReadByte();
            this.specularMapKey    = r.ReadByte();
            if (this.version >= 0x1B)
            {
                this.sharedUVMapSpace = r.ReadUInt32();
            }
        }
Example #13
0
        protected override Stream UnParse()
        {
            long         posn, tgiPosn, end;
            MemoryStream s = new MemoryStream();
            BinaryWriter w = new BinaryWriter(s);

            w.Write(version);
            posn = s.Position;
            w.Write((int)0); //offset

            if (presets == null)
            {
                presets = new PresetList(OnResourceChanged);
            }
            presets.UnParse(s);

            BigEndianUnicodeString.Write(s, unknown1);
            w.Write(sortPriority);
            w.Write(unknown2);
            w.Write((uint)clothing);
            w.Write((uint)dataType);
            if (ageGender == null)
            {
                ageGender = new AgeGenderFlags(0, OnResourceChanged);
            }
            ageGender.UnParse(s);
            w.Write((uint)clothingCategory);
            w.Write(casPart1Index);
            w.Write(casPart2Index);
            w.Write(blendInfoFatIndex);
            w.Write(blendInfoFitIndex);
            w.Write(blendInfoThinIndex);
            w.Write(blendInfoSpecialIndex);
            w.Write(overlayPriority);

            if (tgiBlocks == null)
            {
                tgiBlocks = new CountedTGIBlockList(OnResourceChanged, "IGT");
            }
            if (vpxyIndexes == null)
            {
                vpxyIndexes = new ByteIndexList(OnResourceChanged, ReadByte, WriteByte, byte.MaxValue, tgiBlocks);
            }
            vpxyIndexes.UnParse(s);
            if (lodInfo == null)
            {
                lodInfo = new LODInfoEntryList(OnResourceChanged);
            }
            lodInfo.UnParse(s);
            if (diffuse1Indexes == null)
            {
                diffuse1Indexes = new ByteIndexList(OnResourceChanged, ReadByte, WriteByte, byte.MaxValue, tgiBlocks);
            }
            diffuse1Indexes.UnParse(s);
            if (specular1Indexes == null)
            {
                specular1Indexes = new ByteIndexList(OnResourceChanged, ReadByte, WriteByte, byte.MaxValue, tgiBlocks);
            }
            specular1Indexes.UnParse(s);
            if (diffuse2Indexes == null)
            {
                diffuse2Indexes = new ByteIndexList(OnResourceChanged, ReadByte, WriteByte, byte.MaxValue, tgiBlocks);
            }
            diffuse2Indexes.UnParse(s);
            if (specular2Indexes == null)
            {
                specular2Indexes = new ByteIndexList(OnResourceChanged, ReadByte, WriteByte, byte.MaxValue, tgiBlocks);
            }
            specular2Indexes.UnParse(s);
            if (bondIndexes == null)
            {
                bondIndexes = new ByteIndexList(OnResourceChanged, ReadByte, WriteByte, byte.MaxValue, tgiBlocks);
            }
            bondIndexes.UnParse(s);
            BigEndianUnicodeString.Write(s, unknown4);

            tgiPosn = s.Position;
            w.Write((byte)tgiBlocks.Count);
            tgiBlocks.UnParse(s);

            end = s.Position;

            s.Position = posn;
            w.Write((int)(tgiPosn - posn - sizeof(int)));
            s.Position = end;

            vpxyIndexes.ParentTGIBlocks         = diffuse1Indexes.ParentTGIBlocks = specular1Indexes.ParentTGIBlocks =
                diffuse2Indexes.ParentTGIBlocks = specular2Indexes.ParentTGIBlocks = bondIndexes.ParentTGIBlocks = tgiBlocks;

            s.Flush();
            return(s);
        }
        public void Parse(Stream s)
        {
            s.Position = 0;
            BinaryReader r = new BinaryReader(s);

            this.version = r.ReadUInt32();
            uint tgiOffset = r.ReadUInt32() + 8;

            // get TGI list
            long tempPosition = s.Position;

            s.Position = tgiOffset;
            TGIBlock[] _tgilist = new TGIBlock[r.ReadByte()];
            for (int i = 0; i < _tgilist.Length; i++)
            {
                _tgilist[i] = new TGIBlock(1, OnResourceChanged, "IGT", s);
            }
            this.tgiList = new CountedTGIBlockList(OnResourceChanged, _tgilist);
            s.Position   = tempPosition;

            this.unknown1 = r.ReadSingle();
            this.unknown2 = r.ReadSingle();
            this.unknown3 = r.ReadSingle();
            this.unknown4 = r.ReadSingle();
            this.unknown5 = r.ReadSingle();
            this.unknown6 = r.ReadSingle();
            this.unknown7 = r.ReadSingle();
            this.unknown8 = r.ReadSingle();

            this.age               = (AgeGenderFlags)r.ReadUInt32();
            this.gender            = (AgeGenderFlags)r.ReadUInt32();
            this.skinToneReference = r.ReadUInt64();

            byte[] unknown18 = new byte[r.ReadByte()];
            for (int i = 0; i < unknown18.Length; i++)
            {
                unknown18[i] = r.ReadByte();
            }
            this.unknown9 = new ByteIndexList(OnResourceChanged, unknown18, this.tgiList);

            sliderReferences1 = new SliderReferenceList(OnResourceChanged, s, tgiList);
            sliderReferences2 = new SliderReferenceList(OnResourceChanged, s, tgiList);

            this.unknown10 = new DataBlobHandler(RecommendedApiVersion, OnResourceChanged, r.ReadBytes(24));
            this.unknown11 = new UnknownBlockList(OnResourceChanged, s, this.tgiList);

            this.unknownByteList = new SimpleList <byte>(OnResourceChanged);
            int count1 = r.ReadByte();

            for (int i = 0; i < count1; i++)
            {
                this.unknownByteList.Add(r.ReadByte());
            }

            sliderReferences3 = new SliderReferenceList(OnResourceChanged, s, tgiList);
            sliderReferences4 = new SliderReferenceList(OnResourceChanged, s, tgiList);

            this.unknown12         = new DataBlobHandler(RecommendedApiVersion, OnResourceChanged, r.ReadBytes(16));
            this.sliderReferences5 = new SliderReferenceList(OnResourceChanged, s, tgiList);
            this.unknown13         = new DataBlobHandler(recommendedApiVersion, OnResourceChanged, r.ReadBytes(9));
            this.caspReference     = r.ReadUInt64();
            this.dataReferenceList = new SimpleList <ulong>(OnResourceChanged);
            int count2 = r.ReadByte();

            for (int i = 0; i < count2; i++)
            {
                this.dataReferenceList.Add(r.ReadUInt64());
            }
        }
Example #15
0
        private void Parse(Stream s)
        {
            s.Position = 0;
            var r = new BinaryReader(s);

            this.version     = r.ReadUInt32();
            this.TGIoffset   = r.ReadUInt32() + 8;
            this.presetCount = r.ReadUInt32();
            if (this.presetCount != 0)
            {
                throw new Exception("Found non-zero one");
            }
            this.name = BigEndianUnicodeString.Read(s);

            this.sortPriority       = r.ReadSingle();
            this.secondarySortIndex = r.ReadUInt16();
            this.propertyID         = r.ReadUInt32();
            this.auralMaterialHash  = r.ReadUInt32();
            this.parmFlags          = (ParmFlag)r.ReadByte();
            this.excludePartFlags   = (ExcludePartFlag)r.ReadUInt64();
            if (this.version >= 36)
            {
                this.excludeModifierRegionFlags = r.ReadUInt64();
            }
            else
            {
                this.excludeModifierRegionFlags = r.ReadUInt32();
            }

            if (this.version >= 37)
            {
                this.flagList = new FlagList(this.OnResourceChanged, s);
            }
            else
            {
                this.flagList = FlagList.CreateWithUInt16Flags(this.OnResourceChanged, s, recommendedApiVersion);
            }

            this.deprecatedPrice    = r.ReadUInt32();
            this.partTitleKey       = r.ReadUInt32();
            this.partDesptionKey    = r.ReadUInt32();
            this.uniqueTextureSpace = r.ReadByte();
            this.bodyType           = (BodyType)r.ReadInt32();
            this.bodySubType        = r.ReadInt32();
            this.ageGender          = (AgeGenderFlags)r.ReadUInt32();
            if (this.version >= 0x20)
            {
                this.reserved1 = r.ReadUInt32();
            }
            if (this.version >= 34)
            {
                this.packID    = r.ReadInt16();
                this.packFlags = (PackFlag)r.ReadByte();
                this.reserved2 = r.ReadBytes(9);
            }
            else
            {
                this.packID  = 0;
                this.unused2 = r.ReadByte();
                if (this.unused2 > 0)
                {
                    this.unused3 = r.ReadByte();
                }
            }

            this.swatchColorCode = new SwatchColorList(this.OnResourceChanged, s);

            this.buffResKey          = r.ReadByte();
            this.varientThumbnailKey = r.ReadByte();
            if (this.version >= 0x1C)
            {
                this.voiceEffectHash = r.ReadUInt64();
            }
            if (this.version >= 0x1E)
            {
                this.usedMaterialCount = r.ReadByte();
                if (this.usedMaterialCount > 0)
                {
                    this.materialSetUpperBodyHash = r.ReadUInt32();
                    this.materialSetLowerBodyHash = r.ReadUInt32();
                    this.materialSetShoesHash     = r.ReadUInt32();
                }
            }
            if (this.version >= 0x1F)
            {
                this.hideForOccultFlags = (OccultTypesDisabled)r.ReadUInt32();
            }
            this.nakedKey  = r.ReadByte();
            this.parentKey = r.ReadByte();
            this.sortLayer = r.ReadInt32();

            // Don't move any of this before the -----
            // TGI block list
            var currentPosition = r.BaseStream.Position;

            r.BaseStream.Position = this.TGIoffset;
            var count4 = r.ReadByte();

            this.tgiList          = new CountedTGIBlockList(this.OnResourceChanged, "IGT", count4, s);
            r.BaseStream.Position = currentPosition;
            this.lodBlockList     = new LODBlockList(null, s, this.tgiList);
            //-------------

            var count = r.ReadByte();

            this.slotKey = new SimpleList <byte>(null);
            for (byte i = 0; i < count; i++)
            {
                this.slotKey.Add(r.ReadByte());
            }

            this.diffuseShadowKey  = r.ReadByte();
            this.shadowKey         = r.ReadByte();
            this.compositionMethod = r.ReadByte();
            this.regionMapKey      = r.ReadByte();
            this.overrides         = new OverrideList(null, s);
            this.normalMapKey      = r.ReadByte();
            this.specularMapKey    = r.ReadByte();
            if (this.version >= 0x1B)
            {
                this.sharedUVMapSpace = r.ReadUInt32();
            }
            if (this.version >= 0x1E)
            {
                this.emissionMapKey = r.ReadByte();
            }
        }