Пример #1
0
 def _read(self):
     self.magic = self._io.read_bytes(2)
     if not self.magic == b"\x50\x4D":
         raise kaitaistruct.ValidationNotEqualError(
             b"\x50\x4D", self.magic, self._io,
             u"/types/partition_entry/seq/0")
     self.reserved_1 = self._io.read_bytes(2)
     self.number_of_partitions = self._io.read_u4be()
     self.partition_start = self._io.read_u4be()
     self.partition_size = self._io.read_u4be()
     self.partition_name = (KaitaiStream.bytes_terminate(
         self._io.read_bytes(32), 0, False)).decode(u"ascii")
     self.partition_type = (KaitaiStream.bytes_terminate(
         self._io.read_bytes(32), 0, False)).decode(u"ascii")
     self.data_start = self._io.read_u4be()
     self.data_size = self._io.read_u4be()
     self.partition_status = self._io.read_u4be()
     self.boot_code_start = self._io.read_u4be()
     self.boot_code_size = self._io.read_u4be()
     self.boot_loader_address = self._io.read_u4be()
     self.reserved_2 = self._io.read_bytes(4)
     self.boot_code_entry = self._io.read_u4be()
     self.reserved_3 = self._io.read_bytes(4)
     self.boot_code_cksum = self._io.read_u4be()
     self.processor_type = (KaitaiStream.bytes_terminate(
         self._io.read_bytes(16), 0, False)).decode(u"ascii")
 def _read(self):
     self._debug['signature0']['start'] = self._io.pos()
     self.signature0 = self._io.read_bytes(17)
     self._debug['signature0']['end'] = self._io.pos()
     if not self.signature0 == b"\x45\x78\x74\x65\x6E\x64\x65\x64\x20\x4D\x6F\x64\x75\x6C\x65\x3A\x20":
         raise kaitaistruct.ValidationNotEqualError(
             b"\x45\x78\x74\x65\x6E\x64\x65\x64\x20\x4D\x6F\x64\x75\x6C\x65\x3A\x20",
             self.signature0, self._io, u"/types/preheader/seq/0")
     self._debug['module_name']['start'] = self._io.pos()
     self.module_name = (KaitaiStream.bytes_terminate(
         self._io.read_bytes(20), 0, False)).decode(u"utf-8")
     self._debug['module_name']['end'] = self._io.pos()
     self._debug['signature1']['start'] = self._io.pos()
     self.signature1 = self._io.read_bytes(1)
     self._debug['signature1']['end'] = self._io.pos()
     if not self.signature1 == b"\x1A":
         raise kaitaistruct.ValidationNotEqualError(
             b"\x1A", self.signature1, self._io,
             u"/types/preheader/seq/2")
     self._debug['tracker_name']['start'] = self._io.pos()
     self.tracker_name = (KaitaiStream.bytes_terminate(
         self._io.read_bytes(20), 0, False)).decode(u"utf-8")
     self._debug['tracker_name']['end'] = self._io.pos()
     self._debug['version_number']['start'] = self._io.pos()
     self.version_number = self._root.Preheader.Version(
         self._io, self, self._root)
     self.version_number._read()
     self._debug['version_number']['end'] = self._io.pos()
     self._debug['header_size']['start'] = self._io.pos()
     self.header_size = self._io.read_u4le()
     self._debug['header_size']['end'] = self._io.pos()
Пример #3
0
 def _read(self):
     self._debug['type']['start'] = self._io.pos()
     self.type = KaitaiStream.resolve_enum(S3m.Instrument.InstTypes,
                                           self._io.read_u1())
     self._debug['type']['end'] = self._io.pos()
     self._debug['filename']['start'] = self._io.pos()
     self.filename = KaitaiStream.bytes_terminate(
         self._io.read_bytes(12), 0, False)
     self._debug['filename']['end'] = self._io.pos()
     self._debug['body']['start'] = self._io.pos()
     _on = self.type
     if _on == S3m.Instrument.InstTypes.sample:
         self.body = S3m.Instrument.Sampled(self._io, self, self._root)
         self.body._read()
     else:
         self.body = S3m.Instrument.Adlib(self._io, self, self._root)
         self.body._read()
     self._debug['body']['end'] = self._io.pos()
     self._debug['tuning_hz']['start'] = self._io.pos()
     self.tuning_hz = self._io.read_u4le()
     self._debug['tuning_hz']['end'] = self._io.pos()
     self._debug['reserved2']['start'] = self._io.pos()
     self.reserved2 = self._io.read_bytes(12)
     self._debug['reserved2']['end'] = self._io.pos()
     self._debug['sample_name']['start'] = self._io.pos()
     self.sample_name = KaitaiStream.bytes_terminate(
         self._io.read_bytes(28), 0, False)
     self._debug['sample_name']['end'] = self._io.pos()
     self._debug['magic']['start'] = self._io.pos()
     self.magic = self._io.read_bytes(4)
     self._debug['magic']['end'] = self._io.pos()
     if not self.magic == b"\x53\x43\x52\x53":
         raise kaitaistruct.ValidationNotEqualError(
             b"\x53\x43\x52\x53", self.magic, self._io,
             u"/types/instrument/seq/6")
