Ejemplo n.º 1
0
        internal FAssetIdentifier(FNameTableArchiveReader reader)
        {
            PackageName      = default;
            PrimaryAssetType = default;
            ObjectName       = default;
            ValueName        = default;

            byte FieldBits = reader.Loader.ReadByte();

            if ((FieldBits & (1 << 0)) != 0)
            {
                PackageName = reader.ReadFName();
            }
            if ((FieldBits & (1 << 1)) != 0)
            {
                PrimaryAssetType = reader.ReadFName();
            }
            if ((FieldBits & (1 << 2)) != 0)
            {
                ObjectName = reader.ReadFName();
            }
            if ((FieldBits & (1 << 3)) != 0)
            {
                ValueName = reader.ReadFName();
            }
        }
        internal FAssetDataTagMapSharedView(FNameTableArchiveReader reader)
        {
            int l = reader.Loader.ReadInt32();

            Map = new SortedList <string, string>(l);
            for (int i = 0; i < l; i++)
            {
                Map[reader.ReadFName().String] = reader.Loader.ReadFString();
            }
        }
Ejemplo n.º 3
0
        internal FAssetData(FNameTableArchiveReader reader)
        {
            ObjectPath  = reader.ReadFName();
            PackagePath = reader.ReadFName();
            AssetClass  = reader.ReadFName();

            PackageName = reader.ReadFName();
            AssetName   = reader.ReadFName();

            TagsAndValues = new FAssetDataTagMapSharedView(reader);
            ChunkIDs      = reader.Loader.ReadTArray(() => reader.Loader.ReadInt32());
            PackageFlags  = reader.Loader.ReadInt32();
        }
Ejemplo n.º 4
0
 internal FAssetPackageData(FNameTableArchiveReader reader, bool bSerializeHash)
 {
     PackageName = reader.ReadFName();
     DiskSize    = reader.Loader.ReadInt64();
     PackageGuid = new FGuid(reader.Loader);
     if (bSerializeHash)
     {
         CookedHash = new FMD5Hash(reader.Loader);
     }
     else
     {
         CookedHash = default;
     }
 }
Ejemplo n.º 5
0
        internal FAssetRegistryState(BinaryReader reader)
        {
            var Version = FAssetRegistryVersion.DeserializeVersion(reader);

            if (Version < FAssetRegistryVersion.Type.AddedCookedMD5Hash)
            {
                throw new FileLoadException("Cannot read states before this version");
            }

            var nameReader = new FNameTableArchiveReader(reader);

            var LocalNumAssets = reader.ReadInt32();

            PreallocatedAssetDataBuffers = new FAssetData[LocalNumAssets];

            for (int i = 0; i < LocalNumAssets; i++)
            {
                PreallocatedAssetDataBuffers[i] = new FAssetData(nameReader);
            }

            var LocalNumDependsNodes = reader.ReadInt32();

            PreallocatedDependsNodeDataBuffers = new FDependsNode[LocalNumDependsNodes];
            for (int i = 0; i < LocalNumDependsNodes; i++)
            {
                PreallocatedDependsNodeDataBuffers[i] = new FDependsNode();
            }

            SortedList <EAssetRegistryDependencyType, int> DepCounts = new SortedList <EAssetRegistryDependencyType, int>();

            for (int i = 0; i < LocalNumDependsNodes; i++)
            {
                FAssetIdentifier AssetIdentifier = new FAssetIdentifier(nameReader);

                DepCounts[EAssetRegistryDependencyType.Hard]           = reader.ReadInt32();
                DepCounts[EAssetRegistryDependencyType.Soft]           = reader.ReadInt32();
                DepCounts[EAssetRegistryDependencyType.SearchableName] = reader.ReadInt32();
                DepCounts[EAssetRegistryDependencyType.SoftManage]     = reader.ReadInt32();
                DepCounts[EAssetRegistryDependencyType.HardManage]     = Version < FAssetRegistryVersion.Type.AddedHardManage ? 0 : reader.ReadInt32();
                DepCounts[0] = reader.ReadInt32();

                PreallocatedDependsNodeDataBuffers[i].Identifier = AssetIdentifier;
                PreallocatedDependsNodeDataBuffers[i].Reserve(DepCounts);

                for (int x = 0; x < DepCounts[EAssetRegistryDependencyType.Hard]; ++x)
                {
                    int index = reader.ReadInt32();

                    if (index < 0 || index >= LocalNumDependsNodes)
                    {
                        throw new FileLoadException("could you please serialize your assetregistry correctly");
                    }

                    PreallocatedDependsNodeDataBuffers[i].Add(index, EAssetRegistryDependencyType.Hard);
                }
                for (int x = 0; x < DepCounts[EAssetRegistryDependencyType.Soft]; ++x)
                {
                    int index = reader.ReadInt32();

                    if (index < 0 || index >= LocalNumDependsNodes)
                    {
                        throw new FileLoadException("could you please serialize your assetregistry correctly");
                    }

                    PreallocatedDependsNodeDataBuffers[i].Add(index, EAssetRegistryDependencyType.Soft);
                }
                for (int x = 0; x < DepCounts[EAssetRegistryDependencyType.SearchableName]; ++x)
                {
                    int index = reader.ReadInt32();

                    if (index < 0 || index >= LocalNumDependsNodes)
                    {
                        throw new FileLoadException("could you please serialize your assetregistry correctly");
                    }

                    PreallocatedDependsNodeDataBuffers[i].Add(index, EAssetRegistryDependencyType.SearchableName);
                }
                for (int x = 0; x < DepCounts[EAssetRegistryDependencyType.SoftManage]; ++x)
                {
                    int index = reader.ReadInt32();

                    if (index < 0 || index >= LocalNumDependsNodes)
                    {
                        throw new FileLoadException("could you please serialize your assetregistry correctly");
                    }

                    PreallocatedDependsNodeDataBuffers[i].Add(index, EAssetRegistryDependencyType.SoftManage);
                }
                for (int x = 0; x < DepCounts[EAssetRegistryDependencyType.HardManage]; ++x)
                {
                    int index = reader.ReadInt32();

                    if (index < 0 || index >= LocalNumDependsNodes)
                    {
                        throw new FileLoadException("could you please serialize your assetregistry correctly");
                    }

                    PreallocatedDependsNodeDataBuffers[i].Add(index, EAssetRegistryDependencyType.HardManage);
                }
                for (int x = 0; x < DepCounts[0]; ++x)
                {
                    int index = reader.ReadInt32();

                    if (index < 0 || index >= LocalNumDependsNodes)
                    {
                        throw new FileLoadException("could you please serialize your assetregistry correctly");
                    }

                    PreallocatedDependsNodeDataBuffers[i].Add(index, 0);
                }
            }

            int LocalNumPackageData = reader.ReadInt32();

            PreallocatedPackageDataBuffers = new FAssetPackageData[LocalNumPackageData];

            var bSerializeHash = Version < FAssetRegistryVersion.Type.AddedCookedMD5Hash;

            for (int i = 0; i < LocalNumPackageData; i++)
            {
                PreallocatedPackageDataBuffers[i] = new FAssetPackageData(nameReader, bSerializeHash);
            }
        }