<pclass="rvps10"><spanclass="rvts21">The FM3 format is a simple extension of the FM2 format. FM2 files contain data which is needed for replaying the movie, and FM3 just adds Taseditor's working data to the end of FM2 file.</span></p>
<pclass="rvps10"><spanclass="rvts21">You can read full specifications of FM2 format in the FCEUX Help and on </span><aclass="rvts27"href="http://www.fceux.com/web/FM2.html"target="_blank">official site</a><spanclass="rvts21">.</span></p>
<pclass="rvps10"><spanclass="rvts21">The Header is always in ASCII plain text format.</span></p>
<pclass="rvps10"><spanclass="rvts21">It consists of several key-value pairs (lines of text where all symbols before the first space separator are considered to be the keyword and all symbols after this separator are considered to be the text representation of the value).</span></p>
<pclass="rvps10"><spanclass="rvts21">Newlines may be </span><spanclass="rvts70">\r\n</span><spanclass="rvts21"> or </span><spanclass="rvts70">\n</span><spanclass="rvts21">.</span></p>
<pclass="rvps10"><spanclass="rvts21">If a line starts from "|" (pipe), it means the end of Header and the beginning of Input Log.</span></p>
<pclass="rvps10"><spanclass="rvts21">The key-value pairs may be in any order, except that the first key must be </span><spanclass="rvts25">version</span><spanclass="rvts21">.</span></p>
<pclass="rvps10"><spanclass="rvts21">Value text is always terminated by a newline, which the value text does not include.</span></p>
<pclass="rvps10"><spanclass="rvts21">The value text is parsed differently depending on the keyword, it can be either integer or string.</span></p>
<pclass="rvps10"><spanclass="rvts21">(also used for booleans, with a 1 for </span><spanclass="rvts70">true</span><spanclass="rvts21"> and 0 for </span><spanclass="rvts70">false</span><spanclass="rvts21">)</span></p>
<pclass="rvps10"><spanclass="rvts21">(the value can be stored as </span><spanclass="rvts70">int32</span><spanclass="rvts21">)</span></p>
<liclass="rvps10"><spanclass="rvts25">version</span><spanclass="rvts21"> (required) – the version of the movie file format; for now it is always </span><spanclass="rvts25">3</span></li>
<liclass="rvps10"><spanclass="rvts25">emuVersion</span><spanclass="rvts21"> (required) – the version of the emulator used to produce the file (e.g. </span><spanclass="rvts25">21060</span><spanclass="rvts21">)</span></li>
<liclass="rvps10"><spanclass="rvts25">rerecordCount</span><spanclass="rvts21"> (optional) – the rerecord count</span></li>
<liclass="rvps10"><spanclass="rvts25">palFlag</span><spanclass="rvts21"> (</span><spanclass="rvts70">bool</span><spanclass="rvts21">) (optional) –</span><spanclass="rvts70">true </span><spanclass="rvts21">if the movie uses PAL timing</span></li>
<liclass="rvps10"><spanclass="rvts25">NewPPU</span><spanclass="rvts21"> (</span><spanclass="rvts70">bool</span><spanclass="rvts21">) (optional) –</span><spanclass="rvts70">true </span><spanclass="rvts21">if the movie uses New PPU</span></li>
<liclass="rvps10"><spanclass="rvts25">FDS</span><spanclass="rvts21"> (</span><spanclass="rvts70">bool</span><spanclass="rvts21">) (optional) –</span><spanclass="rvts70">true </span><spanclass="rvts21">if the movie was recorded on a Famicom Disk System (FDS) game</span></li>
<liclass="rvps10"><spanclass="rvts25">fourscore</span><spanclass="rvts21"> (</span><spanclass="rvts70">bool</span><spanclass="rvts21">) –</span><spanclass="rvts70">true</span><spanclass="rvts21"> if a fourscore was used. If fourscore is not used, then </span><spanclass="rvts25">port0</span><spanclass="rvts21"> and </span><spanclass="rvts25">port1</span><spanclass="rvts21"> are required</span></li>
<liclass="rvps10"><spanclass="rvts25">port0</span><spanclass="rvts21">– the type of input device attached to the port 0. Supported values are:</span></li>
<liclass="rvps10"><spanclass="rvts25">port1</span><spanclass="rvts21">– the type of input device attached to the port 1. Supported values are:</span></li>
<liclass="rvps10"><spanclass="rvts25">port2</span><spanclass="rvts21"> (required) – the type of the FCExp port device which was attached. Supported values are:</span></li>
<liclass="rvps10"><spanclass="rvts25">binary</span><spanclass="rvts21"> (</span><spanclass="rvts70">bool</span><spanclass="rvts21">) (optional) –</span><spanclass="rvts70">true </span><spanclass="rvts21">if Input Log is stored in binary format. FM2 files usually contain Input in text format, for easy editing and splicing. FM3 files usually contain Input in binary format, to save disk space</span></li>
<liclass="rvps10"><spanclass="rvts25">length</span><spanclass="rvts21"> (required in FM3) – 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 (because it's Taseditor data). The Header of FM3s always has this keyword, the Header of FM2s doesn't have it.</span></li>
<pclass="rvps10"><spanclass="rvts25">romFilename</span><spanclass="rvts21"> (required) – the name of the file used to record the movie</span></p>
<pclass="rvps10"><spanclass="rvts25">romChecksum</span><spanclass="rvts21"> (required) – the base64 of the hexified MD5 hash of the ROM which was used to record the movie</span></p>
<pclass="rvps10"><spanclass="rvts25">comment</span><spanclass="rvts21"> (optional) – simply a memo. By convention, the author of the movie should be stored in a comment with the subject "author". Example: "comment author AnS"</span></p>
<pclass="rvps10"><spanclass="rvts25">subtitle</span><spanclass="rvts21"> (optional) – a message that will be displayed on screen when movie is played back (unless Subtitles are turned off). Right after the word "subtitle" and following space separator there must be an integer value indicating the frame that the subtitle will be displayed. Any remaining text after the integer and following space separator is considered to be the string displayed. Example: "subtitle 100 Level Two" – at frame 100 the words "Level Two" will be displayed on the screen</span></p>
<pclass="rvps10"><spanclass="rvts25">guid</span><spanclass="rvts21"> (required) – a unique identifier for a movie, generated when the movie is created. Meaningless in FM3, because all there's no external savestates associated with the project file.</span></p>
<pclass="rvps10"><spanclass="rvts21">The Input Log section consists of movie records either in the form of text lines or in the form of binary data.</span></p>
<pclass="rvps10"><spanclass="rvts21">Field </span><spanclass="rvts25">commands</span><spanclass="rvts21"> 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:</span></p>
<pclass="rvps10"><spanclass="rvts21">The format of </span><spanclass="rvts25">port0</span><spanclass="rvts21">, </span><spanclass="rvts25">port1</span><spanclass="rvts21">, </span><spanclass="rvts25">port2</span><spanclass="rvts21"> depends on which types of devices were attached.</span></p>
<liclass="rvps10"><spanclass="rvts21">SI_NONE: the field must be empty</span></li>
<liclass="rvps10"><spanclass="rvts21">SI_GAMEPAD: the field consists of eight characters which constitute a bit field. Any character other than ' ' (spacebar) or '.' (dot) means that the button was pressed. By convention, the following mnemonics are used in a column to remind us of which button corresponds to which column: RLDUTSBA (</span><spanclass="rvts29">Right</span><spanclass="rvts21">, </span><spanclass="rvts29">Left</span><spanclass="rvts21">, </span><spanclass="rvts29">Down</span><spanclass="rvts21">, </span><spanclass="rvts29">Up</span><spanclass="rvts21">, </span><spanclass="rvts29">Start</span><spanclass="rvts21">, </span><spanclass="rvts29">Select</span><spanclass="rvts21">, </span><spanclass="rvts29">B</span><spanclass="rvts21">, </span><spanclass="rvts29">A</span><spanclass="rvts21">)</span></li>
<liclass="rvps10"><spanclass="rvts21">SI_ZAPPER: the field consists of several characters in the following pattern </span><spanclass="rvts25">XXX YYY B Q Z</span></li>
<liclass="rvps10"style="text-indent: 60px"><spanclass="rvts25">XXX</span><spanclass="rvts21">: %03d – the X position of the mouse</span></li>
<liclass="rvps10"style="text-indent: 60px"><spanclass="rvts25">YYY</span><spanclass="rvts21">: %03d – the Y position of the mouse</span></li>
<liclass="rvps10"style="text-indent: 60px"><spanclass="rvts25">B</span><spanclass="rvts21">: %01d – 1 if the mouse button is pressed; 0 if not</span></li>
<liclass="rvps10"style="text-indent: 60px"><spanclass="rvts25">Q</span><spanclass="rvts21">: %01d – an internal value used by the emulator's zapper code</span></li>
<liclass="rvps10"style="text-indent: 60px"><spanclass="rvts25">Z</span><spanclass="rvts21">: %d – a variable-length decimal integer; an internal value used by the emulator's zapper code </span></li>
<pclass="rvps10"><spanclass="rvts21">If 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:</span></p>
<pclass="rvps10"><spanclass="rvts21">Input Log section starts with a | (pipe).</span></p>
<pclass="rvps10"><spanclass="rvts21">Every frame of the movie is represented by a record of a fixed length. The length can be determined by the devices on </span><spanclass="rvts25">port0</span><spanclass="rvts21"> and </span><spanclass="rvts25">port1</span><spanclass="rvts21">.</span></p>
<pclass="rvps10"><spanclass="rvts21">If fourscore is not used, the remaining bytes in the record depend on which types of devices are attached to </span><spanclass="rvts25">port0</span><spanclass="rvts21"> and </span><spanclass="rvts25">port1</span><spanclass="rvts21">:</span></p>
<liclass="rvps10"><spanclass="rvts21">SI_NONE: 0 bytes added to the size of record</span></li>
<liclass="rvps10"><spanclass="rvts21">SI_GAMEPAD: 1 byte added to the size of record. Bits of the byte represent the state of buttons (bit0 = </span><spanclass="rvts29">A</span><spanclass="rvts21">, bit1 = </span><spanclass="rvts29">B</span><spanclass="rvts21">, bit2 = </span><spanclass="rvts29">Select</span><spanclass="rvts21">, bit3 = S</span><spanclass="rvts29">Start</span><spanclass="rvts21">, bit4 = </span><spanclass="rvts29">Up</span><spanclass="rvts21">, bit5 = </span><spanclass="rvts29">Down</span><spanclass="rvts21">, bit6 = </span><spanclass="rvts29">Left</span><spanclass="rvts21">, bit7 = </span><spanclass="rvts29">Right</span><spanclass="rvts21">). If the bit is set, respective button is considered to be pressed, if the bit is clear, the button is not pressed</span></li>
<liclass="rvps10"><spanclass="rvts21">SI_ZAPPER: 12 bytes added to the size of record:</span></li>
<liclass="rvps10"style="text-indent: 60px"><spanclass="rvts21">1st byte – the X position of the mouse</span></li>
<liclass="rvps10"style="text-indent: 60px"><spanclass="rvts21">2nd byte – the Y position of the mouse</span></li>
<liclass="rvps10"style="text-indent: 60px"><spanclass="rvts21">3rd byte – 1 if the mouse button is pressed; 0 if not</span></li>
<liclass="rvps10"style="text-indent: 60px"><spanclass="rvts21">4th byte – an internal value used by the emulator's zapper code</span></li>
<liclass="rvps10"style="text-indent: 60px"><spanclass="rvts21">bytes 5-12 (</span><spanclass="rvts70">uint64</span><spanclass="rvts21">) – an internal value used by the emulator's zapper code</span></li>
<pclass="rvps10"><spanclass="rvts21">If fourscore is used, then </span><spanclass="rvts25">port0</span><spanclass="rvts21"> and </span><spanclass="rvts25">port1</span><spanclass="rvts21"> 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 = </span><spanclass="rvts29">A</span><spanclass="rvts21">, bit1 = </span><spanclass="rvts29">B</span><spanclass="rvts21">, bit2 = </span><spanclass="rvts29">Select</span><spanclass="rvts21">, bit3 = </span><spanclass="rvts29">Start</span><spanclass="rvts21">, bit4 = </span><spanclass="rvts29">Up</span><spanclass="rvts21">, bit5 = </span><spanclass="rvts29">Down</span><spanclass="rvts21">, bit6 = </span><spanclass="rvts29">Left</span><spanclass="rvts21">, bit7 = </span><spanclass="rvts29">Right</span><spanclass="rvts21">); bits of the 2nd byte represent the state of buttons of the 2nd joypad, and so on.</span></p>
<pclass="rvps10"><spanclass="rvts21">The data starts right after the last record of the Input Log. If there's EOF after the last record, TAS Editor will interpret the file as an FM2 file.</span></p>
<pclass="rvps10"><spanclass="rvts21">First 4 bytes of Taseditor Data contain the version of the project file format. The first release version of TAS Editor 1.0 saves projects with version = 3.</span></p>
<pclass="rvps10"><spanclass="rvts21">Next 4 bytes contain bit field that can be used for determining which modules of Taseditor were saved to the FM3 file:</span></p>
<pclass="rvps10"><spanclass="rvts21">Next 4 bytes contain the total number of modules, in the version 3 this number must be 6.</span></p>
<pclass="rvps10"><spanclass="rvts21">Then there are six offsets (4 bytes each) pointing at the data of each module. The offsets are counted from the beginning of the file.</span></p>
<pclass="rvps10"><spanclass="rvts21">When Taseditor saves the project, it calls all 6 modules that need saving. Each of them saves current writing offset and then serializes its own data into the file stream and moves current write position forward. The order of calling modules is always the same (Markers, Bookmarks, Greenzone, History, Piano Roll, Selection). When loading a project Taseditor calls those modules in the same order and they seek to the given offset and load / deserialize the data from the file.</span></p>
<pclass="rvps10"><spanclass="rvts21">To check the integrity of the data loaded, every module writes its own ID (string) into the file stream before writing the data. When loading the data it expects the ID to match, if it doesn't match then the module refuses to load following data, creates default state and reports "loading error" to Taseditor.</span></p>
<pclass="rvps10"><spanclass="rvts21">When using Save Compact settings, modules either save all their data as usual or write dummy ID which indicates that this module didn't save its data into the file. When loading the file a module that detects dummy ID refuses to load following data, creates default state but then reports "loading success" to Taseditor.</span></p>
<pclass="rvps8"><spanclass="rvts17">Created with the Personal Edition of HelpNDoc: </span><aclass="rvts18"href="http://www.helpndoc.com/help-authoring-tool">Single source CHM, PDF, DOC and HTML Help creation</a></p>