Пример #4
0
    def _read(self):
        self.magic = self._io.read_bytes(8)
        if not self.magic == b"\x41\x4E\x44\x52\x4F\x49\x44\x21":
            raise kaitaistruct.ValidationNotEqualError(
                b"\x41\x4E\x44\x52\x4F\x49\x44\x21", self.magic, self._io,
                u"/seq/0")
        self.kernel = AndroidImg.Load(self._io, self, self._root)
        self.ramdisk = AndroidImg.Load(self._io, self, self._root)
        self.second = AndroidImg.Load(self._io, self, self._root)
        self.tags_load = self._io.read_u4le()
        self.page_size = self._io.read_u4le()
        self.header_version = self._io.read_u4le()
        self.os_version = AndroidImg.OsVersion(self._io, self, self._root)
        self.name = (KaitaiStream.bytes_terminate(self._io.read_bytes(16), 0,
                                                  False)).decode(u"ASCII")
        self.cmdline = (KaitaiStream.bytes_terminate(self._io.read_bytes(512),
                                                     0,
                                                     False)).decode(u"ASCII")
        self.sha = self._io.read_bytes(32)
        self.extra_cmdline = (KaitaiStream.bytes_terminate(
            self._io.read_bytes(1024), 0, False)).decode(u"ASCII")
        if self.header_version > 0:
            self.recovery_dtbo = AndroidImg.SizeOffset(self._io, self,
                                                       self._root)

        if self.header_version > 0:
            self.boot_header_size = self._io.read_u4le()

        if self.header_version > 1:
            self.dtb = AndroidImg.LoadLong(self._io, self, self._root)
Пример #5
0
 def _read(self):
     self.magic = self._io.ensure_fixed_contents(b"\x01\xFF\xFF\xFF")
     self.magic2 = self._io.read_u2le()
     self.structure_size = self._io.read_u2le()
     self.model_number = (KaitaiStream.bytes_terminate(self._io.read_bytes(20), 0, False)).decode(u"ascii")
     self.firmware_version = (KaitaiStream.bytes_terminate(self._io.read_bytes(20), 0, False)).decode(u"ascii")
     self.block = self._io.ensure_fixed_contents(b"\x01\x00")
     self.file_version = self._io.read_u2le()
 def _read(self):
     self.str_pad = KaitaiStream.bytes_strip_right(self._io.read_bytes(20),
                                                   64)
     self.str_term = KaitaiStream.bytes_terminate(self._io.read_bytes(20),
                                                  64, False)
     self.str_term_and_pad = KaitaiStream.bytes_terminate(
         KaitaiStream.bytes_strip_right(self._io.read_bytes(20), 43), 64,
         False)
     self.str_term_include = KaitaiStream.bytes_terminate(
         self._io.read_bytes(20), 64, True)
Пример #7
0
        def _read(self):
            self.magic = self._io.ensure_fixed_contents(b"\xA5\xA5\x38\x00")
            self.model_number = (KaitaiStream.bytes_terminate(
                self._io.read_bytes(20), 0, False)).decode(u"ascii")
            self.firmware_version = (KaitaiStream.bytes_terminate(
                self._io.read_bytes(20), 0, False)).decode(u"ascii")
            self.unknown_1 = [None] * (5)
            for i in range(5):
                self.unknown_1[i] = self._io.read_u4le()

            self.enabled = self._root.ChannelMask(self._io, self, self._root)
            self.unknown_2 = self._io.read_bytes(3)
            self.position = self._root.PositionType(self._io, self, self._root)
            self.unknown_3 = self._io.read_u4le()
            self.unknown_4 = self._io.read_u4le()
            self.unknown_5 = self._io.read_u4le()
            self.mem_depth_1 = self._io.read_u4le()
            self.sample_rate_hz = self._io.read_f4le()
            self.unknown_8 = self._io.read_u4le()
            self.time_per_div_ps = self._io.read_u8le()
            self.unknown_9 = [None] * (2)
            for i in range(2):
                self.unknown_9[i] = self._io.read_u4le()

            self.ch = [None] * (4)
            for i in range(4):
                self.ch[i] = self._root.ChannelHeader(self._io, self,
                                                      self._root)

            self.unknown_33 = [None] * (6)
            for i in range(6):
                self.unknown_33[i] = self._io.read_u4le()

            self.mem_depth_2 = self._io.read_u4le()
            self.unknown_37 = self._io.read_bytes(4)
            self.mem_depth = self._io.read_u4le()
            self.unknown_38 = [None] * (9)
            for i in range(9):
                self.unknown_38[i] = self._io.read_u4le()

            self.bytes_per_channel_1 = self._io.read_u4le()
            self.bytes_per_channel_2 = self._io.read_u4le()
            self.unknown_42 = [None] * (41)
            for i in range(41):
                self.unknown_42[i] = self._io.read_u4le()

            self.total_samples = self._io.read_u4le()
            self.unknown_57 = [None] * (4)
            for i in range(4):
                self.unknown_57[i] = self._io.read_u4le()

            self.mem_depth_type = self._root.MemDepthEnum(self._io.read_u1())
            self.unknown_60 = self._io.read_bytes(27)
            self.time = self._root.TimeHeader(self._io, self, self._root)
