Exemplo n.º 1
0
 def decode(self, fs: FileStream):
     self.version = fs.read_sint16()
     self.level = fs.read_uint8()
     self.is_array = fs.read_boolean()
     self.type_str_offset = fs.read_uint32()
     self.name_str_offset = fs.read_uint32()
     self.byte_size = fs.read_sint32()
     self.index = fs.read_sint32()
     self.meta_flags = fs.read_uint32()
Exemplo n.º 2
0
    def decode(self, fs: FileStream):
        offset = fs.position
        self.persistent_type_id = fs.read_sint32()
        self.is_stripped = fs.read_boolean()
        self.script_index = fs.read_sint16()
        if self.persistent_type_id == MONO_BEHAVIOUR_PERSISTENT_ID:
            self.mono_hash = fs.read(16)
        self.type_hash = fs.read(16)

        self.nodes = []
        self.strings = {}
        if self.type_tree_enabled:
            self.decode_type_tree(fs)
        else:
            cache_path = self.get_cache_path()
            if p.exists(cache_path):
                tmp = FileStream(file_path=cache_path)
                tmp.endian = '<'
                persistent_type_id = tmp.read_sint32()
                assert persistent_type_id == self.persistent_type_id, '{} != {}'.format(
                    persistent_type_id, self.persistent_type_id)
                tmp.seek(fs.position - offset)
                self.decode_type_tree(fs=tmp)