Difference between revisions of "Title Database"

From 3dbrew
Jump to navigation Jump to search
(Finally some clarification)
Line 10: Line 10:
 
  /title.db
 
  /title.db
  
"'''title.db'''" - This file (among other things perhaps), archives data about titles installed on the 3DS which includes their [[Serials#Product Code|Product Code]], whether the title uses an [[NCCH#CFA|electronic manual]], Title ID, Title size and Title Version(the title version determines the name of the [[Title Data Structure|.cmd]] file which contains data from the title TMD used for anti-tampering purposes).  
+
"'''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 [[NCCH#CXI|CXI]]/[[TMD]]
 +
* Product Code - Taken from the main [[NCCH#CXI|CXI]]
 +
* [[TMD|Title Size]] - This is generally larger than the total size of the Content.
 +
* [[TMD|Title Type]]
 +
* [[TMD|Title Version]]
 +
* [[Title Data Structure|.tmd]] Content ID
 +
* [[Title Data Structure|.cmd]] Content ID
 +
* [[Extdata#SD Extdata|ExtdataID low]] (if the title uses ExtData)
 +
* Whether or not a [[NCCH#CFA|Electronic Manual]] is used
 +
 
 +
It is important to note the database doesn't contain a hash of the [[Title Data Structure|.cmd]]. So if a user has more than one valid set of [[Title Data Structure|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.
  
*This data is taken from the title's [[Title Data Structure|TMD]] and [[NCCH#CXI|executable NCCH]] during install, this is also partly why the encrypted TMD found in each title directory is redundant, as the important information is moved to the ".db" and ".cmd" files during title installation.
 
*This file '''does not''' store a hash of the [[Title Data Structure|.cmd]] file for each given title, but the title.db expects to find a [[Title Data Structure|.cmd]] with a name specific to the title version, and the nature of the [[Title Data Structure|.cmd]] file makes re-naming/editing or using under a different title ID(by the end user) detectable (users of retail consoles are not going to have more than one .cmd file for a given titleID/title version).
 
*Since this file controls what titles are accessible to the 3DS, it is possible to move between different versions of a title if you have the title.db and title data for each version of that specific title.
 
*This file isn't updated when downloading a title, until installation is complete. So if the download is un-expectedly interrupted/canceled this prevents title rights from being written to the title.db. If the title rights are erroneously written, the [[Application Manager Services PXI|AM]] would mistake the title for being installed, and not allow the title to be re-downloaded(of course erroneous title rights can be deleted from system settings, however this is only possible with titles installed to the SD Card). Also in the case of title updates, this has the added benefit of allowing the user to revert to the version of the title before the update, if the download of the update is canceled before completion.
 
* IMPORTANT - turning off power while the title.db is edited(the final stage of installing titles), will most likely corrupt your 3DS' title.db. Which will make installed titles inaccessible. While this creates no permanent damage for SD Card titles and can be easily fixed using a backup title.db, or just re-downloading titles from the [[eShop]]. Corrupting the NAND title.db, will most likely result in a brick.
 
  
 
"'''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.  
 
"'''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.  

Revision as of 09:03, 31 March 2013

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.

There are only two files in this directory, for SD card:

/import.db
/title.db

"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:

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 AM 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.


Note: It is quite unlikely that the either the import.db or title.db contain the cached icon and names of installed titles. The amount of data which changes in those two file when a title installed/deleted is not sufficient to contain the size of data required for the icons and names of the application, they are most likely cached in the NAND.