Пример #8
0
 def _read(self):
     self.str_pad = (KaitaiStream.bytes_strip_right(self._io.read_bytes(20),
                                                    64)).decode(u"UTF-8")
     self.str_term = (KaitaiStream.bytes_terminate(self._io.read_bytes(20),
                                                   64,
                                                   False)).decode(u"UTF-8")
     self.str_term_and_pad = (KaitaiStream.bytes_terminate(
         KaitaiStream.bytes_strip_right(self._io.read_bytes(20), 43), 64,
         False)).decode(u"UTF-8")
     self.str_term_include = (KaitaiStream.bytes_terminate(
         self._io.read_bytes(20), 64, True)).decode(u"UTF-8")
Пример #9
0
 def _read(self):
     self.type = self._root.Instrument.InstTypes(self._io.read_u1())
     self.filename = KaitaiStream.bytes_terminate(self._io.read_bytes(12), 0, False)
     _on = self.type
     if _on == self._root.Instrument.InstTypes.sample:
         self.body = self._root.Instrument.Sampled(self._io, self, self._root)
     else:
         self.body = self._root.Instrument.Adlib(self._io, self, self._root)
     self.tuning_hz = self._io.read_u4le()
     self.reserved2 = self._io.read_bytes(12)
     self.sample_name = KaitaiStream.bytes_terminate(self._io.read_bytes(28), 0, False)
     self.magic = self._io.ensure_fixed_contents(b"\x53\x43\x52\x53")
Пример #10
0
        def _read(self):
            self.magic = self._io.read_bytes(4)
            if not self.magic == b"\xA5\xA5\x38\x00":
                raise kaitaistruct.ValidationNotEqualError(b"\xA5\xA5\x38\x00", self.magic, self._io, u"/types/header/seq/0")
            self.model_number = (KaitaiStream.bytes_terminate(self._io.read_bytes(20), 0, False)).decode(u"ascii")
            self.firmware_version = (KaitaiStream.bytes_terminate(self._io.read_bytes(20), 0, False)).decode(u"ascii")
            self.unknown_1 = [None] * (5)
            for i in range(5):
                self.unknown_1[i] = self._io.read_u4le()

            self.enabled = Wfm4000.ChannelMask(self._io, self, self._root)
            self.unknown_2 = self._io.read_bytes(3)
            self.position = Wfm4000.PositionType(self._io, self, self._root)
            self.unknown_3 = self._io.read_u4le()
            self.unknown_4 = self._io.read_u4le()
            self.unknown_5 = self._io.read_u4le()
            self.mem_depth_1 = self._io.read_u4le()
            self.sample_rate_hz = self._io.read_f4le()
            self.unknown_8 = self._io.read_u4le()
            self.time_per_div_ps = self._io.read_u8le()
            self.unknown_9 = [None] * (2)
            for i in range(2):
                self.unknown_9[i] = self._io.read_u4le()

            self.ch = [None] * (4)
            for i in range(4):
                self.ch[i] = Wfm4000.ChannelHeader(self._io, self, self._root)

            self.unknown_33 = [None] * (6)
            for i in range(6):
                self.unknown_33[i] = self._io.read_u4le()

            self.mem_depth_2 = self._io.read_u4le()
            self.unknown_37 = self._io.read_bytes(4)
            self.mem_depth = self._io.read_u4le()
            self.unknown_38 = [None] * (9)
            for i in range(9):
                self.unknown_38[i] = self._io.read_u4le()

            self.bytes_per_channel_1 = self._io.read_u4le()
            self.bytes_per_channel_2 = self._io.read_u4le()
            self.unknown_42 = [None] * (41)
            for i in range(41):
                self.unknown_42[i] = self._io.read_u4le()

            self.total_samples = self._io.read_u4le()
            self.unknown_57 = [None] * (4)
            for i in range(4):
                self.unknown_57[i] = self._io.read_u4le()

            self.mem_depth_type = KaitaiStream.resolve_enum(Wfm4000.MemDepthEnum, self._io.read_u1())
            self.unknown_60 = self._io.read_bytes(27)
            self.time = Wfm4000.TimeHeader(self._io, self, self._root)
