.fm2

Parent Previous Next

FCEUX Movie File format



FCEUX uses a new movie file format - .fm2.


This differs from the previous FCE Ultra movie format (.fcm) in the following ways:



Format


FM2 consists of two parts: Header and Input Log.

The header is always in ASCII plain text format. It consists of several key-value pairs.

The input log section can be identified by it starting with a | (pipe).

The input log section can be either in ASCII plain text format or in binary format.

The input log section terminates at EOF, unless the length key is specified in header.

Newlines may be \r\n or \n.



Header


Key-value pairs consist of a key identifier, followed by a space separator, followed by the value text.

Value text is always terminated by a newline, which the value text does not include.

The value text is parsed differently depending on the type of the key.

The key-value pairs may be in any order, except that the first key must be version.


Integer keys (also used for booleans, with a 1 for true and 0 for false) must have a value that can be stored as int32:


- version (required) - the version of the movie file format; for now it is always 3


- emuVersion (required) - the version of the emulator used to produce the movie


- rerecordCount (optional) - the rerecord count


- palFlag (bool) (optional) - true if the movie uses PAL timing


- NewPPU (bool) (optional) - true if the movie uses New PPU


- FDS (bool) (optional) - true if movie was recorded on a Famicom Disk System (FDS) game


- fourscore (bool) - true if a fourscore was used. If fourscore is not used, then port0 and port1 are required


- port0 - indicates the type of input device attached to the port 0. Supported values are:

    SI_NONE = 0

    SI_GAMEPAD = 1

    SI_ZAPPER = 2


- port1 - indicates the type of input device attached to the port 1. Supported values are:

    SI_NONE = 0

    SI_GAMEPAD = 1

    SI_ZAPPER = 2


- port2 (required) - indicates the type of the FCExp port device which was attached. Supported values are:

    SIFC_NONE = 0


- binary (bool) (optional) - true if input log is stored in binary format


- length (optional) - movie size (number of frames in the input log). If this key is specified and the number is >= 0, the input log ends after specified number of records, and any remaining data should not be parsed. This key is used in fm3 format to allow storing extra data after the end of input log



String keys have values that consist of the remainder of the key-value pair line. As a consequence, string values cannot contain newlines.


- romFilename (required) - the name of the file used to record the movie


- comment (optional) - simply a memo

Example:


- subtitle (optional) - a message that will be displayed on screen when movie is played back (unless Subtitles are turned off, see Movie options)

Example:

At frame 1000 the words "Level Two" will be displayed on the screen


- guid (required) - a unique identifier for a movie, generated when the movie is created, which is used when loading a savestate to make sure it belongs to the current movie

GUID keys have a value which is in the standard guide format: 452DE2C3-EF43-2FA9-77AC-0677FC51543B


- romChecksum (required) - the base64 of the hexified MD5 hash of the ROM which was used to record the movie


- savestate (optional) - a fcs savestate blob, in case a movie was recorded from savestate  

Hex string keys (used for binary blobs) have a value that is like 0x0123456789ABCDEF...



Input log


The input log section consists of movie records either in the form of text lines or in the form of binary data.



Text format (default format):


Every frame of the movie is represented by line of text beginning and ending with a | (pipe).

The fields in the line are as follows, except when fourscore is used.

|commands|port0|port1|port2|


Field commands is a variable length decimal integer which is interpreted as a bit field corresponding to miscellaneous input states which are valid at the start of the frame. Current values for this are:


The format of port0, port1, port2 depends on which types of devices were attached.


SI_GAMEPAD:


SI_ZAPPER:

XXX: %03d, the x position of the mouse

YYY: %03d, the y position of the mouse

B: %1d, 1 if the mouse button is pressed; 0 if not

Q: %1d, an internal value used by the emulator's zapper code

Z: %d, a variable-length decimal integer; an internal value used by the emulator's zapper code


SI_NONE:


If a fourscore is used, then port0 and port1 are irrelevant and ignored.

The input types must all be gamepads, and each input log record must be in the following format:

|commands|RLDUTSBA|RLDUTSBA|RLDUTSBA|RLDUTSBA|port2|

{commands, player1, player2, player3, player4, port2}



Binary format:


Input log section starts with a | (pipe).

Every frame of the movie is represented by a record of a fixed length which can be determined by the devices on port0 and port1.


The first byte of each record stores "commands" bit field.


The remaining bytes in the record depend on which types of devices are attached to port0 and port1.


SI_GAMEPAD:


SI_ZAPPER:


SI_NONE:


If a fourscore is used, then port0 and port1 are irrelevant and ignored. 4 bytes are added to the size of record. The bits of the 1st byte represent the state of buttons of the 1st joypad (bit0 = A, bit1 = B, bit2 = Select, bit3 = sTart, bit4 = Up, bit5 = Down, bit6 = Left, bit7 = Right); bits of the 2nd byte represent the state of buttons of the 2nd joypad, and so on.




Notes:


A. All movies start from power-on, unless a savestate key-value is present.


B. The emulator uses these framerate constants

 - NTSC: 1008307711 /256/65536 = 60.099822938442230224609375

 - PAL : 838977920  /256/65536 = 50.00698089599609375




Created with the Personal Edition of HelpNDoc: Create iPhone web-based documentation