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:WIA and RVZ

From ReverseEngineering.wiki
Format
Platforms Platform:Nintendo GameCube, Platform:Nintendo Wii
Magic 57 49 41 01 ("WIA\x01") or 52 56 5A 01 ("RVZ\x01")
Extensions .wia, .rvz
Endianness big
On this wiki Facts · Code · Notes · Topics

Dolphin's compressed disc containers: WIA (magic WIA\x01, from wit) and RVZ (RVZ\x01, Dolphin's extension), a 0x48-byte header 1, a 0xDC-byte header 2 holding a copy of the first 0x80 disc bytes, and tables of partition, raw-data and group entries; chunks are compressed with Purge, Bzip2, LZMA, LZMA2 or Zstandard.

Overview

WIA and RVZ store a GameCube or Wii disc image (Format:GCM disc image (GameCube and Wii)) in compressed chunks and, for Wii, as decrypted partition data with the hash blocks removed. The structures below are from dolphin-emu/dolphin (GPL-2.0-or-later) Source/Core/DiscIO/WIABlob.h at commit 41460454e9; Dolphin's own format notes are in docs/WiaAndRvz.md (read at the same commit; its statements are cited below by line).

Magic and versions

The constants are written byte-swapped for a little-endian host: WIA_MAGIC 0x01414957 is the file bytes 57 49 41 01, RVZ_MAGIC 0x015A5652 is 52 56 5A 01 (WIABlob.h lines 40-41). Versions: WIA_VERSION 0x01000000, WIA write-compatible 0x01000000, read-compatible 0x00080000; RVZ_VERSION 0x01000000, RVZ write and read-compatible 0x00030000 (lines 391-397). Dolphin rejects a file whose version_compatible is above its own version or whose version is below its read-compatible limit (WIABlob.cpp around line 110).

Header 1 (0x48 bytes, big endian, packed)

u32 magic, u32 version, u32 version_compatible, u32 header_2_size, SHA-1 of header 2 (20 bytes), u64 iso_file_size, u64 wia_file_size, SHA-1 of header 1 (20 bytes).

Header 2 (0xDC bytes)

u32 disc_type (1 GameCube, 2 Wii, 0 unknown; WIABlob.cpp lines 1989-1998), u32 compression_type, s32 compression_level (informative only), u32 chunk_size, 0x80 bytes of the disc header, u32 number_of_partition_entries, u32 partition_entry_size, u64 partition_entries_offset, SHA-1 of the partition entries, u32 number_of_raw_data_entries, u64 raw_data_entries_offset, u32 raw_data_entries_size, u32 number_of_group_entries, u64 group_entries_offset, u32 group_entries_size, u8 compressor_data_size and 7 bytes of compressor data (for LZMA and LZMA2 the encoder properties).

Compression types (enum WIARVZCompressionType): 0 None, 1 Purge, 2 Bzip2, 3 LZMA, 4 LZMA2, 5 Zstd. Unverified: RVZ files written by Dolphin typically use Zstd.

Entry tables

  • Partition entry (0x30 bytes): 16-byte partition key, then two data entries of (u32 first_sector, u32 number_of_sectors, u32 group_index, u32 number_of_groups).
  • Raw data entry (0x18 bytes): u64 data_offset, u64 data_size, u32 group_index, u32 number_of_groups.
  • Group entry: WIA 8 bytes (u32 data_offset >> 2, u32 data_size); RVZ 12 bytes, adding u32 rvz_packed_size (per docs/WiaAndRvz.md line 194: the size after decompression but before decoding the RVZ packing; 0 means the group is not packed).
  • Hash exception entry (0x16 bytes): u16 offset and a SHA-1. Per docs/WiaAndRvz.md lines 133-142 each one is a difference between the hash the reader recomputes from the partition data and the hash on the original disc: the offset counts only hash bytes (0x0000-0x03FF maps to disc offset 0x0000-0x03FF of the 2 MiB group, 0x0400-0x07FF to 0x8000-0x83FF, and so on) and the replacement is applied after all hashes of that 2 MiB are computed and before they are encrypted.

Notes