Пример #11
0
            def str(self):
                if hasattr(self, '_m_str'):
                    return self._m_str

                io = self._root._io
                _pos = io.pos()
                io.seek(self.ofs_str)
                if self._is_le:
                    self._m_str = (KaitaiStream.bytes_terminate(io.read_bytes(self.len_str), 0, False)).decode(u"UTF-8")
                else:
                    self._m_str = (KaitaiStream.bytes_terminate(io.read_bytes(self.len_str), 0, False)).decode(u"UTF-8")
                io.seek(_pos)
                return getattr(self, '_m_str', None)
Пример #12
0
            def str(self):
                if hasattr(self, '_m_str'):
                    return self._m_str if hasattr(self, '_m_str') else None

                io = self._root._io
                _pos = io.pos()
                io.seek(self.ofs_str)
                self._debug['_m_str']['start'] = io.pos()
                if self._is_le:
                    self._m_str = (KaitaiStream.bytes_terminate(io.read_bytes(self.len_str), 0, False)).decode(u"UTF-8")
                else:
                    self._m_str = (KaitaiStream.bytes_terminate(io.read_bytes(self.len_str), 0, False)).decode(u"UTF-8")
                self._debug['_m_str']['end'] = io.pos()
                io.seek(_pos)
                return self._m_str if hasattr(self, '_m_str') else None
Пример #13
0
 def __init__(self, _io, _parent=None, _root=None):
     self._io = _io
     self._parent = _parent
     self._root = _root if _root else self
     self.magic = self._io.ensure_fixed_contents(struct.pack('4b', 65, 80, 83, 66))
     self.fs_index = self._io.read_u4le()
     self.features = self._io.read_u8le()
     self.readonly_compatible_features = self._io.read_u8le()
     self.incompatible_features = self._io.read_u8le()
     self.unmount_time = self._io.read_s8le()
     self.fs_reserve_block_count = self._io.read_u8le()
     self.fs_quota_block_count = self._io.read_u8le()
     self.fs_alloc_count = self._io.read_u8le()
     self.apfs_meta_crypto = self._io.read_bytes(20)
     self.root_tree_type = self._io.read_u4le()
     self.extentref_tree_type = self._io.read_u4le()
     self.snap_meta_tree_type = self._io.read_u4le()
     self.omap_oid = self._io.read_u8le() #self._root.RefBlock(self._io, self, self._root)
     self.root_tree_oid = self._io.read_u8le()
     self.extentref_tree_oid = self._root.RefBlock(self._io, self, self._root)
     self.snap_meta_tree_oid = self._root.RefBlock(self._io, self, self._root)
     self.revert_to_xid = self._io.read_u8le()
     self.revert_to_sblock_oid = self._io.read_u8le()
     self.next_available_cnid = self._io.read_u8le()
     self.num_files = self._io.read_u8le()
     self.num_folders = self._io.read_u8le()
     self.num_symlinks = self._io.read_u8le()
     self.num_other_fsobjects = self._io.read_u8le()
     self.num_snapshots = self._io.read_u8le()
     self.apfs_total_blocks_alloced = self._io.read_u8le()
     self.apfs_total_blocks_freed = self._io.read_u8le()
     self.volume_uuid = self._io.read_bytes(16)
     self.last_mod_time = self._io.read_s8le()
     self.fs_flags = self._io.read_u8le()
     self.created_by = (KaitaiStream.bytes_terminate(self._io.read_bytes(32), 0, False)).decode("UTF-8", 'backslashreplace')
     self.time_created = self._io.read_s8le()
     self.unknown_312 = self._io.read_bytes(392)
     self.volume_name = (KaitaiStream.bytes_terminate(self._io.read_bytes(256), 0, False)).decode("UTF-8", 'backslashreplace')
     self.next_doc_id = self._io.read_u4le()
     self.apfs_role = self._io.read_u2le() #self._root.VolumeRoleType(self._io.read_u2le())
     self.reserved = self._io.read_u2le()
     self.apfs_root_to_xid = self._io.read_s8le()
     self.apfs_er_state_oid = self._io.read_s8le()
     self.unknown1 = self._io.read_s4le()
     self.unknown2 = self._io.read_s4le()
     self.unknown3 = self._io.read_s8le()
     self.unknown4 = self._io.read_s8le()
     self.data_uuid = self._io.read_bytes(16) # In both System & Data vol, Data's uuid is seen
