Ejemplo n.º 1
0
        public FPackageIndex AreaClass; // UNavArea

        public override void Deserialize(FAssetArchive Ar, long validPos)
        {
            base.Deserialize(Ar, validPos);

            var startPos = Ar.Position;
            int version;
            var myMagic = Ar.Read <uint>();

            if (myMagic != Consts.Magic)
            {
                version     = Consts.Initial;
                Ar.Position = startPos;
            }
            else
            {
                version = Ar.Read <int>();
            }

            var _       = Ar.Read <FGuid>(); // Zeroed GUID, unused
            var bCooked = Ar.ReadBoolean();

            if (bCooked)
            {
                CookedFormatData = new FFormatContainer(Ar);
            }

            if (version >= Consts.AreaClass)
            {
                AreaClass = new FPackageIndex(Ar);
            }
        }
Ejemplo n.º 2
0
        public UScriptMap(FAssetArchive Ar, FPropertyTagData tagData)
        {
            if (tagData.InnerType == null || tagData.ValueType == null)
            {
                throw new ParserException(Ar, "Can't serialize UScriptMap without key or value type");
            }

            var numKeysToRemove = Ar.Read <int>();

            for (var i = 0; i < numKeysToRemove; i++)
            {
                FPropertyTagType.ReadPropertyTagType(Ar, tagData.InnerType, tagData.InnerTypeData, ReadType.MAP);
            }

            var numEntries = Ar.Read <int>();

            Properties = new Dictionary <FPropertyTagType?, FPropertyTagType?>(numEntries);
            for (var i = 0; i < numEntries; i++)
            {
                var isReadingValue = false;
                try
                {
                    var key = FPropertyTagType.ReadPropertyTagType(Ar, tagData.InnerType, tagData.InnerTypeData, ReadType.MAP);
                    isReadingValue = true;
                    var value = FPropertyTagType.ReadPropertyTagType(Ar, tagData.ValueType, tagData.ValueTypeData, ReadType.MAP);
                    Properties[key] = value;
                }
                catch (ParserException e)
                {
                    throw new ParserException(Ar, $"Failed to read {(isReadingValue ? "value" : "key")} for index {i} in map", e);
                }
            }
        }
Ejemplo n.º 3
0
        public UScriptSet(FAssetArchive Ar, FPropertyTagData?tagData)
        {
            var innerType = tagData?.InnerType ?? throw new ParserException(Ar, "UScriptSet needs inner type");

            var numElementsToRemove = Ar.Read <int>();

            for (var i = 0; i < numElementsToRemove; i++)
            {
                FPropertyTagType.ReadPropertyTagType(Ar, innerType, tagData, ReadType.ARRAY);
            }

            var num = Ar.Read <int>();

            Properties = new List <FPropertyTagType>(num);
            for (var i = 0; i < num; i++)
            {
                var property = FPropertyTagType.ReadPropertyTagType(Ar, innerType, tagData, ReadType.ARRAY);
                if (property != null)
                {
                    Properties.Add(property);
                }
                else
                {
                    Log.Debug($"Failed to read element for index {i} in set");
                }
            }
        }
Ejemplo n.º 4
0
        public UScriptMap(FAssetArchive Ar, FPropertyTagData tagData)
        {
            if (tagData.InnerType == null || tagData.ValueType == null)
            {
                throw new ParserException(Ar, "Can't serialize UScriptMap without key or value type");
            }

            int numKeyToRemove = Ar.Read <int>();

            for (int i = 0; i < numKeyToRemove; i++)
            {
                FPropertyTagType.ReadPropertyTagType(Ar, tagData.InnerType, tagData, ReadType.MAP);
            }

            int numEntries = Ar.Read <int>();

            Properties = new Dictionary <FPropertyTagType?, FPropertyTagType?>(numEntries);
            for (int i = 0; i < numEntries; i++)
            {
                try
                {
                    Properties[FPropertyTagType.ReadPropertyTagType(Ar, tagData.InnerType, tagData.InnerTypeData, ReadType.MAP)] = FPropertyTagType.ReadPropertyTagType(Ar, tagData.ValueType, tagData.ValueTypeData, ReadType.MAP);
                }
                catch (ParserException e)
                {
                    throw new ParserException(Ar, $"Failed to read key/value pair for index {i} in map", e);
                }
            }
        }
