mrcrowbar.lib.games.keen module¶
File format classes for the Commander Keen: Invasion of the Vorticons engine (DOS, 1991)
Sources: RLE compressor http://www.shikadi.net/moddingwiki/Keen_1-3_RLE_compression
RLEW compressor http://www.shikadi.net/moddingwiki/RLEW_compression
LZW compressor http://www.shikadi.net/moddingwiki/LZW_Compression (Special thanks to Fleexy)
EGA header http://www.shikadi.net/moddingwiki/Commander_Keen_EGA_Header
Level format http://www.shikadi.net/moddingwiki/Commander_Keen_1-3_Level_format
-
class
mrcrowbar.lib.games.keen.
EGAHeader
(source_data=None, parent=None, preload_attrs=None, endian=None, cache_bytes=False, path_hint=None)[source]¶ Bases:
mrcrowbar.blocks.Block
Base class for Blocks.
- source_data
Source data to construct Block with. Can be a byte string, dictionary of attribute: value pairs, or another Block object.
- parent
Parent Block object where this Block is defined. Used for e.g. evaluating Refs.
- preload_attrs
Attributes on the Block to set before importing the data. Used for linking in dependencies before loading.
- endian
Platform endianness to use when interpreting the Block data. Useful for Blocks which have the same data layout but different endianness for stored numbers. Has no effect on fields with an predefined endianness.
- cache_bytes
Cache the bytes equivalent of the Block. Useful for debugging the loading procedure. Defaults to False.
- path_hint
Cache a string containing the path of the current Block, relative to the root.
-
bitmap_count
= <UInt16_LE: offset=0x22>¶
-
bitmap_offset
= <UInt32_LE: offset=0x24>¶
-
image_data_start
= <UInt32_LE: offset=0x8>¶
-
latch_compressed
= <Bits: offset=0x2e, bits=0b10>¶
-
latch_plane_size
= <UInt32_LE: offset=0x0>¶
-
sprite_compressed
= <Bits: offset=0x2e, bits=0b1>¶
-
sprite_count
= <UInt16_LE: offset=0x28>¶
-
sprite_data_start
= <UInt32_LE: offset=0xc>¶
-
sprite_offset
= <UInt32_LE: offset=0x2a>¶
-
sprite_plane_size
= <UInt32_LE: offset=0x4>¶
-
tile16_count
= <UInt16_LE: offset=0x1c>¶
-
tile16_offset
= <UInt32_LE: offset=0x1e>¶
-
tile32_count
= <UInt16_LE: offset=0x16>¶
-
tile32_offset
= <UInt32_LE: offset=0x18>¶
-
tile8_count
= <UInt16_LE: offset=0x10>¶
-
tile8_offset
= <UInt32_LE: offset=0x12>¶
-
class
mrcrowbar.lib.games.keen.
EGAHeaderBitmapRef
(source_data=None, parent=None, preload_attrs=None, endian=None, cache_bytes=False, path_hint=None)[source]¶ Bases:
mrcrowbar.blocks.Block
Base class for Blocks.
- source_data
Source data to construct Block with. Can be a byte string, dictionary of attribute: value pairs, or another Block object.
- parent
Parent Block object where this Block is defined. Used for e.g. evaluating Refs.
- preload_attrs
Attributes on the Block to set before importing the data. Used for linking in dependencies before loading.
- endian
Platform endianness to use when interpreting the Block data. Useful for Blocks which have the same data layout but different endianness for stored numbers. Has no effect on fields with an predefined endianness.
- cache_bytes
Cache the bytes equivalent of the Block. Useful for debugging the loading procedure. Defaults to False.
- path_hint
Cache a string containing the path of the current Block, relative to the root.
-
height
= <UInt16_LE: offset=0x2>¶
-
location
= <UInt32_LE: offset=0x4>¶
-
name
= <Bytes: offset=0x8, length=8>¶
-
width_raw
= <UInt16_LE: offset=0x0>¶
-
class
mrcrowbar.lib.games.keen.
EGAHeaderSpriteRef
(source_data=None, parent=None, preload_attrs=None, endian=None, cache_bytes=False, path_hint=None)[source]¶ Bases:
mrcrowbar.blocks.Block
Base class for Blocks.
- source_data
Source data to construct Block with. Can be a byte string, dictionary of attribute: value pairs, or another Block object.
- parent
Parent Block object where this Block is defined. Used for e.g. evaluating Refs.
- preload_attrs
Attributes on the Block to set before importing the data. Used for linking in dependencies before loading.
- endian
Platform endianness to use when interpreting the Block data. Useful for Blocks which have the same data layout but different endianness for stored numbers. Has no effect on fields with an predefined endianness.
- cache_bytes
Cache the bytes equivalent of the Block. Useful for debugging the loading procedure. Defaults to False.
- path_hint
Cache a string containing the path of the current Block, relative to the root.
-
height
= <UInt16_LE: offset=0x2>¶
-
hitbox_left
= <UInt16_LE: offset=0x8>¶
-
hitbox_right
= <UInt16_LE: offset=0xc>¶
-
hitbox_top
= <UInt16_LE: offset=0xa>¶
-
horiz_offset
= <UInt16_LE: offset=0x1c>¶
-
httbox_bottom
= <UInt16_LE: offset=0xe>¶
-
property
location
¶
-
location_raw
= <UInt16_LE: offset=0x6>¶
-
name
= <Bytes: offset=0x10, length=12>¶
-
prog_offset
= <UInt16_LE: offset=0x4>¶
-
vert_offset
= <UInt16_LE: offset=0x1e>¶
-
width_raw
= <UInt16_LE: offset=0x0>¶
-
class
mrcrowbar.lib.games.keen.
EGALatch
(source_data=None, parent=None, preload_attrs=None, endian=None, cache_bytes=False, path_hint=None)[source]¶ Bases:
mrcrowbar.blocks.Block
Base class for Blocks.
- source_data
Source data to construct Block with. Can be a byte string, dictionary of attribute: value pairs, or another Block object.
- parent
Parent Block object where this Block is defined. Used for e.g. evaluating Refs.
- preload_attrs
Attributes on the Block to set before importing the data. Used for linking in dependencies before loading.
- endian
Platform endianness to use when interpreting the Block data. Useful for Blocks which have the same data layout but different endianness for stored numbers. Has no effect on fields with an predefined endianness.
- cache_bytes
Cache the bytes equivalent of the Block. Useful for debugging the loading procedure. Defaults to False.
- path_hint
Cache a string containing the path of the current Block, relative to the root.
-
tilestore
= <BlockField: 0x00007fffa3737ac0>¶
-
class
mrcrowbar.lib.games.keen.
EGALatchComp
(source_data=None, parent=None, preload_attrs=None, endian=None, cache_bytes=False, path_hint=None)[source]¶ Bases:
mrcrowbar.blocks.Block
Base class for Blocks.
- source_data
Source data to construct Block with. Can be a byte string, dictionary of attribute: value pairs, or another Block object.
- parent
Parent Block object where this Block is defined. Used for e.g. evaluating Refs.
- preload_attrs
Attributes on the Block to set before importing the data. Used for linking in dependencies before loading.
- endian
Platform endianness to use when interpreting the Block data. Useful for Blocks which have the same data layout but different endianness for stored numbers. Has no effect on fields with an predefined endianness.
- cache_bytes
Cache the bytes equivalent of the Block. Useful for debugging the loading procedure. Defaults to False.
- path_hint
Cache a string containing the path of the current Block, relative to the root.
-
tilestore
= <BlockField: 0x00007fffa3737b80>¶
-
class
mrcrowbar.lib.games.keen.
EGATile16
(*args, **kwargs)[source]¶ Bases:
mrcrowbar.blocks.Block
Base class for Blocks.
- source_data
Source data to construct Block with. Can be a byte string, dictionary of attribute: value pairs, or another Block object.
- parent
Parent Block object where this Block is defined. Used for e.g. evaluating Refs.
- preload_attrs
Attributes on the Block to set before importing the data. Used for linking in dependencies before loading.
- endian
Platform endianness to use when interpreting the Block data. Useful for Blocks which have the same data layout but different endianness for stored numbers. Has no effect on fields with an predefined endianness.
- cache_bytes
Cache the bytes equivalent of the Block. Useful for debugging the loading procedure. Defaults to False.
- path_hint
Cache a string containing the path of the current Block, relative to the root.
-
image_data
= <Bytes: offset=0x0, length=<Ref: _parent.tile16_size (rw)>>¶
-
class
mrcrowbar.lib.games.keen.
EGATile32
(*args, **kwargs)[source]¶ Bases:
mrcrowbar.blocks.Block
Base class for Blocks.
- source_data
Source data to construct Block with. Can be a byte string, dictionary of attribute: value pairs, or another Block object.
- parent
Parent Block object where this Block is defined. Used for e.g. evaluating Refs.
- preload_attrs
Attributes on the Block to set before importing the data. Used for linking in dependencies before loading.
- endian
Platform endianness to use when interpreting the Block data. Useful for Blocks which have the same data layout but different endianness for stored numbers. Has no effect on fields with an predefined endianness.
- cache_bytes
Cache the bytes equivalent of the Block. Useful for debugging the loading procedure. Defaults to False.
- path_hint
Cache a string containing the path of the current Block, relative to the root.
-
image_data
= <Bytes: offset=0x0, length=<Ref: _parent.tile32_size (rw)>>¶
-
class
mrcrowbar.lib.games.keen.
EGATile8
(*args, **kwargs)[source]¶ Bases:
mrcrowbar.blocks.Block
Base class for Blocks.
- source_data
Source data to construct Block with. Can be a byte string, dictionary of attribute: value pairs, or another Block object.
- parent
Parent Block object where this Block is defined. Used for e.g. evaluating Refs.
- preload_attrs
Attributes on the Block to set before importing the data. Used for linking in dependencies before loading.
- endian
Platform endianness to use when interpreting the Block data. Useful for Blocks which have the same data layout but different endianness for stored numbers. Has no effect on fields with an predefined endianness.
- cache_bytes
Cache the bytes equivalent of the Block. Useful for debugging the loading procedure. Defaults to False.
- path_hint
Cache a string containing the path of the current Block, relative to the root.
-
image_data
= <Bytes: offset=0x0, length=<Ref: _parent.tile8_size (rw)>>¶
-
class
mrcrowbar.lib.games.keen.
EGATileStore
(*args, **kwargs)[source]¶ Bases:
mrcrowbar.blocks.Block
Base class for Blocks.
- source_data
Source data to construct Block with. Can be a byte string, dictionary of attribute: value pairs, or another Block object.
- parent
Parent Block object where this Block is defined. Used for e.g. evaluating Refs.
- preload_attrs
Attributes on the Block to set before importing the data. Used for linking in dependencies before loading.
- endian
Platform endianness to use when interpreting the Block data. Useful for Blocks which have the same data layout but different endianness for stored numbers. Has no effect on fields with an predefined endianness.
- cache_bytes
Cache the bytes equivalent of the Block. Useful for debugging the loading procedure. Defaults to False.
- path_hint
Cache a string containing the path of the current Block, relative to the root.
-
data
= <Bytes: offset=0x0, transform=<mrcrowbar.lib.images.base.Planarizer object>>¶
-
tile16
= <StoreRef: 0x00007fffa36bcbe0>¶
-
property
tile16_offset
¶
-
property
tile16_size
¶
-
tile32
= <StoreRef: 0x00007fffa37378e0>¶
-
property
tile32_offset
¶
-
property
tile32_size
¶
-
tile8
= <StoreRef: 0x00007fffa36bca90>¶
-
property
tile8_offset
¶
-
property
tile8_size
¶
-
class
mrcrowbar.lib.games.keen.
Level
(source_data=None, parent=None, preload_attrs=None, endian=None, cache_bytes=False, path_hint=None)[source]¶ Bases:
mrcrowbar.blocks.Unknown
Base class for Blocks.
- source_data
Source data to construct Block with. Can be a byte string, dictionary of attribute: value pairs, or another Block object.
- parent
Parent Block object where this Block is defined. Used for e.g. evaluating Refs.
- preload_attrs
Attributes on the Block to set before importing the data. Used for linking in dependencies before loading.
- endian
Platform endianness to use when interpreting the Block data. Useful for Blocks which have the same data layout but different endianness for stored numbers. Has no effect on fields with an predefined endianness.
- cache_bytes
Cache the bytes equivalent of the Block. Useful for debugging the loading procedure. Defaults to False.
- path_hint
Cache a string containing the path of the current Block, relative to the root.
-
data
= <Bytes: offset=0x0>¶
-
class
mrcrowbar.lib.games.keen.
LevelHeader
(source_data=None, parent=None, preload_attrs=None, endian=None, cache_bytes=False, path_hint=None)[source]¶ Bases:
mrcrowbar.blocks.Block
Base class for Blocks.
- source_data
Source data to construct Block with. Can be a byte string, dictionary of attribute: value pairs, or another Block object.
- parent
Parent Block object where this Block is defined. Used for e.g. evaluating Refs.
- preload_attrs
Attributes on the Block to set before importing the data. Used for linking in dependencies before loading.
- endian
Platform endianness to use when interpreting the Block data. Useful for Blocks which have the same data layout but different endianness for stored numbers. Has no effect on fields with an predefined endianness.
- cache_bytes
Cache the bytes equivalent of the Block. Useful for debugging the loading procedure. Defaults to False.
- path_hint
Cache a string containing the path of the current Block, relative to the root.
-
height
= <UInt16_LE: offset=0x2>¶
-
plane_count
= <UInt16_LE: offset=0x4, default=2>¶
-
plane_size
= <UInt16_LE: offset=0xe>¶
-
property
plane_size_calc
¶
-
ted_vars
= <Bytes: offset=0xa, length=4>¶
-
unknown_1
= <Bytes: offset=0x6, length=4>¶
-
unknown_2
= <Bytes: offset=0x10, length=16>¶
-
width
= <UInt16_LE: offset=0x0>¶
-
class
mrcrowbar.lib.games.keen.
LevelTile
(source_data=None, parent=None, preload_attrs=None, endian=None, cache_bytes=False, path_hint=None)[source]¶ Bases:
mrcrowbar.blocks.Block
Base class for Blocks.
- source_data
Source data to construct Block with. Can be a byte string, dictionary of attribute: value pairs, or another Block object.
- parent
Parent Block object where this Block is defined. Used for e.g. evaluating Refs.
- preload_attrs
Attributes on the Block to set before importing the data. Used for linking in dependencies before loading.
- endian
Platform endianness to use when interpreting the Block data. Useful for Blocks which have the same data layout but different endianness for stored numbers. Has no effect on fields with an predefined endianness.
- cache_bytes
Cache the bytes equivalent of the Block. Useful for debugging the loading procedure. Defaults to False.
- path_hint
Cache a string containing the path of the current Block, relative to the root.
-
tile_id
= <UInt16_LE: offset=0x0>¶
-
class
mrcrowbar.lib.games.keen.
Loader
[source]¶ Bases:
mrcrowbar.loaders.Loader
-
class
mrcrowbar.lib.games.keen.
Preview
(*args, **kwargs)[source]¶ Bases:
mrcrowbar.blocks.Block
Base class for Blocks.
- source_data
Source data to construct Block with. Can be a byte string, dictionary of attribute: value pairs, or another Block object.
- parent
Parent Block object where this Block is defined. Used for e.g. evaluating Refs.
- preload_attrs
Attributes on the Block to set before importing the data. Used for linking in dependencies before loading.
- endian
Platform endianness to use when interpreting the Block data. Useful for Blocks which have the same data layout but different endianness for stored numbers. Has no effect on fields with an predefined endianness.
- cache_bytes
Cache the bytes equivalent of the Block. Useful for debugging the loading procedure. Defaults to False.
- path_hint
Cache a string containing the path of the current Block, relative to the root.
-
image_data
= <Bytes: offset=0x0, transform=<mrcrowbar.lib.games.keen.PreviewCompressor object>>¶
-
class
mrcrowbar.lib.games.keen.
PreviewCompressor
[source]¶ Bases:
mrcrowbar.transforms.Transform
-
import_data
(buffer, parent=None)[source]¶ Perform a reverse-transform on a byte string.
- buffer
Source byte string.
- parent
Parent object of the source (to provide context for Refs).
-
plan
= <mrcrowbar.lib.images.base.Planarizer object>¶
-
rle
= <mrcrowbar.lib.games.keen.RLECompressor object>¶
-
-
class
mrcrowbar.lib.games.keen.
Scores
(source_data=None, parent=None, preload_attrs=None, endian=None, cache_bytes=False, path_hint=None)[source]¶ Bases:
mrcrowbar.blocks.Block
Base class for Blocks.
- source_data
Source data to construct Block with. Can be a byte string, dictionary of attribute: value pairs, or another Block object.
- parent
Parent Block object where this Block is defined. Used for e.g. evaluating Refs.
- preload_attrs
Attributes on the Block to set before importing the data. Used for linking in dependencies before loading.
- endian
Platform endianness to use when interpreting the Block data. Useful for Blocks which have the same data layout but different endianness for stored numbers. Has no effect on fields with an predefined endianness.
- cache_bytes
Cache the bytes equivalent of the Block. Useful for debugging the loading procedure. Defaults to False.
- path_hint
Cache a string containing the path of the current Block, relative to the root.
-
items
= <BlockField: 0x00007fffa37147f0>¶
-
names
= <BlockField: 0x00007fffa37487c0>¶
-
num_cities
= <UInt16_LE: offset=0x54, range=range(0, 9)>¶
-
term
= <Bytes: offset=0xcb, length=1>¶
-
unknown_1
= <Bytes: offset=0x62, length=14>¶
-
values
= <UInt32_LE: offset=0x0>¶
-
class
mrcrowbar.lib.games.keen.
ScoresItems
(source_data=None, parent=None, preload_attrs=None, endian=None, cache_bytes=False, path_hint=None)[source]¶ Bases:
mrcrowbar.blocks.Block
Base class for Blocks.
- source_data
Source data to construct Block with. Can be a byte string, dictionary of attribute: value pairs, or another Block object.
- parent
Parent Block object where this Block is defined. Used for e.g. evaluating Refs.
- preload_attrs
Attributes on the Block to set before importing the data. Used for linking in dependencies before loading.
- endian
Platform endianness to use when interpreting the Block data. Useful for Blocks which have the same data layout but different endianness for stored numbers. Has no effect on fields with an predefined endianness.
- cache_bytes
Cache the bytes equivalent of the Block. Useful for debugging the loading procedure. Defaults to False.
- path_hint
Cache a string containing the path of the current Block, relative to the root.
-
battery
= <UInt16_LE: offset=0x2, range=range(0, 1)>¶
-
joystick
= <UInt16_LE: offset=0x0, range=range(0, 1)>¶
-
liquor
= <UInt16_LE: offset=0x6, range=range(0, 1)>¶
-
vacuum
= <UInt16_LE: offset=0x4, range=range(0, 1)>¶
-
class
mrcrowbar.lib.games.keen.
ScoresName
(source_data=None, parent=None, preload_attrs=None, endian=None, cache_bytes=False, path_hint=None)[source]¶ Bases:
mrcrowbar.blocks.Block
Base class for Blocks.
- source_data
Source data to construct Block with. Can be a byte string, dictionary of attribute: value pairs, or another Block object.
- parent
Parent Block object where this Block is defined. Used for e.g. evaluating Refs.
- preload_attrs
Attributes on the Block to set before importing the data. Used for linking in dependencies before loading.
- endian
Platform endianness to use when interpreting the Block data. Useful for Blocks which have the same data layout but different endianness for stored numbers. Has no effect on fields with an predefined endianness.
- cache_bytes
Cache the bytes equivalent of the Block. Useful for debugging the loading procedure. Defaults to False.
- path_hint
Cache a string containing the path of the current Block, relative to the root.
-
name
= <Bytes: offset=0x0, length=13>¶
-
class
mrcrowbar.lib.games.keen.
SoundHeader
(source_data=None, parent=None, preload_attrs=None, endian=None, cache_bytes=False, path_hint=None)[source]¶ Bases:
mrcrowbar.blocks.Block
Base class for Blocks.
- source_data
Source data to construct Block with. Can be a byte string, dictionary of attribute: value pairs, or another Block object.
- parent
Parent Block object where this Block is defined. Used for e.g. evaluating Refs.
- preload_attrs
Attributes on the Block to set before importing the data. Used for linking in dependencies before loading.
- endian
Platform endianness to use when interpreting the Block data. Useful for Blocks which have the same data layout but different endianness for stored numbers. Has no effect on fields with an predefined endianness.
- cache_bytes
Cache the bytes equivalent of the Block. Useful for debugging the loading procedure. Defaults to False.
- path_hint
Cache a string containing the path of the current Block, relative to the root.
-
count
= <UInt16_LE: offset=0x8>¶
-
magic
= <Bytes: offset=0x0, length=4>¶
-
padding
= <Bytes: offset=0xa, length=6>¶
-
size
= <UInt16_LE: offset=0x4>¶
-
unknown_1
= <UInt16_LE: offset=0x6>¶
-
class
mrcrowbar.lib.games.keen.
SoundRef
(source_data=None, parent=None, preload_attrs=None, endian=None, cache_bytes=False, path_hint=None)[source]¶ Bases:
mrcrowbar.blocks.Block
Base class for Blocks.
- source_data
Source data to construct Block with. Can be a byte string, dictionary of attribute: value pairs, or another Block object.
- parent
Parent Block object where this Block is defined. Used for e.g. evaluating Refs.
- preload_attrs
Attributes on the Block to set before importing the data. Used for linking in dependencies before loading.
- endian
Platform endianness to use when interpreting the Block data. Useful for Blocks which have the same data layout but different endianness for stored numbers. Has no effect on fields with an predefined endianness.
- cache_bytes
Cache the bytes equivalent of the Block. Useful for debugging the loading procedure. Defaults to False.
- path_hint
Cache a string containing the path of the current Block, relative to the root.
-
name
= <Bytes: offset=0x4, length=12>¶
-
offset
= <UInt16_LE: offset=0x0>¶
-
priority
= <UInt8: offset=0x2>¶
-
rate
= <UInt8: offset=0x3>¶