Пример #14
0
 def _read(self):
     self.name = (KaitaiStream.bytes_terminate(
         self._io.read_bytes(36), 0, False)).decode(u"UTF-8")
     self.flag_slot_suffixed = self._io.read_bits_int_le(1) != 0
     self.flags_reserved = self._io.read_bits_int_le(31)
     self._io.align_to_byte()
     self.maximum_size = self._io.read_u8le()
Пример #15
0
    def _read(self):
        self._debug['magic']['start'] = self._io.pos()
        self.magic = self._io.read_bytes(8)
        self._debug['magic']['end'] = self._io.pos()
        if not self.magic == b"\x23\x4F\x50\x4C\x5F\x49\x49\x23":
            raise kaitaistruct.ValidationNotEqualError(
                b"\x23\x4F\x50\x4C\x5F\x49\x49\x23", self.magic, self._io,
                u"/seq/0")
        self._debug['instruments']['start'] = self._io.pos()
        self.instruments = [None] * (175)
        for i in range(175):
            if not 'arr' in self._debug['instruments']:
                self._debug['instruments']['arr'] = []
            self._debug['instruments']['arr'].append({'start': self._io.pos()})
            _t_instruments = GenmidiOp2.InstrumentEntry(
                self._io, self, self._root)
            _t_instruments._read()
            self.instruments[i] = _t_instruments
            self._debug['instruments']['arr'][i]['end'] = self._io.pos()

        self._debug['instruments']['end'] = self._io.pos()
        self._debug['instrument_names']['start'] = self._io.pos()
        self.instrument_names = [None] * (175)
        for i in range(175):
            if not 'arr' in self._debug['instrument_names']:
                self._debug['instrument_names']['arr'] = []
            self._debug['instrument_names']['arr'].append(
                {'start': self._io.pos()})
            self.instrument_names[i] = (KaitaiStream.bytes_terminate(
                KaitaiStream.bytes_strip_right(self._io.read_bytes(32), 0), 0,
                False)).decode(u"ASCII")
            self._debug['instrument_names']['arr'][i]['end'] = self._io.pos()

        self._debug['instrument_names']['end'] = self._io.pos()
Пример #16
0
        def _read(self):
            self._debug['bbox_min']['start'] = self._io.pos()
            self.bbox_min = QuakeMdl.MdlVertex(self._io, self, self._root)
            self.bbox_min._read()
            self._debug['bbox_min']['end'] = self._io.pos()
            self._debug['bbox_max']['start'] = self._io.pos()
            self.bbox_max = QuakeMdl.MdlVertex(self._io, self, self._root)
            self.bbox_max._read()
            self._debug['bbox_max']['end'] = self._io.pos()
            self._debug['name']['start'] = self._io.pos()
            self.name = (KaitaiStream.bytes_terminate(
                KaitaiStream.bytes_strip_right(self._io.read_bytes(16), 0), 0,
                False)).decode(u"ASCII")
            self._debug['name']['end'] = self._io.pos()
            self._debug['vertices']['start'] = self._io.pos()
            self.vertices = [None] * (self._root.header.num_verts)
            for i in range(self._root.header.num_verts):
                if not 'arr' in self._debug['vertices']:
                    self._debug['vertices']['arr'] = []
                self._debug['vertices']['arr'].append(
                    {'start': self._io.pos()})
                _t_vertices = QuakeMdl.MdlVertex(self._io, self, self._root)
                _t_vertices._read()
                self.vertices[i] = _t_vertices
                self._debug['vertices']['arr'][i]['end'] = self._io.pos()

            self._debug['vertices']['end'] = self._io.pos()
Пример #17
0
 def _read(self):
     self.name_length = self._io.read_u1()
     self.flag_1 = self._io.read_u1()
     self.unknown_2 = self._io.read_u2le()
     self.name = (KaitaiStream.bytes_terminate(
         self._io.read_bytes(self.name_length), 0,
         False)).decode(u"UTF-8")
Пример #18
0
 def _read(self):
     self.timestamp = self._io.read_u4le()
     self.offset_idx = self._io.read_u2le()
     self.flags = self._io.read_u1()
     self.name = (KaitaiStream.bytes_terminate(
         KaitaiStream.bytes_strip_right(self._io.read_bytes(25), 0), 0,
         False)).decode(u"ASCII")
