コード例 #1
0
ファイル: Asset.cs プロジェクト: zxc120/GARbro
 public void Load(AssetReader reader)
 {
     PathId = reader.ReadId();
     Offset = reader.ReadUInt32() + Asset.DataOffset;
     Size   = reader.ReadUInt32();
     if (Asset.Format < 17)
     {
         TypeId  = reader.ReadInt32();
         ClassId = reader.ReadInt16();
     }
     else
     {
         var type_id  = reader.ReadInt32();
         var class_id = Asset.Tree.ClassIds[type_id];
         TypeId  = class_id;
         ClassId = class_id;
     }
     if (Asset.Format <= 10)
     {
         IsDestroyed = reader.ReadInt16() != 0;
     }
     if (Asset.Format >= 11 && Asset.Format < 17)
     {
         reader.ReadInt16();
     }
     if (Asset.Format >= 15 && Asset.Format < 17)
     {
         reader.ReadByte();
     }
 }
コード例 #2
0
ファイル: Asset.cs プロジェクト: x132321/GARbro
        public void Load(AssetReader input)
        {
            input.ReadInt32();  // header_size
            input.ReadUInt32(); // file_size
            m_format      = input.ReadInt32();
            m_data_offset = input.ReadUInt32();
            if (m_format >= 9)
            {
                m_is_little_endian = 0 == input.ReadInt32();
            }
            if (m_format >= 22)
            {
                input.ReadInt32();  // header_size
                input.ReadInt64();  // file_size
                m_data_offset = input.ReadInt64();
                input.ReadInt64();
            }
            input.SetupReaders(this);
            m_tree.Load(input);

            bool long_ids = Format >= 14;

            if (Format >= 7 && Format < 14)
            {
                long_ids = 0 != input.ReadInt32();
            }
            input.SetupReadId(long_ids);

            int obj_count = input.ReadInt32();

            for (int i = 0; i < obj_count; ++i)
            {
                input.Align();
                var obj = new UnityObject(this);
                obj.Load(input);
                RegisterObject(obj);
            }
            if (Format >= 11)
            {
                int count = input.ReadInt32();
                m_adds = new Dictionary <long, int> (count);
                for (int i = 0; i < count; ++i)
                {
                    input.Align();
                    var id = input.ReadId();
                    m_adds[id] = input.ReadInt32();
                }
            }
            if (Format >= 6)
            {
                int count = input.ReadInt32();
                m_refs = new List <AssetRef> (count);
                for (int i = 0; i < count; ++i)
                {
                    var asset_ref = AssetRef.Load(input);
                    m_refs.Add(asset_ref);
                }
            }
            input.ReadCString();
        }