Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:Yay0

From ReverseEngineering.wiki
Format
Platforms Platform:Nintendo 64, Platform:Nintendo GameCube
Magic 59 61 79 30 ("Yay0")
Extensions .szp, .yay0
Endianness big
On this wiki Facts · Code · Notes · Topics

Nintendo's earlier LZ77 compression (N64 games, early GameCube titles, JSystem's decodeSZP): a 16-byte header ("Yay0", decompressed size, link-table offset, data offset) followed by three separate streams: 32-bit flag words, 16-bit back-references and literal bytes. Same token rules as Yaz0.

Overview

Yay0 splits what Format:Yaz0 interleaves into three streams, which made the N64-era decoders faster. Library:JSystem keeps a decoder (JKRDecomp::decodeSZP), and RARC file entries without attribute 0x80 but with 0x04 are Yay0 (Format:RARC archive).

Header

Offset Size Field
0x00 4 magic Yay0
0x04 4 decompressed size
0x08 4 offset of the link (back-reference) table
0x0C 4 offset of the literal/count byte stream
0x10 ... flag words (big-endian u32, MSB first)

Decoding

For each flag bit: 1 copies the next byte of the data stream; 0 reads a 16-bit big-endian link: distance = (link & 0xFFF) + 1, n = link >> 12; if n is 0 the length is the next byte of the data stream + 0x12, else n + 2. Offsets are from the file start.

Test vector

59 61 79 30 00 00 00 0A 00 00 00 14 00 00 00 16 80 00 00 00 70 00 61 decodes to aaaaaaaaaa (the Format:Yaz0 vector in Yay0 form), checked with the decoder on Code:DOL executable/GameCube formats toolkit (Python).