From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "behavior" |
|---|
| subject | "Format:DAT (Fallout)" |
|---|
| claim | "The Fallout 1 LZSS decoder uses a 4096-byte ring buffer filled with spaces (0x20) for the first 4078 bytes and starts writing at index 4078; each flag byte is consumed least-significant bit first and a set bit means one literal byte; a clear bit means a 2-byte match: low byte plus the high nibble of the second byte (shifted left 4) give the absolute ring index, and the low nibble plus 3 gives the length (3-18)." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "fallout1-ce lzss.cc (lzss_decode_to_buf and lzss_decode_to_file); the Fallout 2 DAT uses zlib instead" |
|---|
| observed_in | |
|---|
|
|---|
| data | | trigger | "decoding an LZSS-compressed Fallout 1 file or block" |
|---|
| effect | "ring buffer indices are masked with 0xFFF; matches copy byte by byte through the ring so overlapping copies work" |
|---|
| condition | "Fallout 1 DAT entries with codec 16 or 64 (non-stored blocks)" |
|---|
| function | "lzss_decode_to_buf, lzss_decode_chunk_to_buf" |
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "memset(ring_buffer, ' ', 4078); ring_buffer_index = 4078; flag bits tested byte & 0x01..0x80 in order; chunk_to_buf: type != 0 literal; else dict_offset = low | ((high & 0xF0) << 4), chunk_length = (high & 0x0F) + 3, index & 0xFFF" |
|---|
| repo | "https://github.com/alexbatalov/fallout1-ce" |
|---|
| commit | "0609bcfd0ec40ff0571d0f57fab2821eb461dc8b" |
|---|
| path | "src/plib/db/lzss.cc" |
|---|
| lines | "37-60, 244-274" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "Fallout 1 LZSS variant" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-19T09:38:30.017Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T11:48:55.493Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read fallout1-ce lzss.cc at 0609bcf: memset(ring,' ',4078), index 4078, flag bits 0x01..0x80, literal when bit set, match = low | (high&0xF0)<<4 and (high&0x0F)+3, masked 0xFFF, copy byte by byte. Note: the length argument is the packed byte count." |
|---|
|
|
|---|