Ejemplo n.º 5
0
        public override void Deserialize(FAssetArchive Ar, long validPos)
        {
            base.Deserialize(Ar, validPos);
            SuperStruct = new FPackageIndex(Ar);
            if (FFrameworkObjectVersion.Get(Ar) < FFrameworkObjectVersion.Type.RemoveUField_Next)
            {
                var firstChild = new FPackageIndex(Ar);
                Children = firstChild.IsNull ? Array.Empty<FPackageIndex>() : new[] { firstChild };
            }
            else
            {
                Children = Ar.ReadArray(() => new FPackageIndex(Ar));
            }

            if (FCoreObjectVersion.Get(Ar) >= FCoreObjectVersion.Type.FProperties)
            {
                DeserializeProperties(Ar);
            }

            var bytecodeBufferSize = Ar.Read<int>();
            var serializedScriptSize = Ar.Read<int>();
            if (Ar.Owner.Provider?.ReadScriptData == true)
            {
                Script = Ar.ReadBytes(serializedScriptSize);
            }
            else
            {
                Ar.Position += serializedScriptSize;
            }
        }
Ejemplo n.º 6
0
        public FSkelMeshChunk(FAssetArchive Ar)
        {
            var stripDataFlags = Ar.Read <FStripDataFlags>();

            if (!stripDataFlags.IsDataStrippedForServer())
            {
                BaseVertexIndex = Ar.Read <int>();
            }

            if (!stripDataFlags.IsEditorDataStripped())
            {
                RigidVertices = Ar.ReadArray(() => new FRigidVertex(Ar));
                SoftVertices  = Ar.ReadArray(() => new FSoftVertex(Ar));
            }

            BoneMap           = Ar.ReadArray <ushort>();
            NumRigidVertices  = Ar.Read <int>();
            NumSoftVertices   = Ar.Read <int>();
            MaxBoneInfluences = Ar.Read <int>();
            HasClothData      = false;

            if (Ar.Ver >= UE4Version.VER_UE4_APEX_CLOTH)
            {
                // Physics data, drop
                var clothMappingData = Ar.ReadArray(() => new FApexClothPhysToRenderVertData(Ar));
                Ar.ReadArray <FVector>(); // PhysicalMeshVertices
                Ar.ReadArray <FVector>(); // PhysicalMeshNormals
                Ar.Position += 4;         // CorrespondClothAssetIndex, ClothAssetSubmeshIndex
                HasClothData = clothMappingData.Length > 0;
            }
        }
Ejemplo n.º 7
0
 public FZoneProperties(FAssetArchive Ar)
 {
     ZoneActor      = new FPackageIndex(Ar);
     Connectivity   = Ar.Read <FZoneSet>();
     Visibility     = Ar.Read <FZoneSet>();
     LastRenderTime = Ar.Read <float>();
 }
Ejemplo n.º 8
0
 public AsTime(FAssetArchive Ar)
 {
     SourceDateTime = Ar.Read <FDateTime>();
     TimeStyle      = Ar.Read <EDateTimeStyle>();
     TimeZone       = Ar.ReadFString();
     TargetCulture  = Ar.ReadFString();
 }
Ejemplo n.º 9
0
        public override void Deserialize(FAssetArchive Ar, long validPos)
        {
            base.Deserialize(Ar, validPos);
            bStreaming = Ar.Game >= EGame.GAME_UE4_25;
            if (TryGetValue(out bool s, nameof(bStreaming))) // will return false if not found
            {
                bStreaming = s;
            }
            else if (TryGetValue(out FName loadingBehavior, "LoadingBehavior"))
            {
                bStreaming = !loadingBehavior.IsNone && loadingBehavior.Text != "ESoundWaveLoadingBehavior::ForceInline";
            }

            bCooked = Ar.ReadBoolean();
            if (!bStreaming)
            {
                if (bCooked)
                {
                    CompressedFormatData = new FFormatContainer(Ar);
                }
                else
                {
                    RawData = new FByteBulkData(Ar);
                }
                CompressedDataGuid = Ar.Read <FGuid>();
            }
            else
            {
                CompressedDataGuid  = Ar.Read <FGuid>();
                RunningPlatformData = new FStreamedAudioPlatformData(Ar);
            }
        }
