diff options
| author | bigbass1997 <bigbass1997.website@gmail.com> | 2025-04-16 15:48:50 -0500 |
|---|---|---|
| committer | bigbass1997 <bigbass1997.website@gmail.com> | 2025-04-16 15:48:50 -0500 |
| commit | c9539f1127e3fe50a07c87a9420df3bcc3380cea (patch) | |
| tree | eaf826b76aac1b6bbb04fd3b8eeab668b82597d9 /src/docs | |
| parent | ebdd77f6b9b3c14132833ef25410a5c7818fb5b6 (diff) | |
| download | tasd-c9539f1127e3fe50a07c87a9420df3bcc3380cea.tar.gz tasd-c9539f1127e3fe50a07c87a9420df3bcc3380cea.zip | |
Hopefully final specification changes before version 1 release.
Diffstat (limited to 'src/docs')
| -rw-r--r-- | src/docs/draft-tasd-spec-0001.xml | 57 |
1 files changed, 34 insertions, 23 deletions
diff --git a/src/docs/draft-tasd-spec-0001.xml b/src/docs/draft-tasd-spec-0001.xml index 5c8036e..5c184db 100644 --- a/src/docs/draft-tasd-spec-0001.xml +++ b/src/docs/draft-tasd-spec-0001.xml @@ -36,16 +36,16 @@ <area>General</area> <workgroup>Independent TAS Console Replay Research Group</workgroup> <abstract> - <t>The <strong>TASD</strong> file format is used for storing "Tool Assisted Speedrun" or "Tool Assisted Superplay" (TAS) data for TAS replay devices to replay on physical video game console hardware. The format is defined to be expandable for future needs. The format is also defined to be parsable by programs that do not understand portions of the format, whether that is due to incomplete support of the format specification or due to new features being added to later versions of the specification at a later date.</t> + <t>The <strong>TASD</strong> file format is used for storing "Tool Assisted Speedrun" or "Tool Assisted Superplay" (TAS) input and configuration data for use with devices (known as "TAS replay devices") that replay inputs on physical video game hardware. The format is defined to be expandable for future needs. The format is also defined to be parsable by programs that do not understand portions of the format, whether that is due to incomplete support of the format specification or due to new features being added to later versions of the specification.</t> <t>This document defines the file format specification for <strong>TASD</strong> files.</t> </abstract> </front> <middle> <section anchor="introduction" numbered="true" toc="default"> <name>Introduction</name> - <t>The Tool Assisted Speedrun Dump (<strong>TASD</strong>) interchange format is a file format for storing data to allow "Tool Assisted Speedruns" or "Tool Assisted Superplays" to be played on physical video game console hardware using TAS replay devices. Created to be hardware and software agnostic, the <strong>TASD</strong> interchange format uses a key-based, binary, packet format to break up pieces of information into easily-parsable and forward-compatible chunks. The format is extensible by simply defining additional keys or value types as necessary. When parsing the file, software can skip any packets whose key is unknown or unsupported.</t> + <t>The Tool Assisted Speedrun Dump (<strong>TASD</strong>) interchange format is a file format for storing data that enables "Tool Assisted Speedruns" or "Tool Assisted Superplays" to be played on physical video game hardware using TAS replay devices. Created to be hardware and software agnostic, the <strong>TASD</strong> interchange format uses a key-based, binary, packet format to break up pieces of information into easily-parsable and forward-compatible chunks. The format is extensible by simply defining additional keys or value types as necessary. When parsing the file, software can skip any packets whose key is unknown or unsupported.</t> <t>Packets of a given type can be used multiple times or completely omitted as needed. This reusability eliminates the need of a predefined delimiter to separate pieces of data.</t> - <t>While files generated by emulator dump scripts should provide as much information as possible, because packets are optional, the file can be expanded later with any additional data as desired. No intermediary file format is necessary.</t> + <t>While files generated by emulator dump scripts should provide as much information as possible, they may be unable to provide everything. Since packets are optional, the file can be expanded later with any additional data as desired. No intermediary file format is necessary.</t> <section numbered="true" toc="default"> <name>Overview and Preliminaries</name> <t>The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>", "<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document are to be interpreted as described in BCP 14 <xref target="RFC2119"/> <xref target="RFC8174"/> when, and only when, they appear in all capitals, as shown here.</t> @@ -60,12 +60,13 @@ <li>(B) = Boolean</li> <li>([]N) = List of Unsigned Integers</li> </ul> - <t>We use the terms <strong>byte</strong> and <strong>octet</strong> interchangeably in this document.</t> <t>Unless specified otherwise, all multi-octet integers are big-endian.</t> + <t>We use the terms <strong>byte</strong> and <strong>octet</strong> interchangeably in this document.</t> <t>We use the terms <strong>Tool Assisted Speedrun</strong>, <strong>Tool Assisted Superplay</strong> and <strong>TAS</strong> interchangeably in this document.</t> - <t>In subsections of (<xref target="descriptions" />), the term "in direct form" is used. That term is defined to mean a packet in a <strong>TASD</strong> file directly (first order packet) rather than a packet inside a TRANSITION or MOVIE_TRANSITION packet (second order packet).</t> - <t>String values <bcp14>MUST</bcp14> use UTF-8 encoding. As such, string values <bcp14>MAY</bcp14> contain any number of NUL characters and have no concept of "null termination". If an example of a string value is given, the example will be between quotation marks. The quotation marks are not included in the string. Not all content between quotations will be string value examples, so be aware of that when continuing through this document.</t> - <t>Unsigned and signed integers can have different bit widths. For instance, an 8-bit integer can be used in one part of the specification and a 64-bit integer can be used in another part of the specification.</t> + <t>In subsections of (<xref target="descriptions"/>), the term "in direct form" is used. That term is defined to mean a packet in a <strong>TASD</strong> file directly (first order packet) rather than a packet inside a TRANSITION or MOVIE_TRANSITION packet (second order packet).</t> + <t>String values <bcp14>MUST</bcp14> use UTF-8 encoding. As such, string values <bcp14>MAY</bcp14> contain any number of NUL characters and do not make use of "null termination". If an example of a string value is given, the example will be between quotation marks. The quotation marks are not included in the string. Not all content between quotations will be string value examples, so be aware of that when continuing through this document.</t> + <t>Both unsigned and signed integers can have different bit widths. For instance, an 8-bit integer can be used in one part of the specification and a 64-bit integer can be used in another part of the specification.</t> + <t>Variable-length integer encoding (also known as VarInt or VLQ) is not used in this format. Instead, arbitrarily sized integers, like those used in <xref target="packets"/>, are prefixed with a single octet that specifies the number of octets used to contain the integer value. In most cases, this is less space-efficient than VarInt encoding, but it is simpler to understand and to parse.</t> <t>Boolean values <bcp14>MUST</bcp14> be a single octet with the value of <tt>0</tt> for <strong>FALSE</strong> or <tt>1</tt> for <strong>TRUE</strong>.</t> <dl> <dt><tt>[N octets]</tt></dt> <dd>A sequence of octets with a length of N</dd> @@ -130,13 +131,13 @@ +-----------+===========+]]> </artwork> <ul spacing="compact" empty="true"> - <li>In this example, the packet diagram contains enough variable boxes to require being split into 2 sections, in order to maintain consistent horizontal spacing in this documentation. The packet diagram is separated by an ellipsis (<tt>...</tt>) on the same text row as the variable names to signify that the packet diagram is continuing.</li> + <li>In this example, the packet diagram contains enough variable boxes to require being split into 2 sections, in order to maintain consistent horizontal spacing in this document. The packet diagram is separated by an ellipsis (<tt>...</tt>) on the same text row as the variable names to signify that the packet diagram is continuing.</li> </ul> </section> </section> <section numbered="true" toc="default"> <name>Motivations</name> - <t>This file format's primary goal is to provide a comprehensive and replay device agnostic TAS movie controller input dump format that is usable for any console. Additional goals include:</t> + <t>This file format's primary goal is to provide a comprehensive and replay device agnostic TAS input dump format that is usable for any console. Additional goals include:</t> <ul> <li>No intermediary formats</li> <li>Forward compatibility</li> @@ -187,7 +188,7 @@ </artwork> <dl newline="true"> <dt><strong>Magic Number</strong></dt> - <dd>4 octet value that <bcp14>MUST</bcp14> be <tt>[54 41 53 44]</tt>(ASCII value <tt>TASD</tt>).</dd> + <dd>4 octet value that <bcp14>MUST</bcp14> be <tt>[54 41 53 44]</tt> (ASCII value <tt>TASD</tt>).</dd> <dt><strong>Version</strong></dt> <dd>Version of the <strong>TASD</strong> file format. Version currently <bcp14>MUST</bcp14> be a value of 1, but <bcp14>SHOULD</bcp14> be incremented in future versions.</dd> <dt><strong>G_KEYLEN</strong></dt> @@ -381,9 +382,9 @@ <name>Input Frame/Timing Key Descriptions</name> <dl newline="true"> <dt><tt>[FE 01]</tt> - INPUT_CHUNK</dt> - <dd>Specifies a chunk of input data for the TAS when played on hardware. All data from INPUT_CHUNK packets are concatenated together in order of appearance in the <strong>TASD</strong> file. If the INPUT_CHUNK packet type is used in a TASD file, the PORT_CONTROLLER packet type <bcp14>MUST</bcp14> also be used at least once. If the INPUT_CHUNK packet type is used, the INPUT_MOMENT packet type <bcp14>SHOULD NOT</bcp14> be used. This packet type is <bcp14>OPTIONAL</bcp14> and a <strong>TASD</strong> file <bcp14>MAY</bcp14> contain more than 1 of this packet type. Discussed in (<xref target="input_chunk"/>).</dd> + <dd>Specifies a chunk of input data for the TAS when played on hardware. All data from INPUT_CHUNK packets for each controller port are concatenated together in order of appearance in the <strong>TASD</strong> file. This packet type is <bcp14>OPTIONAL</bcp14> and a <strong>TASD</strong> file <bcp14>MAY</bcp14> contain more than 1 of this packet type. Discussed in (<xref target="input_chunk"/>).</dd> <dt><tt>[FE 02]</tt> - INPUT_MOMENT</dt> - <dd>Specifies a single instance of input data that is sent from the replay device to the console with specific timing. If the INPUT_MOMENT packet type is used in a TASD file, the PORT_CONTROLLER packet type <bcp14>MUST</bcp14> also be used at least once. If the INPUT_MOMENT packet type is used, the INPUT_CHUNK packet type <bcp14>SHOULD NOT</bcp14> be used. This packet type is <bcp14>OPTIONAL</bcp14> and a <strong>TASD</strong> file <bcp14>MAY</bcp14> contain more than 1 of this packet type. Discussed in (<xref target="input_moment"/>).</dd> + <dd>Specifies a single instance of input data that is sent from the replay device to the console with specific timing. This packet type is <bcp14>OPTIONAL</bcp14> and a <strong>TASD</strong> file <bcp14>MAY</bcp14> contain more than 1 of this packet type. Discussed in (<xref target="input_moment"/>).</dd> <dt><tt>[FE 03]</tt> - TRANSITION</dt> <dd>Specifies when a transition or change occurs during a TAS replay (example: console reset or changing of controller types). This packet type is <bcp14>OPTIONAL</bcp14> and a <strong>TASD</strong> file <bcp14>MAY</bcp14> contain more than 1 of this packet type. Discussed in (<xref target="transition"/>).</dd> <dt><tt>[FE 04]</tt> - LAG_FRAME_CHUNK</dt> @@ -455,7 +456,7 @@ </artwork> <dl newline="true"> <dt><strong>Video Signal</strong></dt> - <dd>Specifies the video signal of the game console being emulated while dumping the TAS movie controller inputs.</dd> + <dd>Specifies the video signal of the game console being emulated while dumping the TAS movie's controller inputs.</dd> </dl> </section> <section numbered="true" toc="default" anchor="game_title"> @@ -785,10 +786,14 @@ <name>GAME_IDENTIFIER Packet</name> <t>GAME_IDENTIFIER packets <bcp14>MUST</bcp14> be in the following format:</t> <artwork><![CDATA[ - 0 1 2 3... 3+NLEN... - +----------+--------------+----------+==========+================+ - | Type (A) | Encoding (A) | NLEN (N) | Name (S) | Identifier (A) | - +----------+--------------+----------+==========+================+ + 0 1 2 3... + +----------+--------------+----------+==========+ + | Type (A) | Encoding (A) | NLEN (N) | Name (S) | ... + +----------+--------------+----------+==========+ + 3+NLEN... + +================+ + | Identifier (A) | + +================+ Type (Binary Data): [1 octet] [01] - MD5 Hash @@ -813,7 +818,8 @@ [04] - Base 64 NLEN (Unsigned Integer) [1 octet] Name (String) [NLEN octets] - Identifier (Binary Data) [PLEN - 2 octets]]]> + Identifier (Binary Data) [PLEN - NLEN - + 3 octets]]]> </artwork> <dl newline="true"> <dt><strong>Type</strong></dt> @@ -1131,7 +1137,8 @@ [01] - Frame [02] - Cycle Count [03] - Milliseconds - [04] - Microseconds * 10 + [04] - Microseconds + [05] - Nanoseconds Index (Unsigned Integer) [8 octets] Inputs (Binary Data) [PLEN - 11 octets] ]]> @@ -1140,7 +1147,7 @@ <dt><strong>Port</strong></dt> <dd>Controller port number (<strong>Port</strong> number <bcp14>MUST</bcp14> be <strong>1-indexed</strong>).</dd> <dt><strong>Hold</strong></dt> - <dd>Determines whether the <strong>Input</strong> data <bcp14>MUST</bcp14> continue to be held after the controller state has been read.</dd> + <dd>If <strong>TRUE</strong>, the <strong>Input</strong> data <bcp14>MUST</bcp14> continue to be held after the controller state has been read. Otherwise if <strong>FALSE</strong>, the <strong>Input</strong> data is held only until the data has been used once.</dd> <dt><strong>Index Type</strong></dt> <dd>Specifies timing methodology of a specific moment when <strong>Input</strong> data <bcp14>MUST</bcp14> be applied.</dd> <dt><strong>Index</strong></dt> @@ -1152,6 +1159,7 @@ </dl> <t>Each INPUT_MOMENT packet contains a single instance of controller input data for a specific moment during a TAS replay. The input data's format depends on the PORT_CONTROLLER type corresponding to the <strong>Port</strong> number. Refer to <xref target="controller_inputs"/> for each available type. The PORT_CONTROLLER type <bcp14>MAY</bcp14> be changed using TRANSITION packets, which <bcp14>MAY</bcp14> change the interpretation of the input data.</t> <t>If <strong>Hold</strong> is <strong>TRUE</strong>, the controller <bcp14>MUST</bcp14> continually hold the input state until the next INPUT_MOMENT for the same <strong>Port</strong> number. If <strong>Hold</strong> is <strong>FALSE</strong>, the controller <bcp14>MUST</bcp14> hold only until the console reads the input state, or until the next INPUT_MOMENT for the same <strong>Port</strong> number.</t> + <t>If an INPUT_MOMENT overlaps with input data from one or more INPUT_CHUNKs, the INPUT_MOMENT's <strong>Input</strong> data <bcp14>MUST</bcp14> be used instead of the data contained in the INPUT_CHUNKs. INPUT_CHUNK data <bcp14>MUST</bcp14> still be incremented as it normally would. <strong>Hold</strong> <bcp14>MUST</bcp14> still behave as specified.</t> </section> <section numbered="true" toc="default" anchor="transition"> <name>TRANSITION Packet</name> @@ -1170,8 +1178,9 @@ [01] - Frame [02] - Cycle Count [03] - Milliseconds - [04] - Microseconds * 10 - [05] - INPUT_CHUNK Byte Index + [04] - Microseconds + [05] - Nanoseconds + [06] - INPUT_CHUNK Byte Index Port (Unsigned Integer) [1 octet] Index (Unsigned Integer) [8 octets] Type (Binary Data): [1 octet] @@ -1187,7 +1196,7 @@ <dt><strong>Port</strong></dt> <dd>Controller port number (<strong>Port</strong> number <bcp14>MUST</bcp14> be <strong>1-indexed</strong>).</dd> <dt><strong>Index</strong></dt> - <dd>Time or offset value to start transition. If <strong>Index Type</strong> is <tt>[05]</tt>, <strong>Index</strong> <bcp14>MUST</bcp14> be interpreted as the <strong>byte offset</strong> (<strong>0-indexed</strong>) into the concatenated input data from all <strong>INPUT_CHUNK</strong> packets for the controller port specified by <strong>Port</strong>. If <strong>Index Type</strong> is <tt>[05]</tt>, the byte offset <bcp14>MUST</bcp14> also point to the first byte of an instance of controller input data (according to the PORT_CONTROLLER format at that moment in the TAS replay.)</dd> + <dd>Time or offset value to start transition. If <strong>Index Type</strong> is <tt>[06]</tt>, <strong>Index</strong> <bcp14>MUST</bcp14> be interpreted as the <strong>byte offset</strong> (<strong>0-indexed</strong>) into the concatenated input data from all <strong>INPUT_CHUNK</strong> packets for the controller port specified by <strong>Port</strong>. If <strong>Index Type</strong> is <tt>[06]</tt>, the byte offset <bcp14>MUST</bcp14> also point to the first byte of an instance of controller input data (according to the PORT_CONTROLLER format at that moment in the TAS replay.)</dd> <dt><strong>Type</strong></dt> <dd>Type of transition. If <strong>Type</strong> is <tt>[FF]</tt>, the transition action will be interpreting a <strong>TASD</strong> packet.</dd> <dt><strong>Inner Packet</strong></dt> @@ -1928,6 +1937,8 @@ <t>THIS DOCUMENTATION IS PROVIDED BY THE AUTHOR(S) "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</t> </section> <!-- Change Log +draft 17 - 2025-04-16 Bigbass Improved the wording in the Abstract and Introduction paragraphs. Reordered and expanded on the overview/preliminaries section. Revised wording in a packet diagram example and the Motivations section. Miscellaneous formatting changes. Removed exclusion requirements between INPUT_CHUNK and INPUT_MOMENT packets, as they can be used together now. Clarified what must happen if an INPUT_MOMENT conflicts with INPUT_CHUNK inputs. For INPUT_MOMENT and TRANSITION packets, the Index Type "Microseconds * 10" has been changed to "Microseconds", and a new type "Nanoseconds" has been added. (2^64 nanoseconds is ~584.6 years) + draft 16 - 2025-02-01 Bigbass Revised "Introduction" paragraphs. Clarified NUL characters in strings. Clarified header version should increase in future versions. Clarified INPUT_MOMENT packets contain only a single instance of input data. Clarified how multiple INPUT_CHUNK packets must be interpreted. Clarified INPUT_CHUNK indexes in TRANSITION packets refer to an individual byte (changed index type name.) Added a "Hold" option to INPUT_MOMENT packets to clarify how long the INPUT_MOMENT should be active for (useful for GB/C/A replays which expect the value to be held until the input changes.) Changed Genesis controller input formats. draft 15 - 2023-10-15 Bigbass Reordered SNES controller types |
