<pclass="rvps7"><spanclass="rvts20">At first the TAS Editor was based on the codebase of experimental tool named TASEdit, using FCEUX 2.1.5 as a kick-start.</span></p>
<pclass="rvps7"><spanclass="rvts20">The premise of TASEdit was to build an input editor (like TAS Movie Editor) into emulator, so that the delay between editing and checking results would greatly shrink. Since there was no research done on typical behaviors in TASing process, the concept was vague and the code wasn't scalable. Thus, soon after formulating the new vision of the editing tool the code of TAS Editor was fully rewritten to make adding new features easier.</span></p>
<pclass="rvps7"><spanclass="rvts20">The premise of TAS Editor is to create a tool that is more handy than traditional rerecording tools, not just for Input editing/splicing, but also for Input creation and, most importantly, polishing (optimizing).</span></p>
<pclass="rvps7"><spanclass="rvts20">The following architecture of TAS Editor was designed according to author's notion of a methodical TASing and of features needed for such TASing.</span></p>
<liclass="rvps7"><spanclass="rvts20">the point of launching TAS Editor from emulator</span></li>
<liclass="rvps7"><spanclass="rvts20">the point of quitting from TAS Editor</span></li>
<liclass="rvps7"><spanclass="rvts20">regularly (at the end of every frame) updates all modules that need regular update</span></li>
<liclass="rvps7"><spanclass="rvts20">implements operations of the "File" menu: creating New project, opening a file, saving, compact saving, import, export</span></li>
<liclass="rvps7"><spanclass="rvts20">handles some FCEUX hotkeys</span></li>
<liclass="rvps7"><spanclass="rvts20">implements all operations with TAS Editor window: creating, redrawing, resizing, moving, tooltips, clicks</span></li>
<liclass="rvps7"><spanclass="rvts20">subclasses all buttons and checkboxes in TAS Editor window GUI in order to disable Spacebar key and process Middle clicks</span></li>
<liclass="rvps7"><spanclass="rvts20">processes OS messages and sends signals from user to TAS Editor modules (also implements some minor commands on-site, like Greenzone capacity dialog and such)</span></li>
<liclass="rvps7"><spanclass="rvts20">switches off/on emulator's keyboard input when the window loses/gains focus</span></li>
<liclass="rvps7"><spanclass="rvts20">on demand: updates the window caption; updates mouse cursor icon</span></li>
<liclass="rvps7"><spanclass="rvts20">updates all checkboxes and menu items when some settings change</span></li>
<liclass="rvps7"><spanclass="rvts20">stores info about 10 last projects (File->Recent) and updates it when saving/loading files</span></li>
<liclass="rvps7"><spanclass="rvts20">stores resources: window caption, help filename, size and other properties of all GUI items</span></li>
<liclass="rvps7"><spanclass="rvts20">implements all operations with Bookmarks: initialization, setting Bookmarks, jumping to Bookmarks, deploying Branches</span></li>
<liclass="rvps7"><spanclass="rvts20">saves and loads the data from a project file. On error: resets all Bookmarks and Branches</span></li>
<liclass="rvps7"><spanclass="rvts20">implements the working of Bookmarks List: creating, redrawing, mouseover, clicks</span></li>
<liclass="rvps7"><spanclass="rvts20">regularly updates flashings in Bookmarks List</span></li>
<liclass="rvps7"><spanclass="rvts20">on demand: updates colors of rows in Bookmarks List, reflecting conditions of respective Piano Roll rows</span></li>
<liclass="rvps7"><spanclass="rvts20">stores resources: save id, ids of commands, labels for panel, gradients for flashings, id of default slot</span></li>
<liclass="rvps7"><spanclass="rvts20">stores info about Branches (relations of Bookmarks) and the id of current Branch</span></li>
<liclass="rvps7"><spanclass="rvts20">also stores the time of the last modification (see fireball) and the time of project beginning (see cloudlet)</span></li>
<liclass="rvps7"><spanclass="rvts20">also caches data used in calculations (cached_first_difference, cached_timelines)</span></li>
<liclass="rvps7"><spanclass="rvts20">saves and loads the data from a project file. On error: sends warning to caller</span></li>
<liclass="rvps7"><spanclass="rvts20">implements the working of Branches Tree: creating, recalculating relations, animating, redrawing, mouseover, clicks</span></li>
<liclass="rvps7"><spanclass="rvts20">on demand: reacts on Bookmarks/current Movie changes and recalculates the Branches Tree</span></li>
<liclass="rvps7"><spanclass="rvts20">regularly updates animations in Branches Tree and calculates Playback cursor position on the Tree</span></li>
<liclass="rvps7"><spanclass="rvts20">stores resources: coordinates for building Branches Tree, animation timings</span></li>
<liclass="rvps7"><spanclass="rvts20">stores all info of one specific Bookmark: movie snapshot, a savestate of 1 frame, a screenshot of the frame, a state of flashing for this Bookmark's row</span></li>
<liclass="rvps7"><spanclass="rvts20">saves and loads the data from a project file. On error: sends warning to caller</span></li>
<liclass="rvps7"><spanclass="rvts20">implements procedure of "Bookmark set": creating movie snapshot, setting key frame on current Playback position, copying savestate from Greenzone, making and compressing screenshot, launching flashing animation</span></li>
<liclass="rvps7"><spanclass="rvts20">launches respective flashings for "Bookmark jump" and "Branch deploy"</span></li>
<liclass="rvps7"><spanclass="rvts20">stores the data of specific snapshot of the movie: InputLog, LagLog, Markers at the moment of creating the snapshot, keyframe, start and end frame of operation, type of operation and description of the snapshot (including the time of creation)</span></li>
<liclass="rvps7"><spanclass="rvts20">also stores info about sequential recording/drawing of input</span></li>
<liclass="rvps7"><spanclass="rvts20">streamlines snapshot creation: copying Input from movie data, copying LagLog from Greenzone, copying Markers from Markers Manager, setting time of creation</span></li>
<liclass="rvps7"><spanclass="rvts20">streamlines restoring Markers data from snapshot</span></li>
<liclass="rvps7"><spanclass="rvts20">saves and loads the data from a project file. On error: sends warning to caller</span></li>
<liclass="rvps7"><spanclass="rvts20">stores the data about Input state: size, type of Input, Input Log data (commands and joysticks)</span></li>
<liclass="rvps7"><spanclass="rvts20">optionally can store map of Hot Changes</span></li>
<liclass="rvps7"><spanclass="rvts20">implements InputLog creation: copying Input, copying Hot Changes</span></li>
<liclass="rvps7"><spanclass="rvts20">implements full/partial restoring of data from InputLog: Input, Hot Changes</span></li>
<liclass="rvps7"><spanclass="rvts20">implements compression and decompression of stored data</span></li>
<liclass="rvps7"><spanclass="rvts20">saves and loads the data from a project file. On error: sends warning to caller</span></li>
<liclass="rvps7"><spanclass="rvts20">implements searching of first mismatch comparing two InputLogs or comparing this InputLog to a movie</span></li>
<liclass="rvps7"><spanclass="rvts20">provides interface for reading specific data: reading Input of any given frame, reading value at any point of Hot Changes map</span></li>
<liclass="rvps7"><spanclass="rvts20">implements all operations with Hot Changes maps: copying (full/partial), updating/fading, setting new hot places by comparing two InputLogs</span></li>
<liclass="rvps7"><spanclass="rvts20">stores the data about Markers state: array of distributing Markers among movie frames, and array of Notes</span></li>
<liclass="rvps7"><spanclass="rvts20">implements compression and decompression of stored data</span></li>
<liclass="rvps7"><spanclass="rvts20">saves and loads the data from a project file. On error: sends warning to caller</span></li>
<liclass="rvps7"><spanclass="rvts20">stores resources: max length of a Note</span></li>
<liclass="rvps7"><spanclass="rvts20">implements all operations with popup windows: initialization, redrawing, centering, screenshot decompression and conversion</span></li>
<liclass="rvps7"><spanclass="rvts20">regularly inspects changes of Bookmarks Manager and shows/updates/hides popup windows</span></li>
<liclass="rvps7"><spanclass="rvts20">on demand: updates contents of popup windows</span></li>
<liclass="rvps7"><spanclass="rvts20">stores resources: coordinates and appearance of popup windows, timings of fade in/out</span></li>
<liclass="rvps7"><spanclass="rvts20">stores array of History items (snapshots, backup_bookmarks, backup_current_branch) and pointer to current snapshot</span></li>
<liclass="rvps7"><spanclass="rvts20">saves and loads the data from a project file. On error: clears the array and starts new history by making snapshot of current movie data</span></li>
<liclass="rvps7"><spanclass="rvts20">on demand: checks the difference between the last snapshot and current movie, and makes a decision to create new point of rollback. In special cases it can create a point of rollback without checking the difference, assuming that caller already checked it</span></li>
<liclass="rvps7"><spanclass="rvts20">implements all restoring operations: undo, redo, revert to any snapshot from the array</span></li>
<liclass="rvps7"><spanclass="rvts20">also stores the state of "undo pointer"</span></li>
<liclass="rvps7"><spanclass="rvts20">regularly updates the state of "undo pointer"</span></li>
<liclass="rvps7"><spanclass="rvts20">regularly (when emulator is paused) searches for uncompressed items in the History Log and compresses first found item</span></li>
<liclass="rvps7"><spanclass="rvts20">implements the working of History List: creating, redrawing, clicks, auto-scrolling</span></li>
<liclass="rvps7"><spanclass="rvts20">stores resources: save id, ids and names of all possible types of modification, timings of "undo pointer"</span></li>
<liclass="rvps7"><spanclass="rvts20">implements the working of Piano Roll List: creating, redrawing, scrolling, mouseover, clicks, drag</span></li>
<liclass="rvps7"><spanclass="rvts20">regularly updates the size of the List according to current movie input</span></li>
<liclass="rvps7"><spanclass="rvts20">on demand: scrolls visible area of the List to any given item: to Playback Cursor, to Selection Cursor, to "undo pointer", to a Marker</span></li>
<liclass="rvps7"><spanclass="rvts20">saves and loads current position of vertical scrolling from a project file. On error: scrolls the List to the beginning</span></li>
<liclass="rvps7"><spanclass="rvts20">implements the working of Piano Roll List Header: creating, redrawing, animating, mouseover, clicks</span></li>
<liclass="rvps7"><spanclass="rvts20">regularly updates lights in the Header according to button presses data from Recorder and Alt key state</span></li>
<liclass="rvps7"><spanclass="rvts20">on demand: launches flashes in the Header</span></li>
<liclass="rvps7"><spanclass="rvts20">implements the working of mouse wheel: List scrolling, Playback cursor movement, Selection cursor movement, scrolling across gaps</span></li>
<liclass="rvps7"><spanclass="rvts20">implements context menu on Right-click</span></li>
<liclass="rvps7"><spanclass="rvts20">stores resources: save id, ids of columns, widths of columns, tables of colors, gradient of Hot Changes, gradient of Header flashings, timings of flashes, all fonts used in TAS Editor, images</span></li>
<liclass="rvps7"><spanclass="rvts20">contains definition of the type "Set of selected frames"</span></li>
<liclass="rvps7"><spanclass="rvts20">stores array of Sets of selected frames (History of selections)</span></li>
<liclass="rvps7"><spanclass="rvts20">saves and loads the data from a project file. On error: clears the array and starts new history by making empty selection</span></li>
<liclass="rvps7"><spanclass="rvts20">constantly tracks changes in selected rows of Piano Roll List, and makes a decision to create new point of selection rollback</span></li>
<liclass="rvps7"><spanclass="rvts20">implements all selection restoring operations: undo, redo</span></li>
<liclass="rvps7"><spanclass="rvts20">on demand: changes current selection: remove selection, jump to a frame with Selection cursor, select region, select all, select between Markers, reselect clipboard</span></li>
<liclass="rvps7"><spanclass="rvts20">regularly ensures that selection doesn't go beyond curent Piano Roll limits, detects if selection moved to another Marker and updates Note in the lower text field</span></li>
<liclass="rvps7"><spanclass="rvts20">implements the working of lower buttons << and >> (jumping on Markers)</span></li>
<liclass="rvps7"><spanclass="rvts20">also here's the code of lower text field (for editing Marker Notes)</span></li>
<liclass="rvps7"><spanclass="rvts20">stores resource: save id, lower text field prefix</span></li>
<liclass="rvps7"><spanclass="rvts20">implements operations of changing Input: toggle input in region, set input by pattern, toggle selected region, apply pattern to input selection</span></li>
<liclass="rvps7"><spanclass="rvts20">implements operations of changing Markers: toggle Markers in selection, apply patern to Markers in selection, mark/unmark all selected frames</span></li>
<liclass="rvps7"><spanclass="rvts20">stores Autofire Patterns data and their loading/generating code</span></li>
<liclass="rvps7"><spanclass="rvts20">stores resources: patterns filename, id of buttonpresses in patterns</span></li>
<liclass="rvps7"><spanclass="rvts20">implements operations of mass-changing input: copy/paste, cloning, clearing region, insertion and deletion of frames, truncating</span></li>
<liclass="rvps7"><spanclass="rvts20">stores data about the selection used in last "Copy to Clipboard" operation</span></li>
<liclass="rvps7"><spanclass="rvts20">regularly checks the state of current selection and displays info on GUI, also displays info about input in Clipboard</span></li>
<liclass="rvps7"><spanclass="rvts20">when launching TAS Editor, it checks Clipboard contents</span></li>
<liclass="rvps7"><spanclass="rvts20">stores resources: mnemonics of buttons, texts for selection/clipboard info on GUI</span></li>
<liclass="rvps7"><spanclass="rvts20">stores current state of all TAS Editor settings</span></li>
<liclass="rvps7"><spanclass="rvts20">all TAS Editor modules can get or set any data within Config</span></li>
<liclass="rvps7"><spanclass="rvts20">when launching FCEUX, the emulator writes data from fceux.cfg file to the Config, when exiting it reads the data back to fceux.cfg</span></li>
<liclass="rvps7"><spanclass="rvts20">stores resources: default values of all settings, min/max values of settings</span></li>
<liclass="rvps7"><spanclass="rvts20">implements the working of movie player: show any frame (jump), run/cancel seekng. pause, rewinding</span></li>
<liclass="rvps7"><spanclass="rvts20">regularly tracks and controls emulation process, prompts redrawing of Piano Roll List rows, finishes seeking when reaching target frame, animates target frame, makes Piano Roll follow Playback cursor, detects if Playback cursor moved to another Marker and updates Note in the upper text field</span></li>
<liclass="rvps7"><spanclass="rvts20">implements the working of upper buttons << and >> (jumping on Markers)</span></li>
<liclass="rvps7"><spanclass="rvts20">implements the working of buttons < and > (frame-by-frame movement)</span></li>
<liclass="rvps7"><spanclass="rvts20">implements the working of button || (pause) and middle mouse button, also reacts on external changes of emulation pause</span></li>
<liclass="rvps7"><spanclass="rvts20">implements the working of progressbar: init, reset, set value, click (cancel seeking)</span></li>
<liclass="rvps7"><spanclass="rvts20">also here's the code of upper text field (for editing Marker Notes)</span></li>
<liclass="rvps7"><spanclass="rvts20">stores resources: upper text field prefix, timings of target frame animation, response times of GUI buttons, progressbar scale</span></li>
<liclass="rvps7"><spanclass="rvts20">stores array of savestates, used for faster movie navigation by Playback cursor</span></li>
<liclass="rvps7"><spanclass="rvts20">also stores LagLog of current movie Input</span></li>
<liclass="rvps7"><spanclass="rvts20">saves and loads the data from a project file. On error: truncates Greenzone to last successfully read savestate</span></li>
<liclass="rvps7"><spanclass="rvts20">regularly checks if there's a savestate of current emulation state, if there's no such savestate in array then creates one and updates lag info for previous frame</span></li>
<liclass="rvps7"><spanclass="rvts20">implements the working of "Auto-adjust Input according to lag" feature</span></li>
<liclass="rvps7"><spanclass="rvts20">regularly runs gradual cleaning of the savestates array (for memory saving), deleting oldest savestates</span></li>
<liclass="rvps7"><spanclass="rvts20">on demand: (when movie input was changed) truncates the size of Greenzone, deleting savestates that became irrelevant because of new input. After truncating it may also move Playback cursor (which must always reside within Greenzone) and may launch Playback seeking</span></li>
<liclass="rvps7"><spanclass="rvts20">stores resources: save id, properties of gradual cleaning, timing of cleaning</span></li>
<liclass="rvps7"><spanclass="rvts20">at the moment of recording movie input (at the very end of a frame) by emulator's call the Recorder intercepts input data and applies its filters (multitracking/etc), then reflects input changes into History and Greenzone</span></li>
<liclass="rvps7"><spanclass="rvts20">regularly tracks virtual joypad buttonpresses and provides data for Piano Roll List Header lights. Also reacts on external changes of Recording status, and updates GUI (Recorder panel and Bookmarks/Branches caption)</span></li>
<liclass="rvps7"><spanclass="rvts20">implements input editing in Read-only mode (ColumnSet by pressing buttons on virtual joypad)</span></li>
<liclass="rvps7"><spanclass="rvts20">stores resources: ids and names of multitracking modes, suffixes for TAS Editor window caption</span></li>
<liclass="rvps7"><spanclass="rvts20">stores one snapshot of Markers, representing current state of Markers in the project</span></li>
<liclass="rvps7"><spanclass="rvts20">saves and loads the data from a project file. On error: clears the data</span></li>
<liclass="rvps7"><spanclass="rvts20">regularly ensures that the size of current Markers array is not less than the number of frames in current input</span></li>
<liclass="rvps7"><spanclass="rvts20">implements all operations with Markers: setting Marker to a frame, removing Marker, inserting/deleting frames between Markers, truncating Markers array, changing Notes, finding frame for any given Marker, access to the data of Snapshot of Markers state</span></li>
<liclass="rvps7"><spanclass="rvts20">implements full/partial copying of data between two Snapshots of Markers state, and searching for first difference between two Snapshots of Markers state</span></li>
<liclass="rvps7"><spanclass="rvts20">also here's the code of searching for "similar" Notes</span></li>
<liclass="rvps7"><spanclass="rvts20">also here's the code of editing Marker Notes</span></li>
<liclass="rvps7"><spanclass="rvts20">also here's the code of Find Note dialog </span></li>
<liclass="rvps7"><spanclass="rvts20">stores resources: save id, properties of searching for similar Notes</span></li>
<liclass="rvps7"><spanclass="rvts20">stores resources: ids of joypads for input changes, max length of a name for </span><spanclass="rvts19">applychanges()</span><spanclass="rvts20">, default caption for the "</span><spanclass="rvts26">Run function</span><spanclass="rvts20">" button</span></li>
<liclass="rvps7"><spanclass="rvts20">call Taseditor's update() function after every emulated frame and when emulation is paused, no less than 20 times per second (necessary for smooth animations and controls in TAS Editor window)</span></li>
<liclass="rvps7"><spanclass="rvts20">dispatch OS messages to Taseditor window, including accelerator table commands</span></li>
<liclass="rvps7"><spanclass="rvts20">if emulator doesn't make use of mouse wheel, it should resend WM_MOUSEWHEEL to Taseditor, same with middle mouse clicks on emulator's own window</span></li>
<listyle="text-indent: 30px"class="rvps15"><spanclass="rvts20">on exit: emulator should ask Taseditor, so it can check unsaved changes in current project and allow user to save before quitting. If the </span><spanclass="rvts19">askSave()</span><spanclass="rvts20"> function returns </span><spanclass="rvts63">false</span><spanclass="rvts20">, the exit should be cancelled (means that user chose "Cancel")</span></li>
<liclass="rvps7"><spanclass="rvts20">there should be an interface for full control over the current movie data (creating/reading/writing/any modification). The movie should be the last layer between user's input and emulated game, which means that the game should not take input from virtual pads, only from movie data. An alternative (FCEUX example) would be to always sync changes into virtual pads every time the movie data changes. Either way, Taseditor interacts with the game by reading and modifying movie data and doesn't poll virtual pads. The Piano Roll displays current movie data and edits Input of current movie data only</span></li>
<liclass="rvps7"><spanclass="rvts20">in Recording mode: at the very beginning of a frame (right after the Input for the frame is written into current movie data) emulator should call Taseditor's Recorder function (and Recorder may change the movie data)</span></li>
<liclass="rvps7"><spanclass="rvts20">provide an interface for knowing which buttons are currently held (it's necessary for the Piano Roll Header)</span></li>
<liclass="rvps7"><spanclass="rvts20">hardware commands (Reset/Power/etc) should not be executed immediately after user invokes them, they should work as well as buttons input from virtual pads, meaning that when Taseditor is engaged it may either allow or prohibit the commands. In fact, when Taseditor is engaged and is not Recording, user should not be able to even invoke hardware commands</span></li>
<liclass="rvps7"><spanclass="rvts20">have public function for making a savestate in RAM and function for loading the state from RAM array</span></li>
<liclass="rvps7"><spanclass="rvts20">savestates must restore the game state precisely</span></li>
<liclass="rvps7"><spanclass="rvts20">saving and loading should not take too much time, because the Greenzone automatically creates a new savestate for every frame, which should be transparent for user</span></li>
<liclass="rvps7"><spanclass="rvts20">savestates should be stored in compressed form, so that they don't take too much space, because for a comfortable work in Taseditor the Greenzone should have at least 1000 savestates for nearby frames</span></li>
<liclass="rvps7"><spanclass="rvts20">Greenzone savestates should not store current movie data (that would be a waste of space)</span></li>
<liclass="rvps7"><spanclass="rvts20">on emulator start: emulator should load </span><spanclass="rvts63">taseditor_config</span><spanclass="rvts20"> data from the common settings file. If the file is not found, no changes should be made to </span><spanclass="rvts63">taseditor_config</span><spanclass="rvts20"> (it will have its default settings)</span></li>
<liclass="rvps7"><spanclass="rvts20">on emulator exit: save </span><spanclass="rvts63">taseditor_config</span><spanclass="rvts20"> data to the common settings file</span></li>
<liclass="rvps7"><spanclass="rvts20">add support for </span><spanclass="rvts19">taseditor</span><spanclass="rvts20"> library. The core of each function is implemented by Taseditor, but emulator should take parameters from Lua stack and send them to respective function of Taseditor's Lua gate, then receive returned data and push it into Lua stack</span></li>
<liclass="rvps7"><spanclass="rvts20">add support for </span><aclass="rvts24"href="LuaAPI.html#registermanual">Manual function</a><spanclass="rvts20"> and </span><aclass="rvts24"href="LuaAPI.html#registerauto">Auto function</a></li>
<liclass="rvps7"><spanclass="rvts20">notify Taseditor about changing the Manual function status (registered/re-registered/empty) so that it can change the appearance of the "</span><spanclass="rvts26">Run function</span><spanclass="rvts20">" button</span></li>
<liclass="rvps7"><spanclass="rvts20">emulator should be able to replay Taseditor project files as usual movie files, ignoring the additional data at the end of the file</span></li>
<liclass="rvps7"><spanclass="rvts20">since Taseditor project file can be huge, emulator shouldn't load it into memory when opening</span></li>
<liclass="rvps7"><spanclass="rvts20">emulator should be able to distinguish between a normal movie and a Taseditor project file. If it's a project file: when user tries to rerecord, emulator should refuse and suggest launching TAS Editor instead. If user agrees, emulator should send Taseditor the reference to the project file</span></li>
<liclass="rvps7"><spanclass="rvts20">emulator must be stable and deterministic. Desyncs will totally break Playback cursor navigation and make TASing unfeasible</span></li>
<liclass="rvps7"><spanclass="rvts20">it's recommended to implement all the points mentioned in </span><aclass="rvts24"href="MistakeProofing.html">Mistake-proofing</a><spanclass="rvts20"> that are related to emulator modification. In particular, Taseditor should be able to change certain settings, and user shouldn't be able to change them while Taseditor is engaged</span></li>
<liclass="rvps7"><spanclass="rvts20">good emulation speed is necessary for adequate </span><aclass="rvts24"href="NonlinearTASing.html#turbo-seeking">Turbo seeking</a><spanclass="rvts20"> feature. Also there should be an option to mute sound when turbo is on.</span></li>
<pclass="rvps6"style="clear: both;"><spanclass="rvts16">Created with the Personal Edition of HelpNDoc: </span><aclass="rvts17"href="https://www.helpndoc.com/create-epub-ebooks">Free EPub producer</a></p>