コード例 #1
0
            public override void Deserialize(FArchive reader)
            {
                base.Deserialize(reader);

                reader.Read(out _sourceDateTime);
                reader.ReadUnsafe(out _dateStyle);
                reader.ReadUnsafe(out _timeStyle);
                reader.Read(out _timeZone);
                reader.Read(out _cultureName);
            }
コード例 #2
0
        public void Deserialize(FArchive reader)
        {
            var version = reader.Version;

            reader.Read(out _classIndex);
            reader.Read(out _superIndex);

            if (version >= UE4Version.VER_UE4_TemplateIndex_IN_COOKED_EXPORTS)
            {
                reader.Read(out _templateIndex);
            }

            reader.Read(out _outerIndex);
            reader.Read(out _objectName);

            reader.ReadUnsafe(out _objectFlags);

            if (version < UE4Version.VER_UE4_64BIT_EXPORTMAP_SERIALSIZES)
            {
                reader.Read(out int size);
                reader.Read(out int offset);
                _serialSize   = size;
                _serialOffset = offset;
            }
            else
            {
                reader.Read(out _serialSize);
                reader.Read(out _serialOffset);
            }

            reader.Read(out _bForcedExport);
            reader.Read(out _bNotForClient);
            reader.Read(out _bNotForServer);
            reader.Read(out _packageGuid);
            reader.ReadUnsafe(out _packageFlags);

            if (version >= UE4Version.VER_UE4_LOAD_FOR_EDITOR_GAME)
            {
                reader.Read(out _bNotAlwaysLoadedForEditorGame);
            }

            if (version >= UE4Version.VER_UE4_COOKED_ASSETS_IN_EDITOR_SUPPORT)
            {
                reader.Read(out _bIsAsset);
            }

            if (version >= UE4Version.VER_UE4_PRELOAD_DEPENDENCIES_IN_COOKED_EXPORTS)
            {
                reader.Read(out _firstExportDependency);
                reader.Read(out _serializationBeforeSerializationDependencies);
                reader.Read(out _createBeforeSerializationDependencies);
                reader.Read(out _serializationBeforeCreateDependencies);
                reader.Read(out _createBeforeCreateDependencies);
            }
        }
コード例 #3
0
ファイル: RichCurveKey.cs プロジェクト: Nexure/UnrealTools
 public void Deserialize(FArchive reader)
 {
     reader.ReadUnsafe(out _interpMode);
     reader.ReadUnsafe(out _tangentMode);
     reader.ReadUnsafe(out _tangentWeightMode);
     reader.Read(out _time);
     reader.Read(out _value);
     reader.Read(out _arriveTangent);
     reader.Read(out _arriveTangentWeight);
     reader.Read(out _leaveTangent);
     reader.Read(out _leaveTangentWeight);
 }
コード例 #4
0
        public void Deserialize(FArchive reader)
        {
            reader.Read(out _objectPath);
            reader.Read(out _packagePath);
            reader.Read(out _assetClass);

            reader.Read(out _packageName);
            reader.Read(out _assetName);

            reader.Read(out _tagsAndValues);

            if (reader.Version >= UE4Version.VER_UE4_CHANGED_CHUNKID_TO_BE_AN_ARRAY_OF_CHUNKIDS)
            {
                reader.Read(out _chunkIDs);
            }
            else if (reader.Version >= UE4Version.VER_UE4_ADDED_CHUNKID_TO_ASSETDATA_AND_UPACKAGE)
            {
                reader.Read(out _chunkIDs, 1);
            }
            else
            {
                _chunkIDs = new List <int>();
            }

            if (reader.Version >= UE4Version.VER_UE4_COOKED_ASSETS_IN_EDITOR_SUPPORT)
            {
                reader.ReadUnsafe(out _packageFlags);
            }
        }
コード例 #5
0
            public override void Deserialize(FArchive reader)
            {
                base.Deserialize(reader);

                reader.Read(out _text);
                reader.ReadUnsafe(out _transform);
            }
コード例 #6
0
        public void Deserialize(FArchive reader)
        {
            reader.ReadUnsafe(out _metaDataType);
            switch (_metaDataType)
            {
            case ELocMetadataType.Boolean:
            {
                reader.Read(out bool b);
            }
            break;

            case ELocMetadataType.String:
            {
                reader.Read(out FString b);
            }
            break;

            case ELocMetadataType.Array:
            {
                reader.Read(out List <LocMetadataValue> ar);
            }
            break;

            case ELocMetadataType.Object:
            {
                reader.Read(out LocMetadataObject b);
            }
            break;

            default:
                throw new NotImplementedException($"{_metaDataType} not implemented.");
            }
        }
