From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "struct" |
|---|
| subject | "Format:CHD (MAME Compressed Hunks of Data)" |
|---|
| claim | "A compressed v5 map starts at mapoffset with a 16-byte header: u32 compressed length of the bitstream, 48-bit offset of the first hunk's data, u16 CRC-16 of the expanded map, then three bit widths (lengthbits, selfbits, parentbits) and a reserved byte. The bitstream follows at mapoffset+16. libchdr rejects any of the three widths above 32." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "CHD v5 files with compressors[0] != 0" |
|---|
| observed_in | |
|---|
|
|---|
| data | | name | "ChdV5MapHeader" |
|---|
| size | "16" |
|---|
| endianness | "big" |
|---|
| fields | | offset | "0x0" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "length" |
|---|
| notes | "bytes of compressed map data after this header" |
|---|
|
| offset | "0x4" |
|---|
| size | 6 |
|---|
| type | "uint8_t[6]" |
|---|
| name | "datastart" |
|---|
| notes | "48-bit big-endian offset of first block" |
|---|
|
| offset | "0xA" |
|---|
| size | 2 |
|---|
| type | "uint16_t" |
|---|
| name | "crc" |
|---|
| notes | "CRC-16 of the expanded 12-byte-per-hunk map" |
|---|
|
| offset | "0xC" |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "lengthbits" |
|---|
|
| offset | "0xD" |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "hunkbits" |
|---|
| notes | "bits for self-references (selfbits in libchdr)" |
|---|
|
| offset | "0xE" |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "parentunitbits" |
|---|
|
| offset | "0xF" |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "reserved" |
|---|
|
|
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "compressed map header comment" |
|---|
| repo | "https://github.com/rtissera/libchdr" |
|---|
| commit | "47d794151b2b64f6aba60304e6480f4f5a2bc24b" |
|---|
| path | "include/libchdr/chd.h" |
|---|
| lines | "152-161" |
|---|
|
| type | "source" |
|---|
| detail | "decompress_v5_map reads 16 bytes at mapoffset and checks the widths" |
|---|
| repo | "https://github.com/rtissera/libchdr" |
|---|
| commit | "47d794151b2b64f6aba60304e6480f4f5a2bc24b" |
|---|
| path | "src/libchdr_chd.c" |
|---|
| lines | "1145-1160" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "Version 5 compressed map header" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-19T11:59:03.177Z" |
|---|
| verifications | |
|---|