def _read(self): self.foo = self._io.read_u1() _ = self.foo if not _ == 1: raise kaitaistruct.ValidationExprError(self.foo, self._io, u"/seq/0") self.bar = self._io.read_s2le() _ = self.bar if not ((_ < -190) or (_ > -190)): raise kaitaistruct.ValidationExprError(self.bar, self._io, u"/seq/1")
def _read(self): self.len_chunk_header = self._io.read_u2le() self.block_size = self._io.read_u4le() _ = self.block_size if not (_ % 4) == 0: raise kaitaistruct.ValidationExprError( self.block_size, self._io, u"/types/file_header/seq/1") self.num_blocks = self._io.read_u4le() self.num_chunks = self._io.read_u4le() self.checksum = self._io.read_u4le()
def _read(self): if self._root.version > 512: self.len = self._io.read_s4le() _ = self.len if not _ <= 1024: raise kaitaistruct.ValidationExprError( self.len, self._io, u"/types/string/seq/0") self.value = self._io.read_bytes( (self.len if self._root.version > 512 else 40))
def _read(self): self.texture_id = self._io.read_s4le() self.animation_count = self._io.read_s4le() _ = self.animation_count if not _ <= 65536: raise kaitaistruct.ValidationExprError( self.animation_count, self._io, u"/types/animated_texture/seq/1") self.tex_animations = [None] * (self.animation_count) for i in range(self.animation_count): self.tex_animations[i] = Rsm.TexAnimation( self._io, self, self._root)
def _read(self): self.type = self._io.read_s4le() self.tex_frame_count = self._io.read_s4le() _ = self.tex_frame_count if not _ <= 65536: raise kaitaistruct.ValidationExprError( self.tex_frame_count, self._io, u"/types/tex_animation/seq/1") self.tex_key_frames = [None] * (self.tex_frame_count) for i in range(self.tex_frame_count): self.tex_key_frames[i] = Rsm.TextureKeyFrame( self._io, self, self._root)
def _read(self): self.version = self._io.read_u2be() if not self.version == 1: raise kaitaistruct.ValidationNotEqualError( 1, self.version, self._io, u"/types/file_header/seq/0") self.len_toc_compressed = self._io.read_u8be() self.toc_length_uncompressed = self._io.read_u8be() self.checksum_algorithm_int = self._io.read_u4be() if self.has_checksum_alg_name: self.checksum_alg_name = (KaitaiStream.bytes_terminate( self._io.read_bytes_full(), 0, False)).decode(u"UTF-8") _ = self.checksum_alg_name if not ((_ != u"") and (_ != u"none")): raise kaitaistruct.ValidationExprError( self.checksum_alg_name, self._io, u"/types/file_header/seq/4")
def _read(self): self.chunk_id = (self._io.read_bytes(8)).decode(u"ASCII") if not ((self.chunk_id == u"IFWI!!!!") or (self.chunk_id == u"DROIDBT!") or (self.chunk_id == u"SPLASHS!")): raise kaitaistruct.ValidationNotAnyOfError( self.chunk_id, self._io, u"/types/image/seq/0") self.len_body = self._io.read_u4le() self.flags = self._io.read_u1() _ = self.flags if not (_ & 1) != 0: raise kaitaistruct.ValidationExprError(self.flags, self._io, u"/types/image/seq/2") self.reserved1 = self._io.read_u1() self.reserved2 = self._io.read_u1() self.reserved3 = self._io.read_u1() self.body = self._io.read_bytes(self.len_body)
def _read(self): self.name = Rsm.String(self._io, self, self._root) self.parent_name = Rsm.String(self._io, self, self._root) self.texture_count = self._io.read_s4le() _ = self.texture_count if not _ <= 1024: raise kaitaistruct.ValidationExprError(self.texture_count, self._io, u"/types/node/seq/2") if self._root.version >= 515: self.texture_names = [None] * (self.texture_count) for i in range(self.texture_count): self.texture_names[i] = Rsm.String(self._io, self, self._root) if self._root.version < 515: self.texture_ids = [None] * (self.texture_count) for i in range(self.texture_count): self.texture_ids[i] = self._io.read_s4le() self.info = Rsm.NodeInfo(self._io, self, self._root) self.mesh_vertex_count = self._io.read_s4le() _ = self.mesh_vertex_count if not _ <= 65536: raise kaitaistruct.ValidationExprError(self.mesh_vertex_count, self._io, u"/types/node/seq/6") self.mesh_vertices = [None] * (self.mesh_vertex_count) for i in range(self.mesh_vertex_count): self.mesh_vertices[i] = Rsm.MeshVertex(self._io, self, self._root) self.texture_vertex_count = self._io.read_s4le() _ = self.texture_vertex_count if not _ <= 65536: raise kaitaistruct.ValidationExprError( self.texture_vertex_count, self._io, u"/types/node/seq/8") self.texture_vertices = [None] * (self.texture_vertex_count) for i in range(self.texture_vertex_count): self.texture_vertices[i] = Rsm.TextureVertex( self._io, self, self._root) self.face_count = self._io.read_s4le() _ = self.face_count if not _ <= 65536: raise kaitaistruct.ValidationExprError(self.face_count, self._io, u"/types/node/seq/10") self.faces = [None] * (self.face_count) for i in range(self.face_count): self.faces[i] = Rsm.FaceInfo(self._io, self, self._root) if self._root.version >= 262: self.scale_key_count = self._io.read_s4le() _ = self.scale_key_count if not _ <= 65536: raise kaitaistruct.ValidationExprError( self.scale_key_count, self._io, u"/types/node/seq/12") if self._root.version >= 262: self.scale_key_frames = [None] * (self.scale_key_count) for i in range(self.scale_key_count): self.scale_key_frames[i] = Rsm.ScaleKeyFrame( self._io, self, self._root) self.rot_key_count = self._io.read_s4le() _ = self.rot_key_count if not _ <= 65536: raise kaitaistruct.ValidationExprError(self.rot_key_count, self._io, u"/types/node/seq/14") self.rot_key_frames = [None] * (self.rot_key_count) for i in range(self.rot_key_count): self.rot_key_frames[i] = Rsm.RotKeyFrame( self._io, self, self._root) if self._root.version >= 514: self.pos_key_count = self._io.read_s4le() _ = self.pos_key_count if not _ <= 65536: raise kaitaistruct.ValidationExprError( self.pos_key_count, self._io, u"/types/node/seq/16") if self._root.version >= 514: self.pos_key_frames = [None] * (self.pos_key_count) for i in range(self.pos_key_count): self.pos_key_frames[i] = Rsm.PosKeyFrame( self._io, self, self._root) if self._root.version >= 515: self.animated_texture_count = self._io.read_s4le() _ = self.animated_texture_count if not _ <= 65536: raise kaitaistruct.ValidationExprError( self.animated_texture_count, self._io, u"/types/node/seq/18") if self._root.version >= 515: self.animated_textures = [None] * (self.animated_texture_count) for i in range(self.animated_texture_count): self.animated_textures[i] = Rsm.AnimatedTexture( self._io, self, self._root)
def _read(self): self.magic = self._io.read_bytes(4) if not self.magic == b"\x47\x52\x53\x4D": raise kaitaistruct.ValidationNotEqualError(b"\x47\x52\x53\x4D", self.magic, self._io, u"/seq/0") self.version = self._io.read_u2be() self.animation_count = self._io.read_s4le() self.shading_type = KaitaiStream.resolve_enum(Rsm.Shading, self._io.read_s4le()) if self._root.version >= 260: self.alpha = self._io.read_u1() if self._root.version < 512: self.reserved = self._io.read_bytes(16) if self._root.version >= 514: self.frame_rate_per_second = self._io.read_f4le() if self._root.version <= 514: self.texture_count = self._io.read_s4le() _ = self.texture_count if not _ <= 1024: raise kaitaistruct.ValidationExprError(self.texture_count, self._io, u"/seq/7") if self._root.version <= 514: self.texture_names = [None] * (self.texture_count) for i in range(self.texture_count): self.texture_names[i] = Rsm.String(self._io, self, self._root) if self._root.version >= 514: self.root_node_count = self._io.read_s4le() _ = self.root_node_count if not _ <= 1024: raise kaitaistruct.ValidationExprError(self.root_node_count, self._io, u"/seq/9") if self._root.version >= 514: self.root_node_names = [None] * (self.root_node_count) for i in range(self.root_node_count): self.root_node_names[i] = Rsm.String(self._io, self, self._root) if self._root.version < 512: self.root_node_name = Rsm.String(self._io, self, self._root) self.node_count = self._io.read_s4le() _ = self.node_count if not _ <= 1024: raise kaitaistruct.ValidationExprError(self.node_count, self._io, u"/seq/12") self.nodes = [None] * (self.node_count) for i in range(self.node_count): self.nodes[i] = Rsm.Node(self._io, self, self._root) if self._root.version < 262: self.scale_key_count = self._io.read_s4le() _ = self.scale_key_count if not _ <= 65536: raise kaitaistruct.ValidationExprError(self.scale_key_count, self._io, u"/seq/14") if self._root.version < 262: self.scale_key_frames = [None] * (self.scale_key_count) for i in range(self.scale_key_count): self.scale_key_frames[i] = Rsm.ScaleKeyFrame( self._io, self, self._root) if not (self._io.is_eof()): self.volume_box_count = self._io.read_s4le() _ = self.volume_box_count if not _ <= 65536: raise kaitaistruct.ValidationExprError(self.volume_box_count, self._io, u"/seq/16") if not (self._io.is_eof()): self.volume_boxes = [None] * (self.volume_box_count) for i in range(self.volume_box_count): self.volume_boxes[i] = Rsm.VolumeBox(self._io, self, self._root)