コード例 #7
0
ファイル: AssetData.cs プロジェクト: fdsalbj/UETools
        public FArchive Serialize(FArchive archive)
        {
            archive.Read(ref _objectPath)
            .Read(ref _packagePath)
            .Read(ref _assetClass)
            .Read(ref _packageName)
            .Read(ref _assetName)
            .Read(ref _tagsAndValues);

            if (archive.Version >= UE4Version.VER_UE4_CHANGED_CHUNKID_TO_BE_AN_ARRAY_OF_CHUNKIDS)
            {
                archive.Read(ref _chunkIDs);
            }
            else if (archive.Version >= UE4Version.VER_UE4_ADDED_CHUNKID_TO_ASSETDATA_AND_UPACKAGE)
            {
                archive.Read(ref _chunkIDs, 1);
            }
            else
            {
                _chunkIDs = new List <int>();
            }

            if (archive.Version >= UE4Version.VER_UE4_COOKED_ASSETS_IN_EDITOR_SUPPORT)
            {
                archive.ReadUnsafe(ref _packageFlags);
            }

            return(archive);
        }
コード例 #8
0
ファイル: UClass.cs プロジェクト: Nexure/UnrealTools
        public override void Deserialize(FArchive reader)
        {
            base.Deserialize(reader);
            reader.Read(out _funcMap);
            reader.ReadUnsafe(out _flags);

            if (reader.Version < UE4Version.VER_UE4_CLASS_NOTPLACEABLE_ADDED)
            {
                _flags ^= EClassFlags.NotPlaceable;
                if ((_flags & EClassFlags.NotPlaceable) == 0)
                {
                    _flags |= EClassFlags.NotPlaceable;
                }
            }

            reader.Read(out _classWithin);
            reader.Read(out _classConfigName);

            if (reader.Version < UE4Version.VER_UE4_UCLASS_SERIALIZE_INTERFACES_AFTER_LINKING)
            {
                reader.Read(out _serializedInterface);
            }

            reader.Read(out _deprecatedForceScriptOrder);
            reader.Read(out _dummy);

            if (reader.Version >= UE4Version.VER_UE4_ADD_COOKED_TO_UCLASS)
            {
                reader.Read(out _cooked);
            }
        }
コード例 #9
0
 public FArchive Serialize(FArchive archive)
 => archive.ReadUnsafe(ref _interpMode)
 .ReadUnsafe(ref _tangentMode)
 .ReadUnsafe(ref _tangentWeightMode)
 .Read(ref _time)
 .Read(ref _value)
 .Read(ref _arriveTangent)
 .Read(ref _arriveTangentWeight)
 .Read(ref _leaveTangent)
 .Read(ref _leaveTangentWeight);
