Humongous CUP

From MultimediaWiki
Jump to navigation Jump to search

Humongous CUP files are used as demo movies for games from Humongous Entertainment. CUP files have the file signature 'BEAN' and are played with an executable called coffee.exe. They appear to contain non-interleaved audio and video data; all of the audio data is stored in the file first and the video data second.

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); big endian
 bytes 8..     CUP file

Following the BEAN signature is a HEAD chunk with the following format:

 bytes 0-3     'HEAD' FourCC
 bytes 4-7     size = 0x0E = 14 bytes; big endian
 bytes 8-9     unknown, always seems to be 0x0042 (66) in little endian
 bytes 10-11   video width
 bytes 12-13   video height

An RGBS chunk often appears after the HEAD chunk in a CUP file. It has the following layout:

 bytes 0-3     'RGBS' FourCC
 bytes 4-7     chunk size = 0x0308 = 776 bytes; big endian
 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: