<pclass="rvps7"><spanclass="rvts20">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="rvps7"><spanclass="rvts20">You can read full specifications of FM2 format in the FCEUX Help and on </span><aclass="rvts24"href="http://www.fceux.com/web/FM2.html"target="_blank">official site</a><spanclass="rvts20">.</span></p>
<pclass="rvps7"><spanclass="rvts20">The Header is always in ASCII plain text format.</span></p>
<pclass="rvps7"><spanclass="rvts20">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="rvps7"><spanclass="rvts20">Newlines may be </span><spanclass="rvts63">\r\n</span><spanclass="rvts20"> or </span><spanclass="rvts63">\n</span><spanclass="rvts20">.</span></p>
<pclass="rvps7"><spanclass="rvts20">If a line starts from "|" (pipe), it means the end of Header and the beginning of Input Log.</span></p>
<pclass="rvps7"><spanclass="rvts20">The key-value pairs may be in any order, except that the first key must be </span><spanclass="rvts22">version</span><spanclass="rvts20">.</span></p>
<pclass="rvps7"><spanclass="rvts20">Value text is always terminated by a newline, which the value text does not include.</span></p>
<pclass="rvps7"><spanclass="rvts20">The value text is parsed differently depending on the keyword, it can be either integer or string.</span></p>
<pclass="rvps7"><spanclass="rvts20">(also used for booleans, with a 1 for </span><spanclass="rvts63">true</span><spanclass="rvts20"> and 0 for </span><spanclass="rvts63">false</span><spanclass="rvts20">)</span></p>
<pclass="rvps7"><spanclass="rvts20">(the value can be stored as </span><spanclass="rvts63">int32</span><spanclass="rvts20">)</span></p>
<liclass="rvps7"><spanclass="rvts22">version</span><spanclass="rvts20"> (required) – the version of the movie file format; for now it is always </span><spanclass="rvts22">3</span></li>
<liclass="rvps7"><spanclass="rvts22">emuVersion</span><spanclass="rvts20"> (required) – the version of the emulator used to produce the file (e.g. </span><spanclass="rvts22">21060</span><spanclass="rvts20">)</span></li>
<liclass="rvps7"><spanclass="rvts22">rerecordCount</span><spanclass="rvts20"> (optional) – the rerecord count</span></li>
<liclass="rvps7"><spanclass="rvts22">palFlag</span><spanclass="rvts20"> (</span><spanclass="rvts63">bool</span><spanclass="rvts20">) (optional) –</span><spanclass="rvts63">true </span><spanclass="rvts20">if the movie uses PAL timing</span></li>
<liclass="rvps7"><spanclass="rvts22">NewPPU</span><spanclass="rvts20"> (</span><spanclass="rvts63">bool</span><spanclass="rvts20">) (optional) –</span><spanclass="rvts63">true </span><spanclass="rvts20">if the movie uses New PPU</span></li>
<liclass="rvps7"><spanclass="rvts22">FDS</span><spanclass="rvts20"> (</span><spanclass="rvts63">bool</span><spanclass="rvts20">) (optional) –</span><spanclass="rvts63">true </span><spanclass="rvts20">if the movie was recorded on a Famicom Disk System (FDS) game</span></li>
<liclass="rvps7"><spanclass="rvts22">fourscore</span><spanclass="rvts20"> (</span><spanclass="rvts63">bool</span><spanclass="rvts20">) –</span><spanclass="rvts63">true</span><spanclass="rvts20"> if a fourscore was used. If fourscore is not used, then </span><spanclass="rvts22">port0</span><spanclass="rvts20"> and </span><spanclass="rvts22">port1</span><spanclass="rvts20"> are required</span></li>
<liclass="rvps7"><spanclass="rvts22">port0</span><spanclass="rvts20">– the type of input device attached to the port 0. Supported values are:</span></li>
<liclass="rvps7"><spanclass="rvts22">port1</span><spanclass="rvts20">– the type of input device attached to the port 1. Supported values are:</span></li>
<liclass="rvps7"><spanclass="rvts22">port2</span><spanclass="rvts20"> (required) – the type of the FCExp port device which was attached. Supported values are:</span></li>
<liclass="rvps7"><spanclass="rvts22">binary</span><spanclass="rvts20"> (</span><spanclass="rvts63">bool</span><spanclass="rvts20">) (optional) –</span><spanclass="rvts63">true </span><spanclass="rvts20">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="rvps7"><spanclass="rvts22">length</span><spanclass="rvts20"> (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="rvps7"><spanclass="rvts22">romFilename</span><spanclass="rvts20"> (required) – the name of the file used to record the movie</span></p>
<pclass="rvps7"><spanclass="rvts22">romChecksum</span><spanclass="rvts20"> (required) – the base64 of the hexified MD5 hash of the ROM which was used to record the movie</span></p>
<pclass="rvps7"><spanclass="rvts22">comment</span><spanclass="rvts20"> (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="rvps7"><spanclass="rvts22">subtitle</span><spanclass="rvts20"> (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="rvps7"><spanclass="rvts22">guid</span><spanclass="rvts20"> (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="rvps7"><spanclass="rvts20">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="rvps7"><spanclass="rvts20">Field </span><spanclass="rvts22">commands</span><spanclass="rvts20"> 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="rvps7"><spanclass="rvts20">The format of </span><spanclass="rvts22">port0</span><spanclass="rvts20">, </span><spanclass="rvts22">port1</span><spanclass="rvts20">, </span><spanclass="rvts22">port2</span><spanclass="rvts20"> depends on which types of devices were attached.</span></p>
<liclass="rvps7"><spanclass="rvts20">SI_NONE: the field must be empty</span></li>
<liclass="rvps7"><spanclass="rvts20">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="rvts26">Right</span><spanclass="rvts20">, </span><spanclass="rvts26">Left</span><spanclass="rvts20">, </span><spanclass="rvts26">Down</span><spanclass="rvts20">, </span><spanclass="rvts26">Up</span><spanclass="rvts20">, </span><spanclass="rvts26">Start</span><spanclass="rvts20">, </span><spanclass="rvts26">Select</span><spanclass="rvts20">, </span><spanclass="rvts26">B</span><spanclass="rvts20">, </span><spanclass="rvts26">A</span><spanclass="rvts20">)</span></li>
<liclass="rvps7"><spanclass="rvts20">SI_ZAPPER: the field consists of several characters in the following pattern </span><spanclass="rvts22">XXX YYY B Q Z</span></li>
<listyle="text-indent: 60px"class="rvps7"><spanclass="rvts22">XXX</span><spanclass="rvts20">: %03d – the X position of the mouse</span></li>
<listyle="text-indent: 60px"class="rvps7"><spanclass="rvts22">YYY</span><spanclass="rvts20">: %03d – the Y position of the mouse</span></li>
<listyle="text-indent: 60px"class="rvps7"><spanclass="rvts22">B</span><spanclass="rvts20">: %01d – 1 if the mouse button is pressed; 0 if not</span></li>
<listyle="text-indent: 60px"class="rvps7"><spanclass="rvts22">Q</span><spanclass="rvts20">: %01d – an internal value used by the emulator's zapper code</span></li>
<listyle="text-indent: 60px"class="rvps7"><spanclass="rvts22">Z</span><spanclass="rvts20">: %d – a variable-length decimal integer; an internal value used by the emulator's zapper code </span></li>
<pclass="rvps7"><spanclass="rvts20">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="rvps7"><spanclass="rvts20">Input Log section starts with a | (pipe).</span></p>
<pclass="rvps7"><spanclass="rvts20">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="rvts22">port0</span><spanclass="rvts20"> and </span><spanclass="rvts22">port1</span><spanclass="rvts20">.</span></p>
<pclass="rvps7"><spanclass="rvts20">If fourscore is not used, the remaining bytes in the record depend on which types of devices are attached to </span><spanclass="rvts22">port0</span><spanclass="rvts20"> and </span><spanclass="rvts22">port1</span><spanclass="rvts20">:</span></p>
<liclass="rvps7"><spanclass="rvts20">SI_NONE: 0 bytes added to the size of record</span></li>
<liclass="rvps7"><spanclass="rvts20">SI_GAMEPAD: 1 byte added to the size of record. Bits of the byte represent the state of buttons (bit0 = </span><spanclass="rvts26">A</span><spanclass="rvts20">, bit1 = </span><spanclass="rvts26">B</span><spanclass="rvts20">, bit2 = </span><spanclass="rvts26">Select</span><spanclass="rvts20">, bit3 = S</span><spanclass="rvts26">Start</span><spanclass="rvts20">, bit4 = </span><spanclass="rvts26">Up</span><spanclass="rvts20">, bit5 = </span><spanclass="rvts26">Down</span><spanclass="rvts20">, bit6 = </span><spanclass="rvts26">Left</span><spanclass="rvts20">, bit7 = </span><spanclass="rvts26">Right</span><spanclass="rvts20">). 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="rvps7"><spanclass="rvts20">SI_ZAPPER: 12 bytes added to the size of record:</span></li>
<listyle="text-indent: 60px"class="rvps7"><spanclass="rvts20">1st byte – the X position of the mouse</span></li>
<listyle="text-indent: 60px"class="rvps7"><spanclass="rvts20">2nd byte – the Y position of the mouse</span></li>
<listyle="text-indent: 60px"class="rvps7"><spanclass="rvts20">3rd byte – 1 if the mouse button is pressed; 0 if not</span></li>
<listyle="text-indent: 60px"class="rvps7"><spanclass="rvts20">4th byte – an internal value used by the emulator's zapper code</span></li>
<listyle="text-indent: 60px"class="rvps7"><spanclass="rvts20">bytes 5-12 (</span><spanclass="rvts63">uint64</span><spanclass="rvts20">) – an internal value used by the emulator's zapper code</span></li>
<pclass="rvps7"><spanclass="rvts20">If fourscore is used, then </span><spanclass="rvts22">port0</span><spanclass="rvts20"> and </span><spanclass="rvts22">port1</span><spanclass="rvts20"> 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="rvts26">A</span><spanclass="rvts20">, bit1 = </span><spanclass="rvts26">B</span><spanclass="rvts20">, bit2 = </span><spanclass="rvts26">Select</span><spanclass="rvts20">, bit3 = </span><spanclass="rvts26">Start</span><spanclass="rvts20">, bit4 = </span><spanclass="rvts26">Up</span><spanclass="rvts20">, bit5 = </span><spanclass="rvts26">Down</span><spanclass="rvts20">, bit6 = </span><spanclass="rvts26">Left</span><spanclass="rvts20">, bit7 = </span><spanclass="rvts26">Right</span><spanclass="rvts20">); bits of the 2nd byte represent the state of buttons of the 2nd joypad, and so on.</span></p>
<pclass="rvps7"><spanclass="rvts20">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="rvps7"><spanclass="rvts20">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="rvps7"><spanclass="rvts20">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="rvps7"><spanclass="rvts20">Next 4 bytes contain the total number of modules, in the version 3 this number must be 6.</span></p>
<pclass="rvps7"><spanclass="rvts20">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="rvps7"><spanclass="rvts20">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="rvps7"><spanclass="rvts20">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="rvps7"><spanclass="rvts20">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="rvps6"style="clear: both;"><spanclass="rvts16">Created with the Personal Edition of HelpNDoc: </span><aclass="rvts17"href="https://www.helpndoc.com">Free PDF documentation generator</a></p>