コード例 #10
0
 public FArchive Serialize(FArchive archive)
 {
     archive.ReadUnsafe(ref _type);
     switch (_type)
     {
     case FormatArgumentType.Int:
     {
         long value = default !;
         archive.Read(ref value);
         Value = value;
         break;
     }
コード例 #11
0
        public void Deserialize(FArchive reader)
        {
            reader.Read(out _bIsCooked);
            if (_bIsCooked)
            {
                reader.Read(out _fontFaceAsset);

                if (_fontFaceAsset.Resource is null)
                {
                    reader.Read(out _fontFileName);
                    reader.ReadUnsafe(out _hinting);
                    reader.ReadUnsafe(out _loadingPolicy);
                }

                reader.Read(out _subFaceIndex);
            }
            else
            {
                Debugger.Break();
            }
        }
コード例 #12
0
ファイル: LocMetaAsset.cs プロジェクト: Nexure/UnrealTools
        private bool ReadVersion(FArchive reader, out ELocMetaVersion version)
        {
            reader.Read(out Guid MagicNumber);
            if (MagicNumber != LocMetaMagic)
            {
                version = ELocMetaVersion.Initial;
                return(false);
            }
            reader.ReadUnsafe(out version);

            reader.AssetVersion = (int)version;
            return(true);
        }
コード例 #13
0
        public override FArchive Serialize(FArchive reader, PropertyTag tag)
        {
            ObjectReference?declaredIn = default;

            reader.Read(ref declaredIn);
            if (declaredIn.Resource != null)
            {
                EFunctionFlags flags = default;
                reader.ReadUnsafe(ref flags);
                reader.Read(ref _value);
            }
            return(reader);
        }
コード例 #14
0
ファイル: TokenFactory.cs プロジェクト: fdsalbj/UETools
        public static Token Read(FArchive reader)
        {
            EExprToken currentToken = default;

            reader.ReadUnsafe(ref currentToken);
            if (EnumTypes.TryGetValue(currentToken, out var type))
            {
                var tok = type();
                tok.Serialize(reader);
                return(tok);
            }
            throw new NotImplementedException($"Unknown opcode {currentToken}");
        }
コード例 #15
0
ファイル: AsDate.cs プロジェクト: Nexure/UnrealTools
            public override void Deserialize(FArchive reader)
            {
                base.Deserialize(reader);

                reader.Read(out _sourceDateTime);
                reader.ReadUnsafe(out _dateStyle);
                if (reader.Version >= UE4Version.VER_UE4_FTEXT_HISTORY_DATE_TIMEZONE)
                {
                    reader.Read(out _timeZone);
                }

                reader.Read(out _cultureName);
            }
コード例 #16
0
ファイル: AssetRegistry.cs プロジェクト: Nexure/UnrealTools
 private void ReadVersion(FArchive reader)
 {
     reader.Read(out Guid guid);
     if (guid == AssetRegistryVersionGuid)
     {
         reader.ReadUnsafe(out _version);
     }
     else
     {
         _version = EAssetRegistryVersion.PreVersioning;
         reader.Seek(0);
     }
     reader.AssetVersion = (int)_version;
 }
コード例 #17
0
        private bool ReadVersion(FArchive reader, out ELocMetaVersion version)
        {
            Guid MagicNumber = default;

            reader.Read(ref MagicNumber);
            version = ELocMetaVersion.Initial;
            if (MagicNumber == LocMetaMagic)
            {
                reader.ReadUnsafe(ref version);
                reader.AssetVersion = (int)version;
                return(true);
            }
            return(false);
        }
コード例 #18
0
        public override void Deserialize(FArchive reader)
        {
            base.Deserialize(reader);
            reader.ReadUnsafe(out _functionFlags);

            if ((_functionFlags & EFunctionFlags.Net) != 0)
            {
                reader.Read(out _repOffset);
            }

            if (reader.Version >= UE4Version.VER_UE4_SERIALIZE_BLUEPRINT_EVENTGRAPH_FASTCALLS_IN_UFUNCTION)
            {
                reader.Read(out _eventGraphFunction);
                reader.Read(out _eventGraphCallOffset);
            }
        }
コード例 #19
0
ファイル: LocResAsset.cs プロジェクト: fdsalbj/UETools
        private ELocResVersion ReadVersion(FArchive archive)
        {
            Guid MagicNumber = default;

            archive.Read(ref MagicNumber);
            var VersionNumber = ELocResVersion.Legacy;

            if (MagicNumber == LocResMagic)
            {
                archive.ReadUnsafe(ref VersionNumber);
            }
            else
            {
                archive.Seek(0); // legacy LocRes
            }
            archive.AssetVersion = (int)VersionNumber;
            return(VersionNumber);
        }
コード例 #20
0
        public void Deserialize(FArchive reader)
        {
            reader.ReadUnsafe(out _type);
            switch (_type)
            {
            case FormatArgumentType.Int:
                reader.Read(out long ivalue);
                Value = ivalue;
                break;

            case FormatArgumentType.UInt:
                reader.Read(out ulong uivalue);
                Value = uivalue;
                break;

            case FormatArgumentType.Float:
                reader.Read(out float fvalue);
                Value = fvalue;
                break;

            case FormatArgumentType.Double:
                reader.Read(out double dvalue);
                Value = dvalue;
                break;

            case FormatArgumentType.Text:
                reader.Read(out FText tvalue);
                Value = tvalue;
                break;

            case FormatArgumentType.Gender:
                reader.ReadUnsafe(out TextGender evalue);
                Value = evalue;
                break;

            default:
                throw new NotImplementedException();
            }
        }
コード例 #21
0
        // TODO: FIX
        public FArchive Serialize(FArchive archive)
        {
            archive.ReadUnsafe(ref _metaDataType);
            switch (_metaDataType)
            {
            case ELocMetadataType.Boolean:
            {
                bool b = false;
                archive.Read(ref b);
            }
            break;

            case ELocMetadataType.String:
            {
                FString?b = default;
                archive.Read(ref b);
            }
            break;

            case ELocMetadataType.Array:
            {
                List <LocMetadataValue>?ar = default;
                archive.Read(ref ar);
            }
            break;

            case ELocMetadataType.Object:
            {
                LocMetadataObject?b = default;
                archive.Read(ref b);
            }
            break;

            default:
                throw new NotImplementedException($"{_metaDataType} not implemented.");
            }
            return(archive);
        }
コード例 #22
0
ファイル: ByteBulkData.cs プロジェクト: fdsalbj/UETools
 private FArchive SerializeHeader(FArchive archive) => archive.ReadUnsafe(ref _bulkDataFlags)
 .Read(ref _elementCount)
 .Read(ref _bulkDataSizeOnDisk)
 .Read(ref _bulkDataOffsetInFile);
コード例 #23
0
 public override void Deserialize(FArchive reader)
 {
     base.Deserialize(reader);
     reader.ReadUnsafe(out _eventType);
 }
コード例 #24
0
        public FArchive Serialize(FArchive archive)
        {
            var start      = archive.Tell();
            var pakVersion = (PakVersion)archive.AssetVersion;

            archive.Read(ref _offset)
            .Read(ref _size)
            .Read(ref _uncompressedSize);
            if (pakVersion >= PakVersion.FNameBasedCompressionMethod)
            {
                // backwards incompatible 4.22
                if (archive.AssetSubversion == 1)
                {
                    var index = (byte)_compressionIndex;
                    archive.Read(ref index);
                    _compressionIndex = index;
                }
                else
                {
                    archive.Read(ref _compressionIndex);
                }
            }
            else
            {
                ECompressionFlags legacyFlags = default;
                archive.ReadUnsafe(ref legacyFlags);
                if (legacyFlags == ECompressionFlags.COMPRESS_None)
                {
                    _compressionIndex = 0;
                }
                else if ((legacyFlags & ECompressionFlags.COMPRESS_ZLIB) != 0)
                {
                    _compressionIndex = 1;
                }
                else if ((legacyFlags & ECompressionFlags.COMPRESS_GZIP) != 0)
                {
                    _compressionIndex = 2;
                }
                else if ((legacyFlags & ECompressionFlags.COMPRESS_Custom) != 0)
                {
                    _compressionIndex = 3;
                }
                else
                {
                    throw new NotImplementedException();
                }
            }

            if (pakVersion < PakVersion.NoTimestamps)
            {
                long timestamp = 0;
                archive.Read(ref timestamp); // FDateTime Timestamp
            }

            archive.Read(ref _hash);
            if (pakVersion >= PakVersion.CompressionEncryption)
            {
                if (_compressionIndex != 0)
                {
                    archive.Read(ref _compressionBlocks !);
                }

                archive.ReadUnsafe(ref _flags)
                .Read(ref _compressionBlockSize);
            }
            EntryHeaderSize = archive.Tell() - start;

            return(archive);
        }
コード例 #25
0
        public void Deserialize(FArchive reader)
        {
            const long MinimumPackageSize = 32;

            if (reader.Length() < MinimumPackageSize)
            {
                return;
            }

            reader.Read(out _tag);
            if (!IsAssetFile)
            {
                return;
            }

            const int CurrentLegacyFileVersion = -7;

            reader.Read(out int LegacyFileVersion);
            if (LegacyFileVersion < 0)
            {
                if (LegacyFileVersion < CurrentLegacyFileVersion)
                {
                    _fileVersionUE4         = 0;
                    _fileVersionLicenseeUE4 = 0;
                    return;
                }

                if (LegacyFileVersion != -4)
                {
                    // skip legacy ue3 version
                    reader.Read(out int LegacyUE3Version);
                }

                reader.ReadUnsafe(out _fileVersionUE4);
                reader.Read(out _fileVersionLicenseeUE4);

                if (LegacyFileVersion <= -2)
                {
                    CustomVersionContainer = new CustomVersionContainer(CustomVersionFormatForArchive(LegacyFileVersion));
                    CustomVersionContainer.Deserialize(reader);
                }

                if (_fileVersionUE4 == 0 && _fileVersionLicenseeUE4 == 0)
                {
                    IsUnversioned = true;
                    if (reader.Version == 0)
                    {
                        // Set latest
                        reader.Version          = _fileVersionUE4 = UE4Version.VER_UE4_AUTOMATIC_VERSION;
                        _fileVersionLicenseeUE4 = 0;
                    }
                    else
                    {
                        _fileVersionUE4 = reader.Version; // version read from config file
                    }
                }
            }
            else
            {
                _fileVersionUE4         = 0;
                _fileVersionLicenseeUE4 = 0;
            }

            reader.Read(out _totalHeaderSize);
            reader.Read(out _folderName);
            reader.ReadUnsafe(out _packageFlags);

            reader.Read(out _nameCount);
            reader.Read(out _nameOffset);

            if ((_packageFlags & EPackageFlags.FilterEditorOnly) == 0 && _fileVersionUE4 >= UE4Version.VER_UE4_ADDED_PACKAGE_SUMMARY_LOCALIZATION_ID)
            {
                reader.Read(out _localizationId);
            }

            if (_fileVersionUE4 >= UE4Version.VER_UE4_SERIALIZE_TEXT_IN_PACKAGES)
            {
                reader.Read(out _gatherableTextDataCount);
                reader.Read(out _gatherableTextDataOffset);
            }

            reader.Read(out _exportCount);
            reader.Read(out _exportOffset);
            reader.Read(out _importCount);
            reader.Read(out _importOffset);
            reader.Read(out _dependsOffset);

            if (_fileVersionUE4 < UE4Version.VER_UE4_OLDEST_LOADABLE_PACKAGE)
            {
                return;
            }

            if (_fileVersionUE4 >= UE4Version.VER_UE4_ADD_STRING_ASSET_REFERENCES_MAP)
            {
                reader.Read(out _softPackageReferencesCount);
                reader.Read(out _softPackageReferencesOffset);
            }

            if (_fileVersionUE4 >= UE4Version.VER_UE4_ADDED_SEARCHABLE_NAMES)
            {
                reader.Read(out _searchableNamesOffset);
            }

            reader.Read(out _thumbnailTableOffset);
            reader.Read(out _guid);

            reader.Read(out _generations);

            if (_fileVersionUE4 >= UE4Version.VER_UE4_ENGINE_VERSION_OBJECT)
            {
                reader.Read(out _savedByEngineVersion);
            }
            else
            {
                reader.Read(out uint changelist);
                _savedByEngineVersion = new EngineVersion(4, 0, 0, changelist, string.Empty);
            }

            if (_fileVersionUE4 >= UE4Version.VER_UE4_PACKAGE_SUMMARY_HAS_COMPATIBLE_ENGINE_VERSION)
            {
                reader.Read(out _compatibleWithEngineVersion);
            }
            else
            {
                _compatibleWithEngineVersion = _savedByEngineVersion;
            }

            reader.Read(out _compressionFlags);

            reader.Read(out _compressedChunks);
            if (_compressedChunks.Count > 0)
            {
                throw new NotSupportedException("Package Level Compression is not supported by UE4 anymore.");
            }

            reader.Read(out _packageSource);

            // No longer used: List of additional packages that are needed to be cooked for this package (ie streaming levels)
            // Keeping the serialization code for backwards compatibility without bumping the package version
            List <FString> _additionalPackagesToCook;

            reader.Read(out _additionalPackagesToCook);

            if (LegacyFileVersion > -7)
            {
                // Texture allocations no longer supported.
                reader.Read(out int NumTextureAllocations);
            }

            reader.Read(out _assetRegistryDataOffset);
            reader.Read(out _bulkDataStartOffset);

            if (_fileVersionUE4 >= UE4Version.VER_UE4_WORLD_LEVEL_INFO)
            {
                reader.Read(out _worldTileInfoDataOffset);
            }

            if (_fileVersionUE4 >= UE4Version.VER_UE4_CHANGED_CHUNKID_TO_BE_AN_ARRAY_OF_CHUNKIDS)
            {
                reader.Read(out _chunkIDs);
            }
            else if (_fileVersionUE4 >= UE4Version.VER_UE4_ADDED_CHUNKID_TO_ASSETDATA_AND_UPACKAGE)
            {
                reader.Read(out _chunkIDs, 1);
            }

            if (_fileVersionUE4 >= UE4Version.VER_UE4_PRELOAD_DEPENDENCIES_IN_COOKED_EXPORTS)
            {
                reader.Read(out _preloadDependencyCount);
                reader.Read(out _preloadDependencyOffset);
            }
        }
コード例 #26
0
 public override void Deserialize(FArchive reader)
 {
     base.Deserialize(reader);
     reader.Read(out _useConst);
     reader.ReadUnsafe(out _const);
 }