Ejemplo n.º 10
0
        public override void Deserialize(FAssetArchive Ar, long validPos)
        {
            base.Deserialize(Ar, validPos);

            var numRows = Ar.Read <int>();

            var bUpgradingCurveTable = FFortniteMainBranchObjectVersion.Get(Ar) < FFortniteMainBranchObjectVersion.Type.ShrinkCurveTableSize;

            if (bUpgradingCurveTable)
            {
                CurveTableMode = numRows > 0 ? ECurveTableMode.RichCurves : ECurveTableMode.Empty;
            }
            else
            {
                CurveTableMode = Ar.Read <ECurveTableMode>();
            }
            RowMap = new Dictionary <FName, FStructFallback>(numRows);
            for (var i = 0; i < numRows; i++)
            {
                var    rowName   = Ar.ReadFName();
                string rowStruct = CurveTableMode switch
                {
                    ECurveTableMode.SimpleCurves => "SimpleCurve",
                    ECurveTableMode.RichCurves => "RichCurve",
                    _ => ""
                };
                RowMap[rowName] = new FStructFallback(Ar, rowStruct);
            }
        }
        public FSkeletalMeshVertexBuffer(FAssetArchive Ar)
        {
            var stripDataFlags = new FStripDataFlags(Ar, (int)UE4Version.VER_UE4_STATIC_SKELETAL_MESH_SERIALIZATION_FIX);

            NumTexCoords         = Ar.Read <int>();
            bUseFullPrecisionUVs = Ar.ReadBoolean();

            if (Ar.Ver >= UE4Version.VER_UE4_SUPPORT_GPUSKINNING_8_BONE_INFLUENCES &&
                FSkeletalMeshCustomVersion.Get(Ar) < FSkeletalMeshCustomVersion.Type.UseSeparateSkinWeightBuffer)
            {
                bExtraBoneInfluences = Ar.ReadBoolean();
            }

            MeshExtension = Ar.Read <FVector>();
            MeshOrigin    = Ar.Read <FVector>();

            if (!bUseFullPrecisionUVs)
            {
                VertsHalf = Ar.ReadBulkArray(() => new FGPUVertHalf(Ar, NumTexCoords));
            }
            else
            {
                VertsFloat = Ar.ReadBulkArray(() => new FGPUVertFloat(Ar, NumTexCoords));
            }
        }
Ejemplo n.º 12
0
 public FMovieSceneSegment(FAssetArchive Ar)
 {
     Range       = Ar.Read <TRange <FFrameNumber> >();
     ID          = Ar.Read <FMovieSceneSegmentIdentifier>();
     bAllowEmpty = Ar.ReadBoolean();
     Impls       = Ar.ReadArray <FSectionEvaluationData>();
 }
Ejemplo n.º 13
0
        public FReferenceSkeleton(FAssetArchive Ar)
        {
            FinalRefBoneInfo = Ar.ReadArray(() => new FMeshBoneInfo(Ar));
            FinalRefBonePose = Ar.ReadArray <FTransform>();

            if (Ar.Ver >= EUnrealEngineObjectUE4Version.REFERENCE_SKELETON_REFACTOR)
            {
                var num = Ar.Read <int>();
                FinalNameToIndexMap = new Dictionary <FName, int>(num);
                for (var i = 0; i < num; ++i)
                {
                    FinalNameToIndexMap[Ar.ReadFName()] = Ar.Read <int>();
                }
            }

            if (Ar.Ver < EUnrealEngineObjectUE4Version.FIXUP_ROOTBONE_PARENT)
            {
                if (FinalRefBoneInfo.Length > 0 && FinalRefBoneInfo[0].ParentIndex != -1)
                {
                    FinalRefBoneInfo[0] = new FMeshBoneInfo(FinalRefBoneInfo[0].Name, -1);
                }
            }

            AdjustBoneScales(FinalRefBonePose);
        }
