v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

Difference between revisions of "User:Jifodus/CMV file format"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
m (→‎Frame: Added a pseudocode example of indexing frame data.)
(→‎File Format: g_src includes the code for movieplayer, and this is how it actually works)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
[[Category:Hacking|CMV file format]]
 
=File Format=
 
=File Format=
 
==Header==
 
==Header==
Line 28: Line 29:
 
| align="right" | 000C
 
| align="right" | 000C
 
| dword
 
| dword
| unknown1
+
| delayrate
| Unknown value, it's 1 in the begining movies.
+
| Sound playback rate, in 1/100 sec per frame.
  
 
|}
 
|}
 +
 
==Sounds==
 
==Sounds==
 
If the version is 0x2711 then this section comes right after the header.
 
If the version is 0x2711 then this section comes right after the header.
Line 48: Line 50:
 
|-
 
|-
 
| align="right" | 0004
 
| align="right" | 0004
| char[50 * sounds]
+
| char[sounds][50]
 
| sound_files
 
| sound_files
| A sound file name is 50 bytes long. It's an array with sounds giving the number of sound files there are.
+
| The filenames of each sound that can be played during the movie. Filenames are null-terminated and padded to 50 bytes; the game itself will look for "data\sound\[filename].ogg".
  
 
|-
 
|-
 
| align="right" | *
 
| align="right" | *
| dword[3200]
+
| dword[200][16]
| unknown
+
| sound_time
| 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.<br /><br />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.
+
| Sound IDs to play during the first 200 "sound ticks" (as per the "delayrate" specified above). Up to 16 sounds can be played during each frame.
  
 
|}
 
|}
Line 77: Line 79:
 
| align="right" | 0004
 
| align="right" | 0004
 
| byte[size]
 
| byte[size]
| sound_files
+
| data
 
| Zlib's deflate compressed data, comprising no more than 200 sequential [[User:Jifodus/CMV_file_format#Frame|frames]].
 
| Zlib's deflate compressed data, comprising no more than 200 sequential [[User:Jifodus/CMV_file_format#Frame|frames]].
  
 
|}
 
|}
 +
 
=Data Format=
 
=Data Format=
 
==Frame==
 
==Frame==
Line 99: Line 102:
 
| attribute[Header.columns * Header.rows]
 
| attribute[Header.columns * Header.rows]
 
| attributes
 
| attributes
| The color attributes of each character in the frame.
+
| The [[Color#Color_flags|color attributes]] of each character in the frame.
  
 
|}
 
|}

Latest revision as of 13:20, 18 June 2013

File Format[edit]

Header[edit]

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 delayrate Sound playback rate, in 1/100 sec per frame.

Sounds[edit]

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[sounds][50] sound_files The filenames of each sound that can be played during the movie. Filenames are null-terminated and padded to 50 bytes; the game itself will look for "data\sound\[filename].ogg".
* dword[200][16] sound_time Sound IDs to play during the first 200 "sound ticks" (as per the "delayrate" specified above). Up to 16 sounds can be played during each frame.

Chunk[edit]

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] data Zlib's deflate compressed data, comprising no more than 200 sequential frames.

Data Format[edit]

Frame[edit]

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

Attribute[edit]

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