Difference between revisions of "DTB"

From Milo Modding Wiki
Jump to navigation Jump to search
(Created page with "DTB (DaTa Binary?) is the binary serialised counterpart to the plaintext DTA file format. It is capable of storing all DataNodes that the DTA counterpart can store, the only feature lacking from DTB being comments. It is found in .dtb (Guitar Hero 1 through Rock Band 4) and .*_dta_* (Rock Band 4 and Rock Band VR) file extensions. ==Structure== There are several variations on the DTB file format, and this dictates the...")
 
m (Document structure of DataNodes within the file)
Line 1: Line 1:
DTB (DaTa Binary?) is the binary serialised counterpart to the plaintext [[DTA]] file format. It is capable of storing all [[DataNode|DataNodes]] that the DTA counterpart can store, the only feature lacking from DTB being comments.
DTB (DaTa Binary?) is the binary serialised counterpart to the plaintext [[DTA]] file format. It is capable of storing all [[DataNode|DataNodes]] that the DTA counterpart can store, with the exception of comments.


It is found in .dtb ([[Guitar Hero (game)|Guitar Hero 1]] through [[Rock Band 4]]) and .*_dta_* ([[Rock Band 4]] and [[Rock Band VR]]) file extensions.
It is typically stored with .dtb ([[Guitar Hero (game)|Guitar Hero 1]] through [[Rock Band 4]]) and .*_dta_* ([[Rock Band 4]] and [[Rock Band VR]]) file extensions.


==Structure==
==Structure==
Line 11: Line 11:
===Header===
===Header===


The header is at the start of the file. (TODO: are these correct?)
The header is at the start of the file, and serves as information for the DataArray that the file is representing. (TODO: are these correct?)


