From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "struct" |
|---|
| subject | "Format:CHD (MAME Compressed Hunks of Data)" |
|---|
| claim | "The CHD v4 header is 108 bytes (big-endian): after tag, length and version come flags, one compression id, totalhunks, logicalbytes, metaoffset, hunkbytes, then combined SHA-1, parent combined SHA-1 and raw SHA-1." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "CHD version 4" |
|---|
| observed_in | |
|---|
|
|---|
| data | | name | "ChdHeaderV4" |
|---|
| size | "108" |
|---|
| endianness | "big" |
|---|
| fields | | offset | "0x0" |
|---|
| size | 8 |
|---|
| type | "char[8]" |
|---|
| name | "tag" |
|---|
|
| offset | "0x8" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "length" |
|---|
| notes | "108" |
|---|
|
| offset | "0xC" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "version" |
|---|
| notes | "4" |
|---|
|
| offset | "0x10" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "flags" |
|---|
| notes | "bit0 has parent, bit1 writable; other bits must be 0" |
|---|
|
| offset | "0x14" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "compression" |
|---|
| notes | "0 none, 1 zlib, 2 zlib+, 3 AV" |
|---|
|
| offset | "0x18" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "totalhunks" |
|---|
|
| offset | "0x1C" |
|---|
| size | 8 |
|---|
| type | "uint64_t" |
|---|
| name | "logicalbytes" |
|---|
|
| offset | "0x24" |
|---|
| size | 8 |
|---|
| type | "uint64_t" |
|---|
| name | "metaoffset" |
|---|
|
| offset | "0x2C" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "hunkbytes" |
|---|
|
| offset | "0x30" |
|---|
| size | 20 |
|---|
| type | "uint8_t[20]" |
|---|
| name | "sha1" |
|---|
| notes | "combined raw+meta" |
|---|
|
| offset | "0x44" |
|---|
| size | 20 |
|---|
| type | "uint8_t[20]" |
|---|
| name | "parentsha1" |
|---|
|
| offset | "0x58" |
|---|
| size | 20 |
|---|
| type | "uint8_t[20]" |
|---|
| name | "rawsha1" |
|---|
|
|
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "V4 header comment table ending with [108]; flags and compression ids" |
|---|
| repo | "https://github.com/rtissera/libchdr" |
|---|
| commit | "47d794151b2b64f6aba60304e6480f4f5a2bc24b" |
|---|
| path | "include/libchdr/chd.h" |
|---|
| lines | "107-127, 190-203" |
|---|
|
| type | "source" |
|---|
| detail | "case 4 of header_read" |
|---|
| repo | "https://github.com/rtissera/libchdr" |
|---|
| commit | "47d794151b2b64f6aba60304e6480f4f5a2bc24b" |
|---|
| path | "src/libchdr_chd.c" |
|---|
| lines | "2887-2903" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "Version 4 header" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-19T11:59:03.034Z" |
|---|
| verifications | |
|---|