From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "behavior" |
|---|
| subject | "Format:Yaz0" |
|---|
| claim | "Yaz0 data after the 16-byte header is groups of a flag byte (MSB first) and 8 tokens: bit 1 = one literal byte; bit 0 = two bytes b0 b1 with distance ((b0 & 0xF) << 8 | b1) + 1 and length (b0 >> 4) + 2, or, when b0 >> 4 is 0, a third byte + 0x12 (lengths 3-17 and 18-273, distances 1-4096). Copies are byte by byte (overlap repeats). Decoding stops at the decompressed size from offset 4." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:Yaz0" |
|---|
| observed_in | |
|---|
|
|---|
| data | | effect | "LZ77 with 4 KiB window, 8 tokens per flag byte" |
|---|
| function | "JKRDecomp::decodeSZS" |
|---|
| test_vectors | | input | "flag 80, literal 61, ref 70 00" |
|---|
| expected | "a + 9 copies at distance 1 = aaaaaaaaaa" |
|---|
|
| input | "flag 80, literal 62, ref 00 00 00" |
|---|
| expected | "b + 18 copies = 19 x b" |
|---|
|
|
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "decodeSZS: data from src+0x10; chunkBits & 0x80 literal; else local_28 = b1 | (b0 & 0xF) << 8, copyStart = dst - local_28 and reads copyStart[-1]; r31 = b0 >> 4, 0 -> count = next byte + 0x12 else r31 + 2; loop until decompressed size" |
|---|
| repo | "https://github.com/zeldaret/tww" |
|---|
| commit | "8b93b372dc8e841f12ddfb7e0215626f62b05417" |
|---|
| path | "src/JSystem/JKernel/JKRDecomp.cpp" |
|---|
| lines | "206-268" |
|---|
|
| type | "runtime_test" |
|---|
| detail | "gcnfmt.py yaz0_decompress implements these rules; round trip with its encoder on 1,774 bytes passes" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "Yaz0 token encoding" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-17T18:22:22.304Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T08:51:30.149Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read JKRDecomp::decodeSZS at zeldaret/tww 8b93b37: data from +0x10, flag bit 0x80 literal, distance (b0&0xF)<<8|b1 with copyStart[-1], length b0>>4 or third byte + 0x12 when 0, else +2. The function also skips the first dstSize output bytes (partial decode) and ends at the size read from offset 4." |
|---|
|
|
|---|