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.

Description

First comes a 32-byte header:

 struct CCF_archive_header
 {
  u32 tag; // 0x43434600 "CCF\0"
  u8 zeroes1[12];
  u32 offset_multiplier; // Typically 0x20
  u32 file_count; // number of files
  u8 zeroes2[8];
 };

Then comes a series of 32-byte 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 offset_multiplier. All files are at offsets that are multiples of offset_multiplier, 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.