Title Database

Title Database

These files contain data relating to install/usage/management of installed 3DS titles. The database files are located at:

  • nand/dbs
  • sdmc/Nintendo 3DS///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 by the general SD filesystem encryption rule. These files are DIFF containers. These DIFF files do not use external IVFC level 4, so all database data is duplicated in the container. In this page only the inner content of the container is described.

These files are only created on SD (via AM) if they don’t exist when the eShop application is starting up, during network init etc (prior to showing the “system update required” dialog).

These files are stored under this directory:

Stored on SD cardStored in CTR-NANDFilenameCTR-9DB0 IDDescription
NoYesticket.db0x0This contains the installed tickets (NAND and SD).
NoYescerts.db0x1This contains the certificate chain used to verify TMDs and other certificates.
YesYestitle.db0x2Title database, this contains entries for all installed titles (TWL & CTR) on the 3DS (Each database is responsible for titles installed on its medium).
YesYesimport.db0x3This 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.)
NoYestmp_t.db0x4This is the temporary Title database containing one entry for the currently installed Download Play Child.
NoYestmp_i.db0x5Similar to import.db, except it’s used in conjunction with tmp_t.db, for installing Download Play Children.

The inner content of the container consists 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)

Pre Header #

StartLengthDescription
0x008Database Type “Magic” (see below)
0x080x78Reserved

For ticket.db different pre header is used:

StartLengthDescription
0x004Database Type “Magic” (see below)
0x040x04Unknown (always 0x00000001 ?)
0x080x04Unknown
0x0C0x04Unknown (0x30 smaller than previous one)

Database Magic #

Database TypeMagic
CTR-NAND ticket.dbTICK
CTR-NAND import.dbNANDIDB
CTR-NAND title.dbNANDTDB
CTR-NAND tmp_i.dbTEMPIDB
CTR-NAND tmp_t.dbTEMPIDB
SD Card import.dbTEMPTDB
SD Card title.dbTEMPTDB

BDRI #

This is a variant of FAT filesystem. It consists one “root” directory and multiple “files”. Each “file” is one title info entry described below.

Title Info Entry #

An entry contains information taken from both the application NCCH file(s) and TMD.

StartLengthDescription
0x08Title Size
0x84Title Type(usually 0x40)
0xC4Title Version
0x104Flags_0
0x144TMD Content ID
0x184CMD Content ID
0x1c4Flags_1
0x204ExtdataID low (zero if title doesn’t use Extdata)
0x244Reserved
0x288Flags_2
0x300x10Product Code
0x400x10Reserved
0x500x4Unknown
0x540x2cReserved

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.

StartLengthDescription
0x04Amount of tickets X
0x4X * (size of tickets + 4)Ticket entries

Header

StartLengthDescription
0x04Ticket data size X (often 0x350 but some DLC tickets may be larger)
0x4XTicket data

Ticket entry

Flags_0 #

IndexDescription
0Electronic Manual
1?
2?
3?

Flags_1 #

IndexDescription
0SD Save Data
1?
2?
3?

Flags_2 #

IndexDescription
0DSiWare Related (Visibility on Home Menu/Export Flag?)
1?
2?
3?
4Found with DSiWare Titles and titles with an ‘Application’ Title ID
5DSiWare Related (Visibility on Home Menu/Export Flag?)
6?
7?

NOTES:

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.

Removing ticket.db from a New-3DS with signature checks disabled will not result in an unbootable system, however all icons except Slot-1 will disappear from Home. Applets can however still be used. Recovery can be accomplished via hardmod or arm9loaderhax plus a known good backup of the file (or the whole partition or disk); Gamecard exploits were not tested, and Browserhax did not work.