packing/unpacking crunch-mania files from the Amiga days
Project description
📦 crunchmania
A Python compressor/decompressor for Crunch-Mania files from the Amiga era.
The format
Crunch-Mania was a file cruncher for the Commodore Amiga, written by Thomas Schwarz and released between 1989 and 1994. It was designed for in-place decompression: the compressed data is read backward and the output is written backward, so a file can be decompressed into the same memory it occupies.
There are four format variants, identified by a 4-byte magic at offset 0:
| Magic | Mode | Delta | Description |
|---|---|---|---|
CrM! |
Standard | No | Fixed Huffman + VLC |
CrM2 |
LZH | No | Dynamic Huffman per block |
Crm! |
Standard | Yes | Standard + delta encoding |
Crm2 |
LZH | Yes | LZH + delta encoding |
The lowercase m variants apply a cumulative byte delta as a post-processing
step, used for sample data where adjacent bytes tend to have similar values.
Several Amiga demos and games used obfuscated copies of the format with
different magic bytes (Iron, DCS!, MSS!, etc). These are detected and
handled transparently.
The 14-byte header is followed by the packed data stream, which is read from the end toward the start using an LSB-first bit reader initialized from the last 6 bytes of the packed block.
Installation
pip install crunchmania
CLI usage
# Show file info
crunchmania info packed_file.crm
# Decompress a file
crunchmania unpack packed_file.crm output_file
# Scan a file for embedded CrM blocks
crunchmania scan amiga_disk.adf
Library usage
from crunchmania import unpack, parse_header
data = open("packed_file.crm", "rb").read()
# Inspect the header
header = parse_header(data)
print(f"{header.magic!r}, {header.packed_size} -> {header.unpacked_size}")
# Decompress
output = unpack(data)
License
WTFPL
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file crunchmania-0.2.0.tar.gz.
File metadata
- Download URL: crunchmania-0.2.0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bb6a1858f659d5dbab1eceae1de28b30e8d260b4dadabf8fc46ddd58f40f15e
|
|
| MD5 |
1167179c26a0acffbdc88a881d56884d
|
|
| BLAKE2b-256 |
d4c83d740707d9d432055355f118ef0bb0158033e8041aaa004ae2d6e5446323
|
File details
Details for the file crunchmania-0.2.0-py3-none-any.whl.
File metadata
- Download URL: crunchmania-0.2.0-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47f8b04ccdfbed3799498d4af26617d00331a210a55db330a90fbe3e4aaa5ac4
|
|
| MD5 |
a1d836abf6f8874c760d61f77238c391
|
|
| BLAKE2b-256 |
545eb13924cbba6c7da701fb7ebce53e3dc7682020c1b559a22a39f58e912c6b
|