These files contain data relating to install/usage/management of installed 3DS titles. The database files are located at:
- sdmc/Nintendo 3DS/<ID0>/<ID1>/dbs
ID0 is the first 0x10-bytes from a SHA256 hash. The installation of SD Card titles was introduced in the 2.0.0-2 update and the SD dbs files are encrypted. These files are extdata images. The NAND extdata images are cleartext, however some of the images contain data encrypted with a console-unique keyslot.
These files are stored under this directory:
|Stored on SD card||Stored in CTR-NAND||Filename||CTR-9DB0 ID||Description|
|Yes||Yes||import.db||0x3||This is an Import Database, it contains entries for titles(or versions of titles) not yet installed, ready for transferring to the title.db. (Automatic Update uses this, so completing the update takes seconds)|
|Yes||Yes||title.db||0x2||Title database, this contains entries for all installed titles (TWL & CTR) on the 3DS(Each database is responsible for titles installed on it's medium).|
|No||Yes||tmp_t.db||?||This is the temporary Title database containing one entry for the currently installed Download Play Child.|
|No||Yes||tmp_i.db||?||Similar to import.db, except it's used in conjunction with tmp_t.db, for installing Download Play Children.|
|No||Yes||certs.db||?||This contains the certificate chain used to verify TMDs and other certificates.|
|No||Yes||ticket.db||?||This contains the installed tickets.|
The .db Extdata image embeds two almost identical copies(the latter is probably an older backup) of the title database. These database files consist of a pre-header with size of 0x80 identifying the Database Type, followed by a BDRI container. The offsets in the BDRI header are usually relative to the offset to the start of the BDRI header (0x80 in the file)
|0x00||8||Database Type "Magic" (see below)|
|SD Card import.db||?|
|SD Card title.db||TEMPTDB|
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.
|0x0||4||Database Magic ("BDRI")|
|0x4||4||Magic Number (0x30000)|
|0x10||8||File Size(including pre header), divided by the value at relative offset 0x18 (usually = 0x80)|
|0x58||8||Relative Title Entry Table Offset|
Title Entry Table
This contains 'Entries' for all the titles stored in the database. However this contains minimal information about a title, but contains the offset (relative to the actual offset of the Title Entry Table) to the title's extended info in the Title Info Table.
|0x80||4||MAX Number of Title Entries|
Title Entry Format
The entries are 0x2C bytes long.
|0x4||4||Entry Flag. If this isn't = 0x1, then this entry slot is unused|
|0x10||4||Title Entry Index|
|0x14||4||Relative Title Info Offset, divided by the value at offset 0x18 in this Title Entry (usually 0x80)|
|0x20||4||When value at relative offset 0x24 = 0x1, then this value is the title's "Title ID lower"|
- 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 Format
These are 0x80 bytes long.
|0x8||0x4||Title Type(usually 0x40)|
|0x14||4||TMD Content ID|
|0x18||0x4||CMD Content ID|
|0x20||4||ExtdataID low (zero if title doesn't use Extdata)|
|0||SD Save Data|
|0||DSiWare Related (Visibility on Home Menu/Export Flag?)|
|4||Related to Titles with an 'Application' Title ID|
|5||DSiWare Related (Visibility on Home Menu/Export Flag?)|
It is important to note the database doesn't contain a hash of the .cmd. So if a user has more than one valid set of application data for a given .cmd Content ID they can be manually interchanged without issue. Though renaming a .cmd file to match the Content ID which the title.db is expecting will result in an error, as the CTR for the per-console encryption layer changes depending on the file path, and the MAC of the .cmd is probably generated with the .cmd Content ID in mind.
These NAND/SD /dbs images seem to be loaded by the ARM9 while NATIVE_FIRM is booting.
extdata_tool - parsing cleartext .db extdata images