CCF archive

From WiiBrew
Jump to navigation Jump to search

A CCF archive is an archive format used in Virtual Console games. It contains optional Zlib compression, and can hold multiple files without directories.


First comes a header:

 struct CCF_archive_header
  u32 tag; // 0x43434600 "CCF\0"
  u8 zeroes1[12];
  u32 rootnode_offset; // offset to root_node, always 0x20.
  u32 file_count; // number of files
  u8 zeroes2[8];

Then comes a series of file descriptors.

 struct CCF_file_descriptor
  u8 name[20] // null-padded ASCII
  u32 data_offset;
  u32 size;
  u32 decompressed_size;

data_offset is the real offset divided by 32. All files are at offsets that are multiples of 32 bytes, gaps are filled with zeroes.

size is the size of the file in bytes (not including the zeroes gap fill at the end).

If decompressed_size is equal to size, the file is stored raw. If not, it gives the decompressed size of the file; pass the raw data into ZLib's deflate() function, or compile up ZLib's zpipe example.

Following that is the file data. Contained files are typically a mixture of raw data and embedded archives.