Humongous CUP

From MultimediaWiki
Jump to navigation Jump to search

Data Format

Multi-byte numbers may be little or big endian

 bytes 0-3    chunk type FourCC
 bytes 4-7    chunk size (including this 8-byte preamble); big endian
 bytes 8..    chunk payload

The top-level chunk in a CUP file is the 'BEAN' chunk which encapsulates the entire file and can also serve as a file signature:

 bytes 0..3   'BEAN' FourCC
 bytes 4..7   size of entire CUP file (including this preamble)
 bytes 8..    CPU file

An RGBS chunk is often the first to appear in a CUP file after the signature. It has the following layout:

 bytes 0..3    'RGBS' FourCC
 bytes 4..7    chunk size = 0x0308 = 776
 bytes 8..775  palette entries

The palette entries are 256 3-byte triplets of red-green-blue palette components. Each component is 8 bits (as opposed to 6 bits which is often seen in palettized formats).

Chunk Types

BEAN: file signature

HEAD: contains 10-byte payload including unknown 16-bit quantity and 32-bit width and height stored as little-endian

RGBS: palette triplets; payload should be 0x300 (768, 256x3) bytes long; values range from 0..255; must be a constant length since it has no provision for palette replacement

SFXB..WRAP..OFFS: apparently a setup for audio data

DATA: audio or video data; audio data is 8-bit, unsigned PCM

BLOK: video data block?

SRLE: apparently the video compression type, possibly based on lzss.c

SNDE: reference into audio data?

RATE: