Title Database: Difference between revisions

Wwylele (talk | contribs)
Redirect extdata to DIFF format; Remove dead link
Ihaveamac (talk | contribs)
Title Info Entry: tickets may be larger than 0x350
 
(3 intermediate revisions by 2 users not shown)
Line 129: Line 129:
== BDRI ==
== BDRI ==


Information stored about titles in these Title Database files are stored in two parts in a BDRI partition. Firstly in a Title Entry Table, and secondly in a Title Info Table.
This is a variant of [[Inner FAT|FAT filesystem]]. It consists one "root" directory and multiple "files". Each "file" is one title info entry described below.


{| class="wikitable"
== Title Info Entry ==
|-
! Start
! Length
! Description
|-
| 0x0
| 4
| Database Magic ("BDRI")
|-
| 0x4
| 4
| File Format Version (0x30000)
|-
| 0x8
| 8
| Unknown
|-
| 0x10
| 8
| File Size (including pre header), in blocks (see next field)
|-
| 0x18
| 4
| Block Size (Usually 0x80; 0x200 for ticket.db)
|-
| 0x1C
| 4
| Reserved
|-
| 0x20
| 0x20
| Unknown/Constant
|-
| 0x40
| 0x18
| Unknown
|-
| 0x58
| 8
| Relative Title Entry Table Offset
|-
| 0x60
| 0x20
| Unknown
|}
 
== Title Entry Table ==
 
This contains 'Entries' for all the titles stored in the database. However this just appears to be an indexing table, the majority of title information is kept in a Title Info Table, which these index entries point to. Title Entries start immediately after the Title Entry Table Header. And there is no padding between entries.


=== Header ===
An entry contains information taken from both the application NCCH file(s) and TMD.
 
{| class="wikitable"
|-
! Start
! Length
! Description
|-
| 0x0
| 4
| Unknown/Magic? (usually = 0x2)
|-
| 0x4
| 4
| Unknown/Magic? (usually = 0x3)
|-
| 0x8
| 0x24
| Reserved
|-
| 0x2C
| 4
| Number of used Title Entries
|-
| 0x30
| X - 0x30
| Alignment padding for X = BDRI Block Size
|-
| X
| 4
| MAX Number of Title Entries
|-
| X + 0x04
| 4
| Unknown
|-
| X + 0x08
| 0x20
| Reserved
|}
 
=== Title Entry Format ===
 
The entries are 0x2C bytes long.
 
{| class="wikitable"
|-
! Start
! Length
! Description
! ticket.db only
|-
| 0x0
| 4
| Unknown
| Unknown (0)
|-
| 0x4
| 4
| Active Flag. If this isn't = 0x1, then this entry slot is unused
| same
|-
| 0x8
| 0x8
| Title ID
| same
|-
| 0x10
| 4
| Title Entry Index
| same
|-
| 0x14
| 4
| Relative Title Info Offset, in blocks (see next field)
| Unknown
|-
| 0x18
| 0x4
| Block Size (Usually 0x80; 0x200 for ticket.db)
| Relative Title Info Offset, in BDRI blocks
|-
| 0x1c
| 4
| Reserved
| Title Info size, in bytes
|-
| 0x20
| 4
| Unknown, occasionally this value is the title's "Title ID lower"
| Unknown (0)
|-
| 0x24
| 0x4
| Unknown
| same
|-
| 0x28
| 0x4
| Unknown
| same
|}
 
* The actual Title Info offset is calculated by the following: Offset of BDRI Header + Relative Offset of Title Entry Table + Relative Title Info Offset
 
== Title Info Table ==
 
These consist of 0x80 byte long entries, pointed to by the title index entries. They contain information taken from both the application NCCH file(s) and TMD.


{| class="wikitable"
{| class="wikitable"
Line 354: Line 198:
|}
|}


For ticket.db title info contains a small header and actual ticket data:
For ticket.db title info, there is a header indicates ticket count (as a Title ID can have more than one ticket installed). Then each entry contains the size, followed by the actual ticket data.
{| class="wikitable"
{| class="wikitable"
|+ Header
|-
|-
! Start
! Start
Line 363: Line 208:
| 0x0
| 0x0
| 4
| 4
| Unknown (always 0x00000001?)
| Amount of tickets X
|-
|-
| 0x4
| 0x4
| X * (size of tickets + 4)
| Ticket entries
|}
{| class="wikitable"
|+ Ticket entry
|-
! Start
! Length
! Description
|-
| 0x0
| 4
| 4
| Ticket data size X (=0x530)
| Ticket data size X (often 0x350 but some DLC tickets may be larger)
|-
|-
| 0x8
| 0x4
| X
| X
| [[Ticket|Ticket]] data
| [[Ticket|Ticket]] data