====.dtb====
====.dtb====
Line 64: Line 64:
|2 bytes
|2 bytes
|???
|???
|}
===Body===
The body consists of a DataArray representation, of a count of the root DataNodes specified in the header.
{| class="wikitable"
!Name
!Type
!Size
!Function
|-
|Type
|Integer (LE)
|4 bytes
|The type of the DataNode
|-
|Value
|Varies
|Varies
|The value of the DataNode
|}
====Supported DataNode Types====
All values are little endian unless specified otherwise. For more information on what these do, see [[DataNode]].
TODO: complete missing values
{| class="wikitable"
!ID
!Name
!Size
!Value
|-
|0x00
|Integer
|4 bytes
|A 32-bit signed integer.
|-
|0x01
|Float
|4 bytes
|A 32-bit single-precision floating point.
|-
|0x02
|Variable
|4 bytes + string length
|A 32-bit signed integer followed by a UTF8 string.
|-
|0x03
|Symbol
|4 bytes + string length
|A 32-bit signed integer followed by a UTF8 string.
|-
|0x06
|Empty
|4 bytes
|Four null bytes.
|-
|0x07
|IfDef
|4 bytes + string length
|A 32-bit signed integer followed by a UTF8 string.
|-
|0x08
|Else
|4 bytes
|Four null bytes.
|-
|0x09
|EndIf
|4 bytes
|Four null bytes.
|-
|0x10
|DataArray
|Varies
|See [[#Nested DataArrays]]
|-
|0x11
|Command
|Varies
|TODO
|-
|0x12
|String
|4 bytes + string length
|A 32-bit signed integer followed by a UTF8 string.
|-
|0x13
|Macro
|Varies
|TODO
|-
|0x20
|Define
|4 bytes + string length
|A 32-bit signed integer followed by a UTF8 string.
|-
|0x21
|Include
|4 bytes + string length
|A 32-bit signed integer followed by a UTF8 string.
|-
|0x22
|Include
|4 bytes + string length
|A 32-bit signed integer followed by a UTF8 string.
|-
|0x23
|IfNDef
|4 bytes + string length
|A 32-bit signed integer followed by a UTF8 string.
|-
|0x24
|Autorun
|4 bytes + string length
|A 32-bit signed integer followed by a UTF8 string.
|-
|0x25
|Undef
|4 bytes + string length
|A 32-bit signed integer followed by a UTF8 string.
|}
====Nested DataArrays====
DataArrays in DTB files are prefixed with a header, followed by the regular DTB representation of all values in the nested array.
=====.dtb=====
{| class="wikitable"
!Name
!Type
!Size
!Function
|-
|Child Nodes
|Short (LE)
|2 bytes
|The number of DataNodes within this DataArray.
|-
|Unknown
|Integer (LE)
|4 bytes
|Some kind of ID?
|}
=====.*_dta_*=====
{| class="wikitable"
!Name
!Type
!Size
!Function
|-
|Unknown
|Integer (LE)
|4 bytes
|????
|-
|Child Nodes
|Short (LE)
|2 bytes
|The number of DataNodes within this DataArray.
|-
|Unknown
|Short (LE)
|2 bytes
|????
|}
|}


Line 70: Line 241:
DTA files are encrypted when included on-disc. The encryption format was changed in [[Guitar Hero 2]]'s Xbox 360 release and has been the same since.
DTA files are encrypted when included on-disc. The encryption format was changed in [[Guitar Hero 2]]'s Xbox 360 release and has been the same since.


Encrypted files begin with a 4-byte little endian integer which acts as a key for the encryption, followed by an encrypted form of a regular DTB file.
Encrypted files begin with a 4-byte little endian integer which acts as a key for the encryption cipher, followed by an encrypted form of a regular DTB file.


TODO: document the encryption cipher
TODO: document the encryption cipher. In the meantime, refer to [https://github.com/InvoxiPlayGames/DtxCS/blob/master/Library/CryptStream.cs CryptStream.cs from DtxCS].


==Implementations==
==Implementations==

Revision as of 04:09, 6 June 2022

DTB (DaTa Binary?) is the binary serialised counterpart to the plaintext DTA file format. It is capable of storing all DataNodes that the DTA counterpart can store, with the exception of comments.

It is typically stored with .dtb (Guitar Hero 1 through Rock Band 4) and .*_dta_* (Rock Band 4 and Rock Band VR) file extensions.

Structure

There are several variations on the DTB file format, and this dictates the structure of DataArrays in the file (and possibly more), as well as the header.

TODO: further document the actual structure. For now, read the reference implementations for more information

Header

The header is at the start of the file, and serves as information for the DataArray that the file is representing. (TODO: are these correct?)

.dtb

Name Type Size Function
Identifier Byte 1 byte Always 0x01.
Root Nodes Short (LE) 2 bytes The number of root nodes.
Unknown Integer (LE) 4 bytes ???

.*_dta_*

Name Type Size Function
Identifier Byte 1 byte Always 0x01.
Unknown Integer (LE) 4 bytes ???
Root Nodes Short (LE) 2 bytes The number of root nodes.
Unknown Short (LE) 2 bytes ???

Body

The body consists of a DataArray representation, of a count of the root DataNodes specified in the header.

Name Type Size Function
Type Integer (LE) 4 bytes The type of the DataNode
Value Varies Varies The value of the DataNode

Supported DataNode Types

All values are little endian unless specified otherwise. For more information on what these do, see DataNode.

TODO: complete missing values

ID Name Size Value
0x00 Integer 4 bytes A 32-bit signed integer.
0x01 Float 4 bytes A 32-bit single-precision floating point.
0x02 Variable 4 bytes + string length A 32-bit signed integer followed by a UTF8 string.
0x03 Symbol 4 bytes + string length A 32-bit signed integer followed by a UTF8 string.
0x06 Empty 4 bytes Four null bytes.
0x07 IfDef 4 bytes + string length A 32-bit signed integer followed by a UTF8 string.
0x08 Else 4 bytes Four null bytes.
0x09 EndIf 4 bytes Four null bytes.
0x10 DataArray Varies See #Nested DataArrays
0x11 Command Varies TODO
0x12 String 4 bytes + string length A 32-bit signed integer followed by a UTF8 string.
0x13 Macro Varies TODO
0x20 Define 4 bytes + string length A 32-bit signed integer followed by a UTF8 string.
0x21 Include 4 bytes + string length A 32-bit signed integer followed by a UTF8 string.
0x22 Include 4 bytes + string length A 32-bit signed integer followed by a UTF8 string.
0x23 IfNDef 4 bytes + string length A 32-bit signed integer followed by a UTF8 string.
0x24 Autorun 4 bytes + string length A 32-bit signed integer followed by a UTF8 string.
0x25 Undef 4 bytes + string length A 32-bit signed integer followed by a UTF8 string.

Nested DataArrays

DataArrays in DTB files are prefixed with a header, followed by the regular DTB representation of all values in the nested array.

.dtb
Name Type Size Function
Child Nodes Short (LE) 2 bytes The number of DataNodes within this DataArray.
Unknown Integer (LE) 4 bytes Some kind of ID?
.*_dta_*
Name Type Size Function
Unknown Integer (LE) 4 bytes ????
Child Nodes Short (LE) 2 bytes The number of DataNodes within this DataArray.
Unknown Short (LE) 2 bytes ????

Encryption

DTA files are encrypted when included on-disc. The encryption format was changed in Guitar Hero 2's Xbox 360 release and has been the same since.

Encrypted files begin with a 4-byte little endian integer which acts as a key for the encryption cipher, followed by an encrypted form of a regular DTB file.

TODO: document the encryption cipher. In the meantime, refer to CryptStream.cs from DtxCS.

Implementations