User:Jifodus/CMV file format

From Dwarf Fortress Wiki

Jump to: navigation, search

Contents

[edit] File Format

[edit] Header

Offset (+Hex) Type Name Information
0000 dword version Version numbers:
0x2711 - New movies
0x2710 - Old movies
0004 dword columns The number of columns.
0008 dword rows The number of rows.
000C dword unknown1 Unknown value, it's 1 in the begining movies.

[edit] Sounds

If the version is 0x2711 then this section comes right after the header.

Offset (+Hex) Type Name Information
0000 dword sounds The number of sounds in the file.
0004 char[50 * sounds] sound_files A sound file name is 50 bytes long. It's an array with sounds giving the number of sound files there are.
* dword[3200] unknown It undoubtedly has something to do with sounds. However, the only movie file that has values other than 0xFFFFFFFF in all the slots is dwarf_fortress.cmv so it's purpose is still unknown.

I do know from testing that it specifies when sounds get played, but due to the finite number of slots I have not come up with a theory explaining how it relates.

[edit] Chunk

The Sounds section & Header section comes before this. The remainder of the file is made up this way.

Offset (+Hex) Type Name Information
0000 dword size The size of the following compressed data.
0004 byte[size] sound_files Zlib's deflate compressed data, comprising no more than 200 sequential frames.

[edit] Data Format

[edit] Frame

Offset (+Hex) Type Name Information
0000 char[Header.columns * Header.rows] characters The characters making up the frame.
* attribute[Header.columns * Header.rows] attributes The color attributes of each character in the frame.

Iterate through the frame data:

 +---------> +Y
 |
 |
 |
 |
 V
+X

Or: Index = X * Header.rows + Y

[edit] Attribute

A frame is a single byte long, the bits are layed out as:

0ibbbfff
i   - Foreground Intensity Bit
bbb - Background Color Bits
fff - Foreground Color Bits
Personal tools
advertisements