Esempio n. 1
0
        public static FString GetImportNameReferenceWithoutZero(int j, UAsset asset)
        {
            FString refer = new FPackageIndex(j).ToImport(asset).ObjectName.Value;

            if (!asset.ContainsNameReference(refer))
            {
                return(refer);
            }
            return(asset.GetNameReferenceWithoutZero(asset.SearchNameReference(refer)));
        }
Esempio n. 2
0
 public KismetPropertyPointer XFER_PROP_POINTER()
 {
     if (Asset.EngineVersion >= KismetPropertyPointer.XFER_PROP_POINTER_SWITCH_TO_SERIALIZING_AS_FIELD_PATH_VERSION)
     {
         int     numEntries = this.ReadInt32();
         FName[] allNames   = new FName[numEntries];
         for (int i = 0; i < numEntries; i++)
         {
             allNames[i] = this.ReadFName();
         }
         FPackageIndex owner = this.XFER_OBJECT_POINTER();
         return(new KismetPropertyPointer(new FFieldPath(allNames, owner)));
     }
     else
     {
         return(new KismetPropertyPointer(this.XFERPTR()));
     }
 }
Esempio n. 3
0
        public override void Read(AssetBinaryReader reader, int nextStarting)
        {
            base.Read(reader, nextStarting);

            int numFuncIndexEntries = reader.ReadInt32();

            FuncMap = new TMap <FName, FPackageIndex>();
            for (int i = 0; i < numFuncIndexEntries; i++)
            {
                FName         functionName   = reader.ReadFName();
                FPackageIndex functionExport = FPackageIndex.FromRawIndex(reader.ReadInt32());

                FuncMap.Add(functionName, functionExport);
            }

            ClassFlags = (EClassFlags)reader.ReadUInt32();

            if (Asset.EngineVersion < UE4Version.VER_UE4_CLASS_NOTPLACEABLE_ADDED)
            {
                ClassFlags ^= EClassFlags.CLASS_NotPlaceable;
            }

            ClassWithin     = new FPackageIndex(reader.ReadInt32());
            ClassConfigName = reader.ReadFName();
            Asset.AddNameReference(ClassConfigName.Value);

            int  numInterfaces   = 0;
            long interfacesStart = 0;

            if (Asset.EngineVersion < UE4Version.VER_UE4_UCLASS_SERIALIZE_INTERFACES_AFTER_LINKING)
            {
                interfacesStart = reader.BaseStream.Position;
                numInterfaces   = reader.ReadInt32();
                reader.BaseStream.Seek(interfacesStart + sizeof(int) + numInterfaces * (sizeof(int) * 3), SeekOrigin.Begin);
            }

            // Linking procedure here; I don't think anything is really serialized during this
            ClassGeneratedBy = new FPackageIndex(reader.ReadInt32());

            long currentOffset = reader.BaseStream.Position;

            if (Asset.EngineVersion < UE4Version.VER_UE4_UCLASS_SERIALIZE_INTERFACES_AFTER_LINKING)
            {
                reader.BaseStream.Seek(interfacesStart, SeekOrigin.Begin);
            }
            numInterfaces = reader.ReadInt32();
            Interfaces    = new SerializedInterfaceReference[numInterfaces];
            for (int i = 0; i < numInterfaces; i++)
            {
                Interfaces[i] = new SerializedInterfaceReference(reader.ReadInt32(), reader.ReadInt32(), reader.ReadInt32() == 1);
            }
            if (Asset.EngineVersion < UE4Version.VER_UE4_UCLASS_SERIALIZE_INTERFACES_AFTER_LINKING)
            {
                reader.BaseStream.Seek(currentOffset, SeekOrigin.Begin);
            }

            bDeprecatedForceScriptOrder = reader.ReadInt32() == 1;

            reader.ReadInt64(); // None

            if (Asset.EngineVersion >= UE4Version.VER_UE4_ADD_COOKED_TO_UCLASS)
            {
                bCooked = reader.ReadInt32() == 1;
            }

            ClassDefaultObject = new FPackageIndex(reader.ReadInt32());

            // CDO serialization usually comes after this export has finished serializing
        }
Esempio n. 4
0
 public FFieldPath(FName[] path, FPackageIndex resolvedOwner)
 {
     Path          = path;
     ResolvedOwner = resolvedOwner;
 }
Esempio n. 5
0
 public int XFER_OBJECT_POINTER(FPackageIndex val)
 {
     return(this.XFERPTR(val));
 }
Esempio n. 6
0
 public int XFERPTR(FPackageIndex val)
 {
     this.Write(val.Index);
     return(PointerSize); // For the iCode offset, we return the size of a pointer in memory rather than the size of an FPackageIndex on disk
 }
Esempio n. 7
0
        public override void Read(AssetBinaryReader reader, int nextStarting)
        {
            base.Read(reader, nextStarting);

            SuperStruct = new FPackageIndex(reader.ReadInt32());

            int numIndexEntries = reader.ReadInt32();

            Children = new FPackageIndex[numIndexEntries];
            for (int i = 0; i < numIndexEntries; i++)
            {
                Children[i] = new FPackageIndex(reader.ReadInt32());
            }

            if (Asset.GetCustomVersion <FCoreObjectVersion>() >= FCoreObjectVersion.FProperties)
            {
                int numProps = reader.ReadInt32();
                LoadedProperties = new FProperty[numProps];
                for (int i = 0; i < numProps; i++)
                {
                    LoadedProperties[i] = MainSerializer.ReadFProperty(reader);
                }
            }
            else
            {
                LoadedProperties = new FProperty[0];
            }

            ScriptBytecodeSize = reader.ReadInt32();     // # of bytes in total in deserialized memory
            int  scriptStorageSize = reader.ReadInt32(); // # of bytes in total
            long startedReading    = reader.BaseStream.Position;

            bool willParseRaw = true;

            try
            {
                if (ParseBytecode && Asset.EngineVersion >= UE4Version.VER_UE4_16)
                {
                    var tempCode = new List <Kismet.Bytecode.KismetExpression>();
                    while ((reader.BaseStream.Position - startedReading) < scriptStorageSize)
                    {
                        tempCode.Add(ExpressionSerializer.ReadExpression(reader));
                    }
                    ScriptBytecode = tempCode.ToArray();
                    willParseRaw   = false;
                }
            }
            catch (Exception ex)
            {
#if DEBUG
                Debug.WriteLine(ex.StackTrace);
#endif
            }

            if (willParseRaw)
            {
                reader.BaseStream.Seek(startedReading, SeekOrigin.Begin);
                ScriptBytecode    = null;
                ScriptBytecodeRaw = reader.ReadBytes(scriptStorageSize);
            }
        }