Ejemplo n.º 14
0
        public override void Deserialize(FAssetArchive Ar, long validPos)
        {
            base.Deserialize(Ar, validPos);
            SuperStruct = new FPackageIndex(Ar);
            if (Ar.Game == EGame.GAME_SOD2)
            {
                Ar.Position += 4; //var someScriptImport = new FPackageIndex(Ar);
            }

            if (FFrameworkObjectVersion.Get(Ar) < FFrameworkObjectVersion.Type.RemoveUField_Next)
            {
                var firstChild = new FPackageIndex(Ar);
                Children = firstChild.IsNull ? Array.Empty <FPackageIndex>() : new[] { firstChild };
            }
            else
            {
                Children = Ar.ReadArray(() => new FPackageIndex(Ar));
            }

            if (FCoreObjectVersion.Get(Ar) >= FCoreObjectVersion.Type.FProperties)
            {
                DeserializeProperties(Ar);
            }

            var bytecodeBufferSize   = Ar.Read <int>();
            var serializedScriptSize = Ar.Read <int>();

            Ar.Position += serializedScriptSize; // should we read the bytecode some day?
        }
 public FApexClothPhysToRenderVertData(FAssetArchive Ar)
 {
     PositionBaryCoordsAndDist = Ar.Read <FVector4>();
     NormalBaryCoordsAndDist   = Ar.Read <FVector4>();
     TangentBaryCoordsAndDist  = Ar.Read <FVector4>();
     SimulMeshVertIndices      = Ar.ReadArray(4, Ar.Read <short>);
     Padding = Ar.ReadArray(2, Ar.Read <int>);
 }
 public FLevelSequenceObjectReferenceMap(FAssetArchive Ar)
 {
     Map = new Dictionary <FGuid, FLevelSequenceLegacyObjectReference>(Ar.Read <int>());
     for (int i = 0; i < Map.Count; i++)
     {
         Map[Ar.Read <FGuid>()] = new FLevelSequenceLegacyObjectReference(Ar);
     }
 }
Ejemplo n.º 17
0
        public FPackageIndex ScriptStruct; // UScriptStruct

        public FRigVMParameter(FAssetArchive Ar)
        {
            Type          = Ar.Read <ERigVMParameterType>();
            Name          = Ar.ReadFName();
            RegisterIndex = Ar.Read <int>();
            CPPType       = Ar.ReadFString();
            ScriptStruct  = new FPackageIndex(Ar);
        }
