Пример #1
0
        public static EmbeddedGameObjectTableHead ReadEntry(IOMemoryStream ms, UAssetFile f)
        {
            //Read in
            EmbeddedGameObjectTableHead g = new EmbeddedGameObjectTableHead();

            g.entryLocation = ms.position;
            g.id            = ms.ReadInt();
            g.unknown2      = ms.ReadInt();
            g.unknown3      = ms.ReadInt();
            g.type          = ms.ReadNameTableEntry(f);
            g.unknown4      = ms.ReadInt();
            g.unknown5      = ms.ReadInt();
            g.dataLength    = ms.ReadInt();
            g.dataLocation  = ms.ReadInt();
            g.unknown6      = ms.ReadInt();
            g.unknown7      = ms.ReadInt();
            g.unknown8      = ms.ReadInt();
            g.unknown9      = ms.ReadInt();
            g.unknown10     = ms.ReadInt();
            g.unknown11     = ms.ReadInt();
            g.unknown12     = ms.ReadInt();
            g.unknown13     = ms.ReadInt();
            g.unknown14     = ms.ReadInt();
            return(g);
        }
Пример #2
0
        /// <summary>
        /// Opens a UAssetFile
        /// </summary>
        /// <returns></returns>
        public virtual void ReadFile(System.IO.Stream s, bool isDebugEnabled, string classname, string rootPath)
        {
            this.isDebugModeEnabled = isDebugEnabled;
            this.classname = classname;
            this.rootPath = rootPath;

            //Create a stream
            stream = new IOMemoryStream(s, true);

            //Read header data
            ReadHeaderData();

            //Read name table
            ReadNameTable();

            //Read GameObject headers
            ReadGameObjectReferences();

            //Now, read embedded GameObject headers
            ReadEmbeddedGameObjectReferences();

            //Read metadata
            ReadPackageMetadata();

            //Get parent classname
            /*hasParentUObject = false;
            if(metadata.ContainsKey("ParentClassPackage"))
            {
                hasParentUObject = TryGetFullPackagePath(metadata["ParentClassPackage"], out parentPath);
                parentClassname = GetPackageClassnameFromPath(metadata["ParentClassPackage"]);
            }*/
        }
Пример #3
0
        public static GameObjectTableHead ReadEntry(IOMemoryStream ms, UAssetFile f)
        {
            //Read in
            GameObjectTableHead g = new GameObjectTableHead();

            g.startPos   = ms.position;
            g.coreType   = ms.ReadNameTableEntry(f);
            g.unknown1   = ms.ReadInt();
            g.objectType = ms.ReadNameTableEntry(f);
            g.unknown2   = ms.ReadInt();
            g.index      = ms.ReadInt();
            g.name       = ms.ReadNameTableEntry(f);
            g.unknown4   = ms.ReadInt();
            return(g);
        }
Пример #4
0
        public static List <UProperty> ReadProperties(IOMemoryStream ms, UAssetFile f, string arrayType, bool isStruct)
        {
            //Read until none
            List <UProperty> output = new List <UProperty>();

            while (true)
            {
                UProperty p = ReadProp(ms, f, arrayType, isStruct);
                if (p == null)
                {
                    break;
                }
                output.Add(p);
            }
            return(output);
        }
Пример #5
0
 public abstract void ReadStruct(IOMemoryStream ms, UAssetFile f, StructProperty s);
Пример #6
0
        public static UProperty ReadProp(IOMemoryStream ms, UAssetFile f, string arrayType, bool isStruct)
        {
            //Read the name
            long start = ms.position;

            //Read the remainder of the properties
            string name;
            int    u1;
            string type;
            int    u2;
            int    length;
            int    index;

            if (arrayType == null)
            {
                //Not an array
                name = ms.ReadNameTableEntry(f);

                //Return null if this is "None". That means we're done reading
                if (name == "None")
                {
                    return(null);
                }

                u1     = ms.ReadInt();
                type   = ms.ReadNameTableEntry(f);
                u2     = ms.ReadInt();
                length = ms.ReadInt();
                index  = ms.ReadInt();
            }
            else
            {
                name   = null;
                u1     = 0;
                type   = arrayType;
                u2     = 0;
                length = 0;
                index  = 0;
            }
            long payloadStart = ms.position;

            //Create the object
            UProperty u;

            switch (type)
            {
            case "ArrayProperty": u = new ArrayProperty(ms, f); break;

            case "BoolProperty": u = new BoolProperty(ms, f); break;

            case "ByteProperty": u = new ByteProperty(ms, f); break;

            case "DoubleProperty": u = new DoubleProperty(ms, f); break;

            case "FloatProperty": u = new FloatProperty(ms, f); break;

            case "Int16Property": u = new Int16Property(ms, f); break;

            case "Int8Property": u = new Int8Property(ms, f); break;

            case "IntProperty": u = new IntProperty(ms, f); break;

            case "NameProperty": u = new NameProperty(ms, f); break;

            case "ObjectProperty": u = new ObjectProperty(ms, f); break;

            case "StrProperty": u = new StrProperty(ms, f); break;

            case "StructProperty": u = new StructProperty(ms, f); break;

            case "TextProperty": u = new TextProperty(ms, f); break;

            case "UInt16Property": u = new UInt16Property(ms, f); break;

            case "UInt32Property": u = new UInt32Property(ms, f); break;

            case "UInt64Property": u = new UInt64Property(ms, f); break;

            default:
                throw new Exception($"FAILED TO READ UPROPERTY: Type {type} was not a valid type. Name={name}, u1={u1}, u2={u2}, length={length}, index={index}, position={start}");
            }

            //Set attributes
            u.name         = name;
            u.unknown1     = u1;
            u.type         = type;
            u.unknown2     = u2;
            u.length       = length;
            u.index        = index;
            u.start        = start;
            u.payloadStart = payloadStart;
            u.isArray      = arrayType != null;

            //Dump
            f.DebugDump("UProperty Reading", ConsoleColor.Green, "name", name, "u1", u1.ToString(), "type", type, "u2", u2.ToString(), "length", length.ToString(), "index", index.ToString(), "start", start.ToString(), "payloadStart", payloadStart.ToString());

            //Read
            u.Read(ms, f);

            //Log
            string msg = u.WriteString();

            f.Debug("UProperty Read " + type, msg, ConsoleColor.DarkGreen);

            return(u);
        }
Пример #7
0
 public UProperty(IOMemoryStream ms, UAssetFile f)
 {
 }
Пример #8
0
 public abstract void Read(IOMemoryStream ms, UAssetFile f);