Exemple #1
0
 public void Deserialize(IUnrealStream stream)
 {
     if (stream.Version <= 540)
     {
         // e.g. Core.Object.X
         FieldName = stream.ReadText();
     }
     else
     {
         FieldIndex = stream.ReadObjectIndex();
     }
     MetaTags = new UArray <UMetaTag>();
     MetaTags.Deserialize(stream, tag => tag.Owner = Owner);
 }
Exemple #2
0
        protected override void Deserialize()
        {
            base.Deserialize();

            if (Package.Version <= 61)
            {
                var oldClassRecordSize = _Buffer.ReadIndex();
                Record("oldClassRecordSize", oldClassRecordSize);
            }

#if BIOSHOCK
            if (Package.Build == UnrealPackage.GameBuild.BuildName.Bioshock)
            {
                var unknown = _Buffer.ReadInt32();
                Record("???Bioshock_Int32", unknown);
            }
#endif

            ClassFlags = _Buffer.ReadUInt32();
            Record("ClassFlags", (ClassFlags)ClassFlags);

            // Both were deprecated since then
            // TODO: Corrigate Version
            if (Package.Version < 140)
            {
                ClassGuid = _Buffer.ReadGuid();
                Record("ClassGuid", ClassGuid);

                // Use ReadCount because Vanguard does no longer uses indexes but an int32 for arrays.
                var depSize = ReadCount();
                Record("DepSize", depSize);
                if (depSize > 0)
                {
                    ClassDependencies = new UArray <Dependency>(_Buffer, depSize);
                    Record("ClassDependencies", ClassDependencies);
                }

                PackageImports = DeserializeGroup("PackageImports");
            }

            if (Package.Version >= 62)
            {
                // TODO: Corrigate Version
                // At least since Bioshock(140) - 547(APB)
                if (Package.Version >= 140 && Package.Version < 547)
                {
                    var unknown = _Buffer.ReadByte();
                    Record("???", unknown);
                }

                // Class Name Extends Super.Name Within _WithinIndex
                //      Config(_ConfigIndex);
                Within = _Buffer.ReadObject() as UClass;
                Record("Within", Within);
                ConfigName = _Buffer.ReadNameReference();
                Record("ConfigName", ConfigName);

                const int vHideCategoriesOldOrder  = 539;
                var       isHideCategoriesOldOrder = Package.Version <= vHideCategoriesOldOrder
#if TERA
                                                     || Package.Build == UnrealPackage.GameBuild.BuildName.Tera
#endif
                ;

                // TODO: Corrigate Version
                if (Package.Version >= 100)
                {
                    // TODO: Corrigate Version
                    if (Package.Version >= 220)
                    {
                        // TODO: Corrigate Version
                        if (isHideCategoriesOldOrder && !Package.IsConsoleCooked() && !Package.Build.IsXenonCompressed)
                        {
                            DeserializeHideCategories();
                        }

                        DeserializeComponentsMap();

                        // RoboBlitz(369)
                        // TODO: Corrigate Version
                        if (Package.Version >= 369)
                        {
                            DeserializeInterfaces();
                        }
                    }

                    if (!Package.IsConsoleCooked() && !Package.Build.IsXenonCompressed)
                    {
                        if (Package.Version >= 603
 #if TERA
                            && Package.Build != UnrealPackage.GameBuild.BuildName.Tera
#endif
                            )
                        {
                            DontSortCategories = DeserializeGroup("DontSortCategories");
                        }

                        // TODO: Corrigate Version
                        if (Package.Version < 220 || !isHideCategoriesOldOrder)
                        {
                            DeserializeHideCategories();
                        }

                        // TODO: Corrigate Version
                        if (Package.Version >= 185)
                        {
                            // 490:GoW1, 576:CrimeCraft
                            if ((!HasClassFlag(Flags.ClassFlags.CollapseCategories)) ||
                                Package.Version <= vHideCategoriesOldOrder || Package.Version >= 576)
                            {
                                AutoExpandCategories = DeserializeGroup("AutoExpandCategories");
                            }

                            if (Package.Version > 670)
                            {
                                AutoCollapseCategories = DeserializeGroup("AutoCollapseCategories");

                                if (Package.Version >= 749
                                    #if SPECIALFORCE2
                                    && Package.Build != UnrealPackage.GameBuild.BuildName.SpecialForce2
                                    #endif
                                    )
                                {
                                    // bForceScriptOrder
                                    ForceScriptOrder = _Buffer.ReadInt32() > 0;
                                    Record("ForceScriptOrder", ForceScriptOrder);

#if DISHONORED
                                    if (Package.Build == UnrealPackage.GameBuild.BuildName.Dishonored)
                                    {
                                        var unk = _Buffer.ReadNameIndex();
                                        Record("??DISHONORED_NameIndex", Package.Names[unk]);
                                    }
#endif

                                    if (Package.Version >= UnrealPackage.VCLASSGROUP)
                                    {
#if DISHONORED
                                        if (Package.Build == UnrealPackage.GameBuild.BuildName.Dishonored)
                                        {
                                            NativeClassName = _Buffer.ReadText();
                                            Record("NativeClassName", NativeClassName);
                                            goto skipClassGroups;
                                        }
#endif
                                        ClassGroups = DeserializeGroup("ClassGroups");
                                        if (Package.Version >= 813)
                                        {
                                            NativeClassName = _Buffer.ReadText();
                                            Record("NativeClassName", NativeClassName);
                                        }
                                    }
#if DISHONORED
                                    skipClassGroups :;
#endif
                                }
                            }

                            // FIXME: Found first in(V:655), Definitely not in APB and GoW 2
                            // TODO: Corrigate Version
                            if (Package.Version > 575 && Package.Version < 674
#if TERA
                                && Package.Build != UnrealPackage.GameBuild.BuildName.Tera
#endif
                                )
                            {
                                int unk2 = _Buffer.ReadInt32();
                                Record("??Int32", unk2);

                                #if SINGULARITY
                                if (Package.Build == UnrealPackage.GameBuild.BuildName.Singularity)
                                {
                                    _Buffer.Skip(8);
                                }
                                #endif
                            }
                        }
                    }

                    if (Package.Version >= UnrealPackage.VDLLBIND)
                    {
                        DLLBindName = _Buffer.ReadNameReference();
                        Record("DLLBindName", DLLBindName);
#if REMEMBERME
                        if (Package.Build == UnrealPackage.GameBuild.BuildName.RememberMe)
                        {
                            var unknownName = _Buffer.ReadNameReference();
                            Record("??RM_Name", unknownName);
                        }
#endif
#if DISHONORED
                        if (Package.Build == UnrealPackage.GameBuild.BuildName.Dishonored)
                        {
                            ClassGroups = DeserializeGroup("ClassGroups");
                        }
#endif
#if BORDERLANDS2
                        if (Package.Build == UnrealPackage.GameBuild.BuildName.Borderlands2)
                        {
                            var unkval = _Buffer.ReadByte();
                            Record("??BL2_Byte", unkval);
                        }
#endif
                    }
                }
            }

            // In later UE3 builds, defaultproperties are stored in separated objects named DEFAULT_namehere,
            // TODO: Corrigate Version
            if (Package.Version >= 322)
            {
                Default = _Buffer.ReadObject();
                Record("Default", Default);
            }
            else
            {
#if SWAT4
                if (Package.Build == UnrealPackage.GameBuild.BuildName.Swat4)
                {
                    // We are done here!
                    return;
                }
#endif
                DeserializeProperties();
            }
        }
Exemple #3
0
 protected override void Deserialize()
 {
     base.Deserialize();
     MetaObjects = new UArray <UFieldData>();
     MetaObjects.Deserialize(_Buffer);
 }
Exemple #4
0
 protected override void Deserialize()
 {
     base.Deserialize();
     _MetaFields = new UArray <UMetaField>();
     _MetaFields.Deserialize(_Buffer, field => field.Owner = Package);
 }