Ejemplo n.º 18
0
        }                                                        // UMaterialInterface[]

        public override void Deserialize(FAssetArchive Ar, long validPos)
        {
            base.Deserialize(Ar, validPos);

            var stripDataFlags = Ar.Read <FStripDataFlags>();

            bCooked   = Ar.ReadBoolean();
            BodySetup = new FPackageIndex(Ar);
            if (Ar.Ver >= EUnrealEngineObjectUE4Version.STATIC_MESH_STORE_NAV_COLLISION)
            {
                NavCollision = new FPackageIndex(Ar);
            }

            if (!stripDataFlags.IsEditorDataStripped())
            {
                Log.Warning("Static Mesh with Editor Data not implemented yet");
                Ar.Position = validPos;
                return;
                // if (Ar.Ver < UE4Version.VER_UE4_DEPRECATED_STATIC_MESH_THUMBNAIL_PROPERTIES_REMOVED)
                // {
                //     var dummyThumbnailAngle = Ar.Read<FRotator>();
                //     var dummyThumbnailDistance = Ar.Read<float>();
                // }
                // var highResSourceMeshName = Ar.ReadFString();
                // var highResSourceMeshCRC = Ar.Read<uint>();
            }

            LightingGuid = Ar.Read <FGuid>(); // LocalLightingGuid
            Sockets      = Ar.ReadArray(() => new FPackageIndex(Ar));
            RenderData   = new FStaticMeshRenderData(Ar, bCooked);

            if (bCooked && Ar.Game is >= EGame.GAME_UE4_20 and < EGame.GAME_UE5_0)
            {
                var bHasOccluderData = Ar.ReadBoolean();
                if (bHasOccluderData)
                {
                    Ar.ReadArray <FVector>(); // Vertices
                    Ar.ReadArray <ushort>();  // Indices
                }
            }

            if (Ar.Game >= EGame.GAME_UE4_14)
            {
                var bHasSpeedTreeWind = Ar.ReadBoolean();
                if (bHasSpeedTreeWind)
                {
                    Ar.Position = validPos;
                    return;
                }

                if (FEditorObjectVersion.Get(Ar) >= FEditorObjectVersion.Type.RefactorMeshEditorMaterials)
                {
                    // UE4.14+ - "Materials" are deprecated, added StaticMaterials
                    StaticMaterials = Ar.ReadArray(() => new FStaticMaterial(Ar));
                }
            }

            if (StaticMaterials is { Length : > 0 })
Ejemplo n.º 19
0
 public FCurveMetaData(FAssetArchive Ar, FAnimPhysObjectVersion.Type FrwAniVer)
 {
     Type        = new FAnimCurveType(Ar);
     LinkedBones = Ar.ReadArray(Ar.Read <int>(), () => Ar.ReadFName());
     if (FrwAniVer >= FAnimPhysObjectVersion.Type.AddLODToCurveMetaData)
     {
         MaxLOD = Ar.Read <byte>();
     }
 }
Ejemplo n.º 20
0
        public override void Deserialize(FAssetArchive Ar, long validPos)
        {
            base.Deserialize(Ar, validPos);

            const int StripVertexBufferFlag = 1;
            var       stripData             = new FStripDataFlags(Ar);

            Bounds = Ar.Read <FBoxSphereBounds>();

            Vectors = Ar.ReadBulkArray <FVector>();
            Points  = Ar.ReadBulkArray <FVector>();
            Nodes   = Ar.ReadBulkArray <FBspNode>();

            if (Ar.Ver < EUnrealEngineObjectUE4Version.BSP_UNDO_FIX)
            {
                var surfsOwner = new FPackageIndex(Ar);
                Surfs = Ar.ReadArray(() => new FBspSurf(Ar));
            }
            else
            {
                Surfs = Ar.ReadArray(() => new FBspSurf(Ar));
            }
            Verts = Ar.ReadBulkArray <FVert>();

            NumSharedSides = Ar.Read <int>();
            if (Ar.Ver < EUnrealEngineObjectUE4Version.REMOVE_ZONES_FROM_MODEL)
            {
                var dummyZones = Ar.ReadArray <FZoneProperties>();
            }

            var bHasEditorOnlyData = !Ar.IsFilterEditorOnly || Ar.Ver < EUnrealEngineObjectUE4Version.REMOVE_UNUSED_UPOLYS_FROM_UMODEL;

            if (bHasEditorOnlyData)
            {
                var dummyPolys = new FPackageIndex(Ar);
                Ar.SkipBulkArrayData(); // DummyLeafHulls
                Ar.SkipBulkArrayData(); // DummyLeaves
            }

            RootOutside = Ar.ReadBoolean();
            Linked      = Ar.ReadBoolean();

            if (Ar.Ver < EUnrealEngineObjectUE4Version.REMOVE_ZONES_FROM_MODEL)
            {
                var dummyPortalNodes = Ar.ReadBulkArray <int>();
            }

            NumUniqueVertices = Ar.Read <uint>();

            if (!stripData.IsEditorDataStripped() || !stripData.IsClassDataStripped(StripVertexBufferFlag))
            {
                VertexBuffer = new FModelVertexBuffer(Ar);
            }

            LightingGuid      = Ar.Read <FGuid>();
            LightmassSettings = Ar.ReadArray(() => new FLightmassPrimitiveSettings(Ar));
        }
Ejemplo n.º 21
0
 public FPrecomputedVolumeDistanceField(FAssetArchive Ar)
 {
     VolumeMaxDistance = Ar.Read <float>();
     VolumeBox         = Ar.Read <FBox>();
     VolumeSizeX       = Ar.Read <int>();
     VolumeSizeY       = Ar.Read <int>();
     VolumeSizeZ       = Ar.Read <int>();
     Data = Ar.ReadArray <FColor>();
 }
Ejemplo n.º 22
0
 public FPrecomputedVisibilityHandler(FAssetArchive Ar)
 {
     PrecomputedVisibilityCellBucketOriginXY = Ar.Read <FVector2D>();
     PrecomputedVisibilityCellSizeXY         = Ar.Read <float>();
     PrecomputedVisibilityCellSizeZ          = Ar.Read <float>();
     PrecomputedVisibilityCellBucketSizeXY   = Ar.Read <int>();
     PrecomputedVisibilityNumCellBuckets     = Ar.Read <int>();
     PrecomputedVisibilityCellBuckets        = Ar.ReadArray(() => new FPrecomputedVisibilityBucket(Ar));
 }
Ejemplo n.º 23
0
 public override void Deserialize(FAssetArchive Ar)
 {
     base.Deserialize(Ar);
     FieldSize     = Ar.Read <byte>();
     ByteOffset    = Ar.Read <byte>();
     ByteMask      = Ar.Read <byte>();
     FieldMask     = Ar.Read <byte>();
     BoolSize      = Ar.Read <byte>();
     bIsNativeBool = Ar.ReadFlag();
 }
Ejemplo n.º 24
0
 public override void Deserialize(FAssetArchive Ar)
 {
     base.Deserialize(Ar);
     ArrayDim      = Ar.Read <int>();
     ElementSize   = Ar.Read <int>();
     SaveFlags     = Ar.Read <ulong>();
     RepIndex      = Ar.Read <ushort>();
     RepNotifyFunc = Ar.ReadFName();
     BlueprintReplicationCondition = Ar.Read <byte>();
 }
Ejemplo n.º 25
0
        public FMeshBoneInfo(FAssetArchive Ar)
        {
            Name        = Ar.ReadFName();
            ParentIndex = Ar.Read <int>();

            if (Ar.Ver < Versions.UE4Version.VER_UE4_REFERENCE_SKELETON_REFACTOR)
            {
                Ar.Read <FColor>();
            }
        }
Ejemplo n.º 26
0
 public FNumberFormattingOptions(FAssetArchive Ar)
 {
     AlwaysSign              = Ar.ReadBoolean();
     UseGrouping             = Ar.ReadBoolean();
     RoundingMode            = Ar.Read <ERoundingMode>();
     MinimumIntegralDigits   = Ar.Read <int>();
     MaximumIntegralDigits   = Ar.Read <int>();
     MinimumFractionalDigits = Ar.Read <int>();
     MaximumFractionalDigits = Ar.Read <int>();
 }
Ejemplo n.º 27
0
 public FRigVMRegisterOffset(FAssetArchive Ar)
 {
     Segments           = Ar.ReadArray <int>();
     Type               = Ar.Read <ERigVMRegisterType>();
     CPPType            = Ar.ReadFName();
     ScriptStruct       = new FPackageIndex(Ar);
     ElementSize        = Ar.Read <ushort>();
     ParentScriptStruct = new FPackageIndex(Ar);
     CachedSegmentPath  = Ar.ReadFString();
     ArrayIndex         = Ar.Read <int>();
 }
Ejemplo n.º 28
0
        public override void Deserialize(FAssetArchive Ar, long validPos)
        {
            base.Deserialize(Ar, validPos);
            SuperStruct = new FPackageIndex(Ar);
            Children    = Ar.ReadArray(() => new FPackageIndex(Ar));
            DeserializeProperties(Ar);
            var bytecodeBufferSize   = Ar.Read <int>();
            var serializedScriptSize = Ar.Read <int>();

            Ar.Position += serializedScriptSize; // should we read the bytecode some day?
        }
Ejemplo n.º 29
0
 public override void Deserialize(FAssetArchive Ar, long validPos)
 {
     base.Deserialize(Ar, validPos);
     ArrayDim      = Ar.Read <int>();
     PropertyFlags = Ar.Read <ulong>();
     RepNotifyFunc = Ar.ReadFName();
     if (FReleaseObjectVersion.Get(Ar) >= FReleaseObjectVersion.Type.PropertiesSerializeRepCondition)
     {
         BlueprintReplicationCondition = (ELifetimeCondition)Ar.Read <byte>();
     }
 }
Ejemplo n.º 30
0
            public AsDate(FAssetArchive Ar)
            {
                SourceDateTime = Ar.Read <FDateTime>();
                DateStyle      = Ar.Read <EDateTimeStyle>();
                if (Ar.Ver >= UE4Version.VER_UE4_FTEXT_HISTORY_DATE_TIMEZONE)
                {
                    TimeZone = Ar.ReadFString();
                }

                TargetCulture = Ar.ReadFString();
            }