Esempio n. 1
0
 private void Parse(AssetsReader reader)
 {
     ObjectID   = reader.ReadInt64();
     DataOffset = reader.ReadInt32();
     DataSize   = reader.ReadInt32();
     TypeIndex  = reader.ReadInt32();
 }
Esempio n. 2
0
 private void Parse(AssetsReader reader)
 {
     Version    = reader.ReadInt16();
     Depth      = reader.ReadSByte();
     IsArray    = reader.ReadBoolean();
     TypeOffset = reader.ReadInt32();
     NameOffset = reader.ReadInt32();
     Size       = reader.ReadInt32();
     Index      = reader.ReadInt32();
     Flags      = reader.ReadInt32();
 }
Esempio n. 3
0
        private void Parse(AssetsReader reader)
        {
            int numTreeNodes     = reader.ReadInt32();
            int stringBufferSize = reader.ReadInt32();

            for (int i = 0; i < numTreeNodes; i++)
            {
                Entries.Add(new TypeTreeEntry(reader));
            }
            StringBuffer = new String(reader.ReadChars(stringBufferSize));
        }
Esempio n. 4
0
        public void Parse(AssetsReader reader)
        {
            Version      = reader.ReadCStr();
            Platform     = reader.ReadInt32();
            HasTypeTrees = reader.ReadBoolean();
            int numTypes = reader.ReadInt32();

            for (int i = 0; i < numTypes; i++)
            {
                Types.Add(new AssetsType(reader, HasTypeTrees));
            }

            List <ObjectRecord> records = new List <ObjectRecord>();
            int numObj = reader.ReadInt32();

            for (int i = 0; i < numObj; i++)
            {
                reader.AlignTo(4);
                var obj = new ObjectRecord(reader);
                records.Add(obj);
            }

            int numAdds = reader.ReadInt32();

            for (int i = 0; i < numAdds; i++)
            {
                reader.AlignTo(4);
                Adds.Add(new RawPtr(reader));
            }
            int numExt = reader.ReadInt32();

            for (int i = 0; i < numExt; i++)
            {
                ExternalFiles.Add(new ExternalFile(reader));
            }
            reader.ReadCStr();

            //load the object infos in order based on their type
            foreach (var record in records.OrderBy(x => PreloadObjectOrder(x)).ThenBy(x => x.ObjectID))
            {
                var obj = ObjectInfo <AssetsObject> .Parse(ParentFile, record);

                ObjectInfos.Add(obj);
                if (ShouldForceLoadObject(record))
                {
                    var o = obj.Object;
                }
            }
        }
Esempio n. 5
0
        public static SmartPtr <T> Read(AssetsFile assetsFile, AssetsObject owner, AssetsReader reader)
        {
            if (owner == null)
            {
                Log.LogErr("WARNING: SmartPtr created without an owner!");
            }
            int fileID = reader.ReadInt32();

            reader.AlignTo(4);
            Int64 pathID = reader.ReadInt64();

            if (fileID == 0 && pathID == 0)
            {
                return(new SmartPtr <T>());
            }

            var objInfo = assetsFile.GetObjectInfo <T>(fileID, pathID);

            if (objInfo == null)
            {
                Log.LogErr($"WARNING: Could not find objectinfo for creating SmartPtr of type {typeof(T).Name} on owner type {owner?.GetType()?.Name ?? "(null owner)"}!  Returned a null pointer instead.");
                return(null);
            }

            SmartPtr <T> ptr = new SmartPtr <T>(owner, assetsFile.GetObjectInfo <T>(fileID, pathID));

            //TODO: not sure this is only ever called by existing objects
            ptr.IsNew = false;

            return(ptr);
        }
Esempio n. 6
0
 private void Parse(AssetsReader reader, bool hasTypeTree)
 {
     ClassID  = reader.ReadInt32();
     Unknown1 = reader.ReadSByte();
     Unknown2 = reader.ReadInt16();
     if (IsScriptType)
     {
         ScriptHash = reader.ReadGuid();
     }
     TypeHash = reader.ReadGuid();
     if (hasTypeTree)
     {
         TypeTree = new TypeTree(reader);
     }
 }
Esempio n. 7
0
 private void Parse(AssetsReader reader)
 {
     FileID = reader.ReadInt32();
     reader.AlignTo(4);
     PathID = reader.ReadInt64();
 }
Esempio n. 8
0
 private void Parse(AssetsFile assetsFile, AssetsObject owner, AssetsReader reader)
 {
     PreloadIndex = reader.ReadInt32();
     PreloadSize  = reader.ReadInt32();
     Asset        = SmartPtr <AssetsObject> .Read(assetsFile, owner, reader);
 }