These files contain data relating to install/usage/management of installed 3DS titles. The database files are located at:
- nand/dbs
- 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. |
Embedded Database Format
Header
Start | Length | Description |
---|---|---|
0x00 | 8 | Database Type "Magic" (see below) |
0x08 | 0x78 | Reserved |
0x80 | 4 | Database Magic ("BDRI") |
0x84 | 4 | Magic Number (0x30000) |
0x88 | 8 | Unknown |
0x90 | 8 | File Size, divided by the value at 0x98 (usually = 0x80) |
0x98 | 4 | Usually 0x80 |
0x9C | 4 | Reserved |
0xA0 | 0x20 | Unknown/Constant |
0xC0 | 0x18 | Unknown |
0xD8 | 8 | Title Entry Table Offset |
0xE0 | 0x20 | Unknown |
Database Magic
Database Type | Magic |
---|---|
CTR-NAND import.db | NANDIDB |
CTR-NAND title.db | NANDTDB |
CTR-NAND tmp_i.db | TEMPIDB |
CTR-NAND tmp_t.db | TEMPIDB |
SD Card import.db | ? |
SD Card title.db | TEMPTDB |
"title.db" - With a fixed size of 0x31E400 bytes, this Extdata image embeds two almost identical copies(the latter is probably an older backup) of the Title Database. For each installed title, the following information is known to be stored:
- Title ID - Taken from the main CXI/TMD
- Product Code - Taken from the main CXI
- Title Size - This is generally larger than the total size of the Content.
- Title Type
- Title Version
- .tmd Content ID
- .cmd Content ID
- ExtdataID low (if the title uses ExtData)
- Whether or not a Electronic Manual is used
- Whether or not Savedata is used
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.
"import.db" - The function of the file is not well understood. It appears to be related to the download/install of titles, as in the progress of downloading titles this file will have changed but the title.db will not be modified until the title has been properly downloaded.
- This file doesn't contain any title specific data which the ARM9 has been noted to use in relation to installed titles, even though this file is modified when titles are installed/deleted. In fact, no matter what titles you install, if you use an old copy of the "import.db" with a recent copy of the "title.db", this creates no noticeable issues.
These NAND/SD /dbs images seem to be loaded by the ARM9 while NATIVE_FIRM is booting.