class KeyV4(mrc.Block): unk1 = mrc.UInt16_P(0x00) unk2 = mrc.UInt16_P(0x02) unk3 = mrc.UInt32_P(0x04) entry_count = mrc.UInt32_P(0x08) entries = mrc.BlockField(KeyEntry, 0x0c, count=mrc.Ref('entry_count')) garbage = mrc.Bytes(mrc.EndOffset('entries'))
class KeyEntry(mrc.Block): section_index = mrc.UInt32_P(0x00) cast_index = mrc.UInt32_P(0x04) chunk_id = mrc.UInt32_P(0x08) @property def repr(self): return f'chunk_id: {riff.TagB( self.chunk_id )}, section_index: {self.section_index}, cast_index: {self.cast_index}'
class KeyEntry(mrc.Block): section_index = mrc.UInt32_P(0x00) cast_index = mrc.UInt32_P(0x04) chunk_id = mrc.UInt32_P(0x08) @property def repr(self): return 'chunk_id: {}, section_index: {}, cast_index: {}'.format( riff.TagB(self.chunk_id), self.section_index, self.cast_index)
class RIFX(mrc.Block): _endian = 'big' CHUNK_MAP_CLASS = RIFXMap magic = mrc.Const(mrc.UInt32_P(0x00), Tag(b'RIFX')) size = mrc.UInt32_P(0x04) map = mrc.BlockField(mrc.Ref('CHUNK_MAP_CLASS'), 0x08, length=mrc.Ref('size'))
class MMapEntry(mrc.Block): chunk_id = mrc.UInt32_P(0x00) length = mrc.UInt32_P(0x04) offset = mrc.UInt32_P(0x08) flags = mrc.UInt16_P(0x0c) unk1 = mrc.UInt16_P(0x0e) memsize = mrc.UInt32_P(0x10) @property def repr(self): return 'chunk_id: {}, length: 0x{:08x}, offset: 0x{:08x}, flags: {}'.format( riff.TagB(self.chunk_id), self.length, self.offset, self.flags)
class MMapEntry(mrc.Block): chunk_id = mrc.UInt32_P(0x00) length = mrc.UInt32_P(0x04) offset = mrc.UInt32_P(0x08) flags = mrc.UInt16_P(0x0c) unk1 = mrc.UInt16_P(0x0e) memsize = mrc.UInt32_P(0x10) def import_data(self, *args, **kwargs): return super().import_data(*args, **kwargs) @property def repr(self): return f'chunk_id: {riff.TagB( self.chunk_id )}, length: 0x{self.length:08x}, offset: 0x{self.offset:08x}, flags: {self.flags}'
class MMapV4(mrc.Block): unk1 = mrc.Bytes(0x00, length=8) entries_max = mrc.UInt32_P(0x04) entries_used = mrc.UInt32_P(0x08) unk2 = mrc.Const(mrc.Bytes(0x0c, length=8), b'\xff' * 8) unk3 = mrc.UInt32_P(0x14) entries = mrc.BlockField(MMapEntry, 0x18, count=mrc.Ref('entries_max'), fill=b'\xaa' * 0x14) garbage = mrc.Bytes(mrc.EndOffset('entries')) @property def repr(self): return f'entries_max: {self.entries_max}, entries_used: {self.entries_used}'
class MMapV4(mrc.Block): unk1 = mrc.Bytes(0x00, length=8) entries_max = mrc.UInt32_P(0x04) entries_used = mrc.UInt32_P(0x08) unk2 = mrc.Const(mrc.Bytes(0x0c, length=8), b'\xff' * 8) unk3 = mrc.UInt32_P(0x14) entries = mrc.BlockField(MMapEntry, 0x18, count=mrc.Ref('entries_max'), fill=b'\xaa' * 0x14) @property def repr(self): return 'entries_max: {}, entries_used: {}'.format( self.entries_max, self.entries_used)
class TestLP(mrc.Block): _endian = 'little' i16 = mrc.Int16_P() i32 = mrc.Int32_P() i64 = mrc.Int64_P() ui16 = mrc.UInt16_P() ui32 = mrc.UInt32_P() ui64 = mrc.UInt64_P() f32 = mrc.Float32_P() f64 = mrc.Float64_P()
class PJ93_LE(mrc.Block): _endian = 'little' magic = mrc.Const(mrc.Bytes(0x00, length=4), b'PJ93') rifx_offset = mrc.UInt32_P(0x04) fontmap_offset = mrc.UInt32_P(0x08) resfork1_offset = mrc.UInt32_P(0x0c) resfork2_offset = mrc.UInt32_P(0x10) dirdib_drv_offset = mrc.UInt32_P(0x14) macromix_dll_offset = mrc.UInt32_P(0x18) rifx_offset_dup = mrc.UInt32_P(0x1c) unk1 = mrc.Bytes(0x20, length=0xc)
class MV93_V5(mrc.Block): _endian = 'big' CHUNK_MAP_CLASS = DirectorV5Map.CHUNK_MAP magic = mrc.Const(mrc.Bytes(0x00, length=4), b'RIFX') data_length = mrc.UInt32_P(0x04) magic2 = mrc.Const(mrc.Bytes(0x08, length=4), b'MV93') stream = mrc.ChunkField(CHUNK_MAP_CLASS, 0x0c, stream=True, id_field=mrc.UInt32_P, length_field=mrc.UInt32_P, default_klass=mrc.Unknown, alignment=0x2, fill=b'')
class IMapV4(mrc.Block): unk1 = mrc.UInt32_P(0x00) mmap_offset = mrc.UInt32_P(0x04) version = mrc.UInt32_P(0x08) unk2 = mrc.Bytes(0x0c)
class KeyV4(mrc.Block): unk1 = mrc.UInt16_P(0x00) unk2 = mrc.UInt16_P(0x02) slot_count = mrc.UInt32_P(0x04) entry_count = mrc.UInt32_P(0x08) entries = mrc.BlockField(KeyEntry, 0x0c, count=mrc.Ref('slot_count'))