Ejemplo n.º 1
0
 public FClothingSectionData(BinaryReader reader)
 {
     asset_guid      = new FGuid(reader);
     asset_lod_index = reader.ReadInt32();
 }
Ejemplo n.º 2
0
 public FGuidCustomVersion(BinaryReader reader)
 {
     Key          = new FGuid(reader);
     Version      = reader.ReadInt32();
     FriendlyName = reader.ReadString();
 }
Ejemplo n.º 3
0
        void SerializePackageFileSummary4(BinaryReader reader)
        {
            if (LegacyVersion < LatestSupportedLegacyVer || LegacyVersion >= -1) // -2 is supported
            {
                throw new NotImplementedException("Unsuported version: " + LegacyVersion);
            }

            IsUnversioned = false;

            // read versions
            int VersionUE3, Version, LicenseeVersion; // note: using int32 instead of uint16 as in UE1-UE3

            if (LegacyVersion != -4)                  // UE4 had some changes for version -4, but these changes were reverted in -5 due to some problems
            {
                VersionUE3 = reader.ReadInt32();
            }
            Version         = reader.ReadInt32();
            LicenseeVersion = reader.ReadInt32();
            // VersionUE3 is ignored
            if ((Version & ~0xFFFF) != 0 || (LicenseeVersion & ~0xFFFF) != 0)
            {
                throw new IOException("Invalid Version or Licensee Version.");
            }
            FileVersion          = unchecked ((ushort)(Version & 0xFFFF));
            this.LicenseeVersion = unchecked ((ushort)(LicenseeVersion & 0xFFFF));

            if (FileVersion == 0 && LicenseeVersion == 0)
            {
                IsUnversioned = true;
            }

            if (IsUnversioned)
            {
                int ver    = -LegacyVersion - 1;
                int verMin = legacyVerToEngineVer[ver];
                int verMax = legacyVerToEngineVer[ver + 1] - 1;
                int selectedVersion;
                if (verMax < verMin)
                {
                    // if LegacyVersion exactly matches single engine version, don't show any UI
                    selectedVersion = verMin;
                }
                else
                {
                    // display UI if it is supported
                    selectedVersion = GAME_UE4_BASE + (22 << 4); // 4.22
                    if (!(selectedVersion >= 0 && selectedVersion <= LATEST_SUPPORTED_UE4_VERSION))
                    {
                        throw new InvalidOperationException("Invalid version");
                    }
                }
            }

            if (LegacyVersion <= -2)
            {
                // CustomVersions array - not serialized to unversioned packages, and UE4 always consider
                // all custom versions to use highest available value. However this is used for versioned
                // packages: engine starts to use custom versions heavily starting with 4.12.
                CustomVersionContainer = new FCustomVersionContainer(reader, LegacyVersion);
            }

            HeadersSize  = reader.ReadInt32();
            PackageGroup = reader.ReadString();
            PackageFlags = reader.ReadInt32();

            NameCount  = reader.ReadInt32();
            NameOffset = reader.ReadInt32();

            if (this.Version >= VER_UE4_ADDED_PACKAGE_SUMMARY_LOCALIZATION_ID) // also contains editor data but idk
            {
                string LocalizationId = reader.ReadString();
            }

            if (this.Version >= VER_UE4_SERIALIZE_TEXT_IN_PACKAGES)
            {
                int GatherableTextDataCount, GatherableTextDataOffset;
                GatherableTextDataCount  = reader.ReadInt32();
                GatherableTextDataOffset = reader.ReadInt32();
            }

            ExportCount   = reader.ReadInt32();
            ExportOffset  = reader.ReadInt32();
            ImportCount   = reader.ReadInt32();
            ImportOffset  = reader.ReadInt32();
            DependsOffset = reader.ReadInt32();

            if (this.Version >= VER_UE4_ADD_STRING_ASSET_REFERENCES_MAP)
            {
                int StringAssetReferencesCount, StringAssetReferencesOffset;
                StringAssetReferencesCount  = reader.ReadInt32();
                StringAssetReferencesOffset = reader.ReadInt32();
            }

            if (this.Version >= VER_UE4_ADDED_SEARCHABLE_NAMES)
            {
                int SearchableNamesoffset;
                SearchableNamesoffset = reader.ReadInt32();
            }

            // there's a thumbnail table in source packages with following layout
            // * package headers
            // * thumbnail data - sequence of FObjectThumbnail
            // * thumbnail metadata - array of small headers pointed to 'thumbnail data' objects
            //   (this metadata is what FPackageFileSummary::ThumbnailTableOffset points to)
            int ThumbnailTableOffset = reader.ReadInt32();

            // guid and generations
            Guid = new FGuid(reader);
            int Count = reader.ReadInt32();

            Generations = new FGenerationInfo[Count];
            for (int i = 0; i < Count; i++)
            {
                Generations[i] = new FGenerationInfo(reader, this.Version);
            }

            // engine version
            if (this.Version >= VER_UE4_ENGINE_VERSION_OBJECT)
            {
                FEngineVersion engineVersion; // empty for cooked packages, so don't store it anywhere ...
                engineVersion = new FEngineVersion(reader);
            }
            else
            {
                int changelist = reader.ReadInt32();
            }

            if (this.Version >= VER_UE4_PACKAGE_SUMMARY_HAS_COMPATIBLE_ENGINE_VERSION)
            {
                FEngineVersion CompatibleVersion = new FEngineVersion(reader);
            }

            // compression structures
            CompressionFlags = reader.ReadInt32();
            CompressedChunks = reader.ReadTArray(() => new FCompressedChunk(reader));

            int PackageSource = reader.ReadInt32();

            string[] AdditionalPackagesToCook = reader.ReadTArray(() => reader.ReadString());

            if (LegacyVersion > -7)
            {
                int NumTextureAllocations = reader.ReadInt32();
                if (NumTextureAllocations != 0) // actually this was an array before
                {
                    throw new IOException("Array length must be 0");
                }
            }

            if (this.Version >= VER_UE4_ASSET_REGISTRY_TAGS)
            {
                int AssetRegistryDataOffset = reader.ReadInt32();
            }

            if (this.Version >= VER_UE4_SUMMARY_HAS_BULKDATA_OFFSET)
            {
                BulkDataStartOffset = reader.ReadInt64();
            }

            //!! other fields - useless for now
        }
Ejemplo n.º 4
0
 public FCustomVersion(BinaryReader reader)
 {
     Key     = new FGuid(reader);
     Version = reader.ReadInt32();
 }