Пример #19
0
        def profile_data(self):
            """
            .. seealso::
               "If the profile is embedded, profile data is the actual profile, and if it is linked, the profile data is the null-terminated file name of the profile. This cannot be a Unicode string. It must be composed exclusively of characters from the Windows character set (code page 1252)." - https://docs.microsoft.com/en-us/previous-versions/windows/desktop/wcs/using-structures-in-wcs-1-0
            """
            if hasattr(self, '_m_profile_data'):
                return self._m_profile_data if hasattr(
                    self, '_m_profile_data') else None

            if self.has_profile:
                io = self._root._io
                _pos = io.pos()
                io.seek((14 + self.ofs_profile))
                self._debug['_m_profile_data']['start'] = io.pos()
                _on = self._parent.bitmap_v4_ext.color_space_type == self._root.ColorSpace.profile_linked
                if _on == True:
                    self._m_profile_data = (KaitaiStream.bytes_terminate(
                        io.read_bytes(self.len_profile), 0,
                        False)).decode(u"windows-1252")
                else:
                    self._m_profile_data = io.read_bytes(self.len_profile)
                self._debug['_m_profile_data']['end'] = io.pos()
                io.seek(_pos)

            return self._m_profile_data if hasattr(self,
                                                   '_m_profile_data') else None
Пример #20
0
 def __init__(self, _io, _parent=None, _root=None):
     self._io = _io
     self._parent = _parent
     self._root = _root if _root else self
     self.parent_id = self._io.read_u8le()
     namelength = self._io.read_u2le()
     self.name = (KaitaiStream.bytes_terminate(self._io.read_bytes(namelength), 0, False)).decode("UTF-8", "backslashreplace")
        def field_data(self):
            if hasattr(self, '_m_field_data'):
                return self._m_field_data if hasattr(self, '_m_field_data') else None

            io = self._parent._parent.variable_fields._io
            _pos = io.pos()
            io.seek(int(self.starting_character_position))
            _on = self._parent._parent.leader.character_coding_scheme
            if _on == ' ':
                self._m_field_data = (KaitaiStream.bytes_terminate(io.read_bytes(int(self.length_of_field)), 30, False)).decode(u"latin-1")
            elif _on == 'a':
                self._m_field_data = (KaitaiStream.bytes_terminate(io.read_bytes(int(self.length_of_field)), 30, False)).decode(u"utf-8")
            else:
                self._m_field_data = io.read_bytes(int(self.length_of_field))
            io.seek(_pos)
            return self._m_field_data if hasattr(self, '_m_field_data') else None
Пример #22
0
 def _read(self):
     self.magic = self._io.read_bytes(4)
     if not self.magic == b"\x64\x65\x78\x0A":
         raise kaitaistruct.ValidationNotEqualError(
             b"\x64\x65\x78\x0A", self.magic, self._io,
             u"/types/header_item/seq/0")
     self.version_str = (KaitaiStream.bytes_terminate(
         self._io.read_bytes(4), 0, False)).decode(u"ascii")
     self.checksum = self._io.read_u4le()
     self.signature = self._io.read_bytes(20)
     self.file_size = self._io.read_u4le()
     self.header_size = self._io.read_u4le()
     self.endian_tag = KaitaiStream.resolve_enum(
         Dex.HeaderItem.EndianConstant, self._io.read_u4le())
     self.link_size = self._io.read_u4le()
     self.link_off = self._io.read_u4le()
     self.map_off = self._io.read_u4le()
     self.string_ids_size = self._io.read_u4le()
     self.string_ids_off = self._io.read_u4le()
     self.type_ids_size = self._io.read_u4le()
     self.type_ids_off = self._io.read_u4le()
     self.proto_ids_size = self._io.read_u4le()
     self.proto_ids_off = self._io.read_u4le()
     self.field_ids_size = self._io.read_u4le()
     self.field_ids_off = self._io.read_u4le()
     self.method_ids_size = self._io.read_u4le()
     self.method_ids_off = self._io.read_u4le()
     self.class_defs_size = self._io.read_u4le()
     self.class_defs_off = self._io.read_u4le()
     self.data_size = self._io.read_u4le()
     self.data_off = self._io.read_u4le()
