Exemple #1
0
 protected void ReadExpressionInput(AssetBinaryReader reader, bool includeHeader, long leng)
 {
     OutputIndex    = reader.ReadInt32();
     InputName      = reader.ReadFName();
     Extras         = reader.ReadBytes(20); // always 0s
     ExpressionName = reader.ReadFName();
     return;
 }
        public override void Read(AssetBinaryReader reader, bool includeHeader, long leng1, long leng2 = 0)
        {
            if (includeHeader)
            {
                PropertyGuid = reader.ReadPropertyGuid();
            }

            Value = reader.ReadBytes((int)leng1);
        }
Exemple #3
0
        public override void Read(AssetBinaryReader reader, bool includeHeader, long leng1, long leng2 = 0)
        {
            if (includeHeader)
            {
                PropertyGuid = reader.ReadPropertyGuid();
            }

            DisplayName = reader.ReadFName();
            if (reader.Asset.GetCustomVersion <FAnimPhysObjectVersion>() < FAnimPhysObjectVersion.RemoveUIDFromSmartNameSerialize)
            {
                SmartNameID = reader.ReadUInt16();
            }
            if (reader.Asset.GetCustomVersion <FAnimPhysObjectVersion>() < FAnimPhysObjectVersion.SmartNameRefactorForDeterministicCooking)
            {
                TempGUID = new Guid(reader.ReadBytes(16));
            }
        }
Exemple #4
0
        public override void Read(AssetBinaryReader reader, bool includeHeader, long leng1, long leng2 = 0)
        {
            if (includeHeader) // originally !isForced
            {
                StructType = reader.ReadFName();
                if (reader.Asset.EngineVersion >= UE4Version.VER_UE4_STRUCT_GUID_IN_PROPERTY_TAG)
                {
                    StructGUID = new Guid(reader.ReadBytes(16));
                }
                PropertyGuid = reader.ReadPropertyGuid();
            }

            MainSerializer.PropertyTypeRegistry.TryGetValue(StructType.Value.Value, out RegistryEntry targetEntry);
            bool hasCustomStructSerialization = targetEntry != null && targetEntry.HasCustomStructSerialization;

            if (StructType.Value.Value == "RichCurveKey" && reader.Asset.EngineVersion < UE4Version.VER_UE4_SERIALIZE_RICH_CURVE_KEY)
            {
                hasCustomStructSerialization = false;
            }

            if (leng1 == 0)
            {
                SerializeNone = false;
                Value         = new List <PropertyData>();
                return;
            }

            if (targetEntry != null && hasCustomStructSerialization)
            {
                ReadOnce(reader, targetEntry.PropertyType, reader.BaseStream.Position);
            }
            else
            {
                ReadNTPL(reader);
            }
        }
        public override void Read(AssetBinaryReader reader, bool includeHeader, long leng1, long leng2 = 0)
        {
            if (includeHeader)
            {
                ArrayType    = reader.ReadFName();
                PropertyGuid = reader.ReadPropertyGuid();
            }

            int numEntries = reader.ReadInt32();

            if (ArrayType.Value.Value == "StructProperty" && ShouldSerializeStructsDifferently)
            {
                var results = new PropertyData[numEntries];

                FName name         = this.Name;
                long  structLength = 1;
                FName fullType     = new FName("Generic");
                Guid  structGUID   = new Guid();

                if (reader.Asset.EngineVersion >= UE4Version.VER_UE4_INNER_ARRAY_TAG_INFO)
                {
                    name = reader.ReadFName();
                    if (name.Value.Value.Equals("None"))
                    {
                        Value = results;
                        return;
                    }

                    FName thisArrayType = reader.ReadFName();
                    if (thisArrayType.Value.Value.Equals("None"))
                    {
                        Value = results;
                        return;
                    }

                    if (thisArrayType.Value.Value != ArrayType.Value.Value)
                    {
                        throw new FormatException("Invalid array type: " + thisArrayType.ToString() + " vs " + ArrayType.ToString());
                    }

                    structLength = reader.ReadInt64(); // length value
                    fullType     = reader.ReadFName();
                    structGUID   = new Guid(reader.ReadBytes(16));
                    reader.ReadPropertyGuid();
                }

                if (numEntries == 0)
                {
                    DummyStruct = new StructPropertyData(name, fullType)
                    {
                        StructGUID = structGUID
                    };
                }
                else
                {
                    for (int i = 0; i < numEntries; i++)
                    {
                        var data = new StructPropertyData(name, fullType);
                        data.Offset = reader.BaseStream.Position;
                        data.Read(reader, false, structLength);
                        data.StructGUID = structGUID;
                        results[i]      = data;
                    }
                    DummyStruct = (StructPropertyData)results[0];
                }
                Value = results;
            }
            else
            {
                var results = new PropertyData[numEntries];
                if (numEntries > 0)
                {
                    int averageSizeEstimate1 = (int)(leng1 / numEntries);
                    int averageSizeEstimate2 = (int)((leng1 - 4) / numEntries);
                    for (int i = 0; i < numEntries; i++)
                    {
                        results[i]        = MainSerializer.TypeToClass(ArrayType, new FName(i.ToString(), int.MinValue), reader.Asset);
                        results[i].Offset = reader.BaseStream.Position;
                        if (results[i] is StructPropertyData)
                        {
                            ((StructPropertyData)results[i]).StructType = new FName("Generic");
                        }
                        results[i].Read(reader, false, averageSizeEstimate1, averageSizeEstimate2);
                    }
                }
                Value = results;
            }
        }