The 16-byte partition key in a partition entry is key material and must not be published or copied into notes. Chunk size rules (docs/WiaAndRvz.md lines 45 and 178-180): WIA chunk_size must be a multiple of 2 MiB; RVZ also allows any power of two from 32 KiB up, and larger sizes only as multiples of 2 MiB. Unverified: the chunk_size Dolphin's converter chooses by default; check header 2 offset 0x0C of a real file.

Related

Format:WBFS disc container.

Reading rules

What Dolphin's reader does with the headers (Source/Core/DiscIO/WIABlob.cpp at commit 41460454e9600f909950fddf0abd13a138430162, lines 95-163):

  • The magic must match the reader (WIA reader accepts only WIA, RVZ reader only RVZ). The file is rejected if its version_compatible is greater than Dolphin's version, or if Dolphin's read-compatible limit is greater than the file's version (WIA 0x00080000, RVZ 0x00030000; WIABlob.h lines 391-397). Version numbers are AABBCCDD = A.BB.CC (docs line 17-23); wit v2.40a writes version 0x01000000 and version_compatible 0x00090000 (docs line 29).
  • SHA-1 of the first 0x34 bytes of header 1 (everything before header_1_hash) must equal header_1_hash, wia_file_size must equal the real file size, header_2_size must be at least 0xDC minus the 7 compressor bytes (0xD5), the SHA-1 of header 2 must match, compressor_data_size must be at most 7, and the SHA-1 of the partition entries must match.
  • chunk_size is accepted if it is a multiple of 2 MiB (VolumeWii::GROUP_TOTAL_SIZE), or, for RVZ only, a power of two of at least 0x8000.
  • compression_type above LZMA2 is rejected for WIA, above Zstd for RVZ, and Purge is rejected for RVZ.
  • Compressor data (docs lines 60-85): for LZMA the 5 bytes are the 7-Zip properties (lc/lp/pb byte, then a little-endian u32 dictionary size); for LZMA2 one byte encodes the dictionary size; for None, Purge and Bzip2 and for Zstandard there is none.

Group entries (WIABlob.cpp lines 520-545): in RVZ the top bit of data_size set means the data uses the header's compression method, clear means it is stored uncompressed; the low 31 bits are the stored size. A stored size of 0 means the whole group is zeros (with empty exception lists). The data offset is data_off4 << 2. The first raw-data entry has data_offset 0x80 and size 0x4FF80 but really covers 0x50000 bytes; the first 0x80 bytes come from header 2 (docs line 111).

Wii partition data is stored decrypted with the 0x400-byte hash blocks removed (0x7C00 of every 0x8000 bytes), and the reader must recompute the hashes and then apply the exception lists (docs lines 100-146). Each group of Wii data starts with exception lists, one per 2 MiB in WIA (one per chunk in RVZ with chunks under 2 MiB); for Purge they are stored uncompressed, for the other methods compressed with the data, and for None and Purge they are padded to a 4-byte boundary.

Purge (WIA only; docs lines 160-170): the group is a list of segments (u32 offset, u32 size, data) in ascending offset order, then a SHA-1 of the exception lists and segments; uncovered bytes are zero.

RVZ packing (docs lines 196-247): applied under the compression method. The stream is a sequence of records: a big-endian u32 size; if its top bit is clear, size literal bytes follow; if set, the low 31 bits are a byte count and 68 bytes of seed follow, from which a lagged Fibonacci generator (xor, lags 32 and 521, 521 words filled from the 17 seed words) regenerates the pseudorandom padding that GameCube and Wii discs contain between files. The generator state is advanced four times before output and once per 521 words, and when the output offset is not a multiple of 32 KiB it is first advanced by offset mod 0x8000 bytes (offsets of partition data do not count hashes, but the modulus is still 32 KiB). One output byte uses a shift of 18 where 16 would be expected (docs line 242).

Code & repositories

  • https://github.com/dolphin-emu/dolphin @ 41460454e9600f909950fddf0abd13a138430162 · license: GPL-2.0-or-later (declared by the contributor; GitHub's detector did not recognize COPYING)
    Source/Core/DiscIO/WIABlob.h and WIABlob.cpp: WIA/RVZ header, entry structures and reader/writer; docs/WiaAndRvz.md describes the format
    Tested on: source read, not run · checked 2026-10-19; last activity 2026-10-18