Пример #23
0
 def _read(self):
     self.magic = self._io.ensure_fixed_contents(b"\x64\x65\x78\x0A")
     self.version_str = (KaitaiStream.bytes_terminate(
         self._io.read_bytes(4), 0, False)).decode(u"ascii")
     self.checksum = self._io.read_u4le()
     self.signature = self._io.read_bytes(20)
     self.file_size = self._io.read_u4le()
     self.header_size = self._io.read_u4le()
     self.endian_tag = self._root.HeaderItem.EndianConstant(
         self._io.read_u4le())
     self.link_size = self._io.read_u4le()
     self.link_off = self._io.read_u4le()
     self.map_off = self._io.read_u4le()
     self.string_ids_size = self._io.read_u4le()
     self.string_ids_off = self._io.read_u4le()
     self.type_ids_size = self._io.read_u4le()
     self.type_ids_off = self._io.read_u4le()
     self.proto_ids_size = self._io.read_u4le()
     self.proto_ids_off = self._io.read_u4le()
     self.field_ids_size = self._io.read_u4le()
     self.field_ids_off = self._io.read_u4le()
     self.method_ids_size = self._io.read_u4le()
     self.method_ids_off = self._io.read_u4le()
     self.class_defs_size = self._io.read_u4le()
     self.class_defs_off = self._io.read_u4le()
     self.data_size = self._io.read_u4le()
     self.data_off = self._io.read_u4le()
Пример #24
0
 def __init__(self, _io, _parent=None, _root=None):
     self._io = _io
     self._parent = _parent
     self._root = _root if _root else self
     self.len_name = self._io.read_u2le()
     self.attr_name = (KaitaiStream.bytes_terminate(
         self._io.read_bytes(self.len_name), 0, False)).decode(u"UTF-8")
Пример #25
0
 def _read(self):
     self.version = self._io.read_u4be()
     if not self.version == 2:
         raise kaitaistruct.ValidationNotEqualError(
             2, self.version, self._io, u"/types/header/seq/0")
     self.width = self._io.read_u4be()
     if not self.width >= 1:
         raise kaitaistruct.ValidationLessThanError(
             1, self.width, self._io, u"/types/header/seq/1")
     if not self.width <= 10000:
         raise kaitaistruct.ValidationGreaterThanError(
             10000, self.width, self._io, u"/types/header/seq/1")
     self.height = self._io.read_u4be()
     if not self.height >= 1:
         raise kaitaistruct.ValidationLessThanError(
             1, self.height, self._io, u"/types/header/seq/2")
     if not self.height <= 10000:
         raise kaitaistruct.ValidationGreaterThanError(
             10000, self.height, self._io, u"/types/header/seq/2")
     self.bytes_per_pixel = KaitaiStream.resolve_enum(
         GimpBrush.ColorDepth, self._io.read_u4be())
     self.magic = self._io.read_bytes(4)
     if not self.magic == b"\x47\x49\x4D\x50":
         raise kaitaistruct.ValidationNotEqualError(
             b"\x47\x49\x4D\x50", self.magic, self._io,
             u"/types/header/seq/4")
     self.spacing = self._io.read_u4be()
     self.brush_name = (KaitaiStream.bytes_terminate(
         self._io.read_bytes_full(), 0, False)).decode(u"UTF-8")
Пример #26
0
 def _read(self):
     self._debug['sample_length']['start'] = self._io.pos()
     self.sample_length = self._io.read_u4le()
     self._debug['sample_length']['end'] = self._io.pos()
     self._debug['sample_loop_start']['start'] = self._io.pos()
     self.sample_loop_start = self._io.read_u4le()
     self._debug['sample_loop_start']['end'] = self._io.pos()
     self._debug['sample_loop_length']['start'] = self._io.pos()
     self.sample_loop_length = self._io.read_u4le()
     self._debug['sample_loop_length']['end'] = self._io.pos()
     self._debug['volume']['start'] = self._io.pos()
     self.volume = self._io.read_u1()
     self._debug['volume']['end'] = self._io.pos()
     self._debug['fine_tune']['start'] = self._io.pos()
     self.fine_tune = self._io.read_s1()
     self._debug['fine_tune']['end'] = self._io.pos()
     self._debug['type']['start'] = self._io.pos()
     self.type = FasttrackerXmModule.Instrument.SampleHeader.LoopType(self._io, self, self._root)
     self.type._read()
     self._debug['type']['end'] = self._io.pos()
     self._debug['panning']['start'] = self._io.pos()
     self.panning = self._io.read_u1()
     self._debug['panning']['end'] = self._io.pos()
     self._debug['relative_note_number']['start'] = self._io.pos()
     self.relative_note_number = self._io.read_s1()
     self._debug['relative_note_number']['end'] = self._io.pos()
     self._debug['reserved']['start'] = self._io.pos()
     self.reserved = self._io.read_u1()
     self._debug['reserved']['end'] = self._io.pos()
     self._debug['name']['start'] = self._io.pos()
     self.name = (KaitaiStream.bytes_terminate(self._io.read_bytes(22), 0, False)).decode(u"utf-8")
     self._debug['name']['end'] = self._io.pos()
Пример #27
0
 def _read(self):
     self.name = (KaitaiStream.bytes_terminate(
         self._io.read_bytes(22), 0, False)).decode(u"utf-8")
     self.type = self._io.read_u1()
     self.num_samples = self._io.read_u2le()
     if self.num_samples > 0:
         self.extra_header = FasttrackerXmModule.Instrument.ExtraHeader(
             self._io, self, self._root)
Пример #28
0
 def _read(self):
     self._debug['description']['start'] = self._io.pos()
     self.description = (KaitaiStream.bytes_terminate(
         self._io.read_bytes(256), 0, False)).decode(u"ASCII")
     self._debug['description']['end'] = self._io.pos()
     self._debug['originator']['start'] = self._io.pos()
     self.originator = (KaitaiStream.bytes_terminate(
         self._io.read_bytes(32), 0, False)).decode(u"ASCII")
     self._debug['originator']['end'] = self._io.pos()
     self._debug['originator_reference']['start'] = self._io.pos()
     self.originator_reference = (KaitaiStream.bytes_terminate(
         self._io.read_bytes(32), 0, False)).decode(u"ASCII")
     self._debug['originator_reference']['end'] = self._io.pos()
     self._debug['origination_date']['start'] = self._io.pos()
     self.origination_date = (self._io.read_bytes(10)).decode(u"ASCII")
     self._debug['origination_date']['end'] = self._io.pos()
     self._debug['origination_time']['start'] = self._io.pos()
     self.origination_time = (self._io.read_bytes(8)).decode(u"ASCII")
     self._debug['origination_time']['end'] = self._io.pos()
     self._debug['time_reference_low']['start'] = self._io.pos()
     self.time_reference_low = self._io.read_u4le()
     self._debug['time_reference_low']['end'] = self._io.pos()
     self._debug['time_reference_high']['start'] = self._io.pos()
     self.time_reference_high = self._io.read_u4le()
     self._debug['time_reference_high']['end'] = self._io.pos()
     self._debug['version']['start'] = self._io.pos()
     self.version = self._io.read_u2le()
     self._debug['version']['end'] = self._io.pos()
     self._debug['umid']['start'] = self._io.pos()
     self.umid = self._io.read_bytes(64)
     self._debug['umid']['end'] = self._io.pos()
     self._debug['loudness_value']['start'] = self._io.pos()
     self.loudness_value = self._io.read_u2le()
     self._debug['loudness_value']['end'] = self._io.pos()
     self._debug['loudness_range']['start'] = self._io.pos()
     self.loudness_range = self._io.read_u2le()
     self._debug['loudness_range']['end'] = self._io.pos()
     self._debug['max_true_peak_level']['start'] = self._io.pos()
     self.max_true_peak_level = self._io.read_u2le()
     self._debug['max_true_peak_level']['end'] = self._io.pos()
     self._debug['max_momentary_loudness']['start'] = self._io.pos()
     self.max_momentary_loudness = self._io.read_u2le()
     self._debug['max_momentary_loudness']['end'] = self._io.pos()
     self._debug['max_short_term_loudness']['start'] = self._io.pos()
     self.max_short_term_loudness = self._io.read_u2le()
     self._debug['max_short_term_loudness']['end'] = self._io.pos()
Пример #29
0
 def _read(self):
     self.unknown1 = self._io.read_u4le()
     self.name = (KaitaiStream.bytes_terminate(
         self._io.read_bytes(16), 0,
         False)).decode(u"ASCII")
     self.unknown2 = self._io.read_u4le()
     self.name2_ptr = self._io.read_u4le()
     self.name2 = (KaitaiStream.bytes_terminate(
         self._io.read_bytes(16), 0,
         False)).decode(u"ASCII")
     self.magic1 = self._io.ensure_fixed_contents(
         b"\x00\x00\x00\x00")
     self.unknown4 = self._io.read_bytes(12)
     self.wx8_ptr = self._io.read_u4le()
     self.unknown_ptr1 = self._io.read_u4le()
     self.unknown_table_ptr = self._io.read_u4le()
     self.unknown_ptr3 = self._io.read_u4le()
Пример #30
0
 def __init__(self, _io, _parent=None, _root=None):
     self._io = _io
     self._parent = _parent
     self._root = _root if _root else self
     name_len_and_hash = self._io.read_u4le()
     len_name = name_len_and_hash & 0x000003ff
     self.hash = (name_len_and_hash & 0xfffff400) >> 10
     self.name = (KaitaiStream.bytes_terminate(self._io.read_bytes(len_name), 0, False)).decode("UTF-8", "backslashreplace")