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:GCZ

From ReverseEngineering.wiki
Format
Platforms Platform:Nintendo GameCube, Platform:Nintendo Wii
Magic 01 C0 0B B1 (0xB10BC001, little endian)
Extensions .gcz
Endianness little (raw host structs)
On this wiki Facts · Code · Notes · Topics

Dolphin's zlib-compressed GameCube/Wii disc image (.gcz, magic bytes 01 C0 0B B1): a 32-byte little-endian header, a table of 64-bit block pointers whose top bit marks stored blocks, a table of Adler-32 hashes, then deflate blocks.

Overview

GCZ is the oldest of Dolphin's compressed disc containers. It cuts a Format:GCM disc image (GameCube and Wii) into fixed-size blocks and deflates each one. Everything here is from dolphin-emu/dolphin (GPL-2.0-or-later), Source/Core/DiscIO/CompressedBlob.h and CompressedBlob.cpp at commit 41460454e9600f909950fddf0abd13a138430162. The header comment says the code is not big-endian safe: the structs are read and written as raw host memory, so the fields are little endian on the x86/ARM hosts Dolphin runs on.

Layout

  • Header, 32 bytes (CompressedBlobHeader): u32 magic_cookie, u32 sub_type, u64 compressed_data_size, u64 disc_size, u32 block_size, u32 num_blocks.
  • Then num_blocks u64 block pointers, then num_blocks u32 hashes, then the data. The header comment in CompressedBlob.h describes the pointers and hashes as interleaved; the reader (CompressedBlob.cpp lines 78-87) reads the whole pointer array first and the whole hash array after it, and the data starts at 32 + 12 * num_blocks.
  • A block pointer is relative to the start of the data area. Its top bit (1 << 63) is set when the block is stored uncompressed; the offset is the other 63 bits. The compressed length of block n is pointer[n+1] - pointer[n] (flags cleared); for the last block it is compressed_data_size - pointer[n].
  • A stored block must be exactly block_size bytes long. A compressed block is a zlib stream (inflate with zlib header, not raw deflate) that must produce exactly block_size bytes; the reader allocates block_size + 64 bytes for it and rejects larger ones.
  • The hash of block n is an Adler-32 of the block as stored (compressed or raw bytes), not of the decompressed data. A mismatch is only logged as corruption by GetBlock; it does not fail the read.

Validation by Dolphin

Initialize checks the magic, that the pointer and hash tables fit in the file, that header + compressed_data_size is not larger than the file, that num_blocks is not 0, and then every block pointer (offset and next offset within compressed_data_size, stored blocks exactly block_size long, compressed blocks not longer than block_size + 64); any invalid pointer makes the file unreadable.

Writer

CompressFileToBlob deflates every block at level 9 and writes the block raw when deflate does not finish or saves fewer than 10 bytes (avail_out < 10). The comment in CompressedBlob.h says blocks that do not compress to under 97% are stored as is, but the code tests only the 10-byte margin. The last block is zero padded to block_size, and disc_size is the data size reported by the source reader. The header, pointers and hashes are written at the end, once the sizes are known.

Identification

The first four bytes are 01 C0 0B B1 (the constant 0xB10BC001 stored little endian). The comment next to the struct member still shows an older value, 0xB10BB10B; the code compares with 0xB10BC001. Dolphin picks the container by this first u32 alone; see Format:GCM disc image (GameCube and Wii)#Disc containers read by Dolphin. Unverified: the block_size of files written by Dolphin's GUI (this page did not read the caller); check header offset 0x18 of a real file.

Related

Format:WIA and RVZ, Format:WBFS disc container, Format:Wii CISO (Dolphin).

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/CompressedBlob.h/.cpp (GCZ), CISOBlob.h/.cpp (Wii CISO) and Blob.cpp (container detection by first u32)
    Tested on: source read, not run · checked 2026-10-19; last activity 2026-10-18