Difference between revisions of "SD Filesystem"

From 3dbrew
Jump to navigation Jump to search
m (→‎Private: spell missing why didn't anyone find this?)
(A bit of info about the private folder on the root of the SD card, it needs more research though...)
(44 intermediate revisions by 4 users not shown)
Line 1: Line 1:
The 3DS uses an SD Card for general storage of additional game data, music and photos taken with the 3DS.
+
== Overview ==
 +
The 3DS uses an SD Card for general storage of game data, music, photos and videos taken with the 3DS.
  
  /DCIM - Photos and images downloaded with the Internet Browser.
+
  sdmc
  /Music - Music Files
+
├── DCIM
  /Nintendo 3DS - Game Data
+
  ├── Nintendo 3DS
 +
│  ├── <ID0>
 +
│  │  └── <ID1>
 +
│  │      ├── [[SD Savedata Backups|backups]]
 +
│  │      ├── [[Title Database|dbs]]
 +
│  │      ├── [[extdata]]
 +
│  │      ├── [[Title Data Structure|title]]
 +
  │  │      └── [[DSiWare_Exports|Nintendo DSiWare]]
 +
│  └── [[SD Filesystem#Private|Private]]
 +
└── [[SD Filesystem#Other Private Data|private]]
 +
    └── Nintendo 3DS
 +
        └── app
  
/DCIM with [[3.0.0-5]] also stores .avi 3D videos from the camera title, video frames use MJPG.
 
  
== Extdata ==
+
* Everything stored under sdmc/Nintendo 3DS/<ID0>/<ID1> is encrypted with console-unique [[AES|keyslots]], files stored under [[Flash Filesystem|nand/data/<ID0>]] only use these keyslots for MACs. All CTR files under these directories use the keyslots initialized by [[nand/private/movable.sed]].
Additional game data is stored here:
+
* ID0 is the first 0x10-bytes from a SHA256 [[nand/private/movable.sed|hash]].
: /Nintendo 3DS/<SomeID>/<SomeID>/extdata/00000000
+
* ID1 is the scrambled SD card CID from the SD card which this directory was originally created on. To generate this directory name from the original CID, first the CID is rotated 8-bits to the left. Then, each u16 is moved as described in the below table:
  
0000008f - Some [[2.0.0-2]] data, unknown doesn't appear in extdata management.
+
{| class="wikitable" border="1"
  00000098 - eShop - EUR (Unconfirmed)
+
|-
  00000207 - Mii Maker - JPN
+
! Input rotated CID u16 index
  0000020d - Face Raiders - JPN
+
! Output CID u16 index
  00000210 - Some [[2.0.0-2]] data, unknown doesn't appear in extdata management.
+
|-
  00000217 - Mii Maker - USA
+
| 6
  00000219 - eShop USA
+
| 0
  0000021d - Face Raiders - USA
+
|-
  00000227 - Mii Maker - EUR
+
| 7
  0000022d - Face Raiders - EUR
+
| 1
  0000030c - Nintendogs + Cats - EUR
+
|-
  00000326 - Pokédex 3D - EUR
+
| 4
  0000032d - Super Street Fighter IV 3D - USA
+
| 2
  0000033b - Ridge Racer 3D - EUR
+
|-
  0000033c - Super Street Fighter IV 3D - EUR
+
| 5
  0000034d - Samurai Warriors Chronicles - USA
+
| 3
  00000358 - Ridge Racer 3D - USA
+
|-
  0000038a - Dead or Alive Dimensions - EUR
+
| 2
  000004aa - Nintendo Video - USA
+
| 4
000004ab - Nintendo Video - EUR
+
|-
 +
| 3
 +
| 5
 +
|-
 +
| 0
 +
| 6
 +
|-
 +
| 1
 +
| 7
 +
|}
  
All "extra data" under [[extdata]] is encrypted. Although these files use 0xFF blocks similar to FLASH [[Savegames|saves]], extdata can't be decrypted with the xorpad fail like FLASH saves. All "extra data" files can't be copied to other 3DS SD cards, they are locked to the console.
+
'''DCIM''' - Photos and Videos taken by the [[Nintendo 3DS Camera]] application are stored in this directory. Internet Browser image downloads are stored here too.  
  
== import.db and title.db ==
+
Note: Playing/Recording (3D) Videos was introduced with update [[3.0.0-5]]. The 3D videos are in .avi format and the video frames use MJPG.
With the introduction of the June update the folder structure changed slightly. You will now find "dbs" and "title" folders located in  /Nintendo 3DS/<SomeID>/<SomeID>/ along with the extdata folder. "dbs" contains two files, import.db and title.db - usage currently unknown. import.db seems to contain data from DSiWare SRLs.
 
  
The data at the beginning of the file is encrypted, but the rest is cleartext. This file is always 3.1MB, thus this doesn't contain the whole SRL for most DSiWare. The data stored here is not ordered the same way as the src SRL: ARM7 code, ARM9 code, and data are mixed together. The file can contain data from DSiWare that wasn't installed, only listed on the src DSi for DSiWare transfer. (This file is likely some temporary data storage used for DSiWare install etc).
+
'''backups''' - This directory contains SD Title Savedata backups. For more info, see [[SD Savedata Backups]].
  
title.db seems to be encrypted.
+
'''dbs''' - This contains database files relating to the titles installed on the SD Card. These files are encrypted. For more info, see [[Title Database]]
  
* [https://gist.github.com/1113cbe10f124e5a2c72 Old and new import.db and title.db xored, revealing some plaintext].
+
'''title''' - Title data for titles installed to the SD Card are found here. All data in this directory is encrypted with a console-unique [[AES|keyslot]]. For a list of SD Card titles see the [[Title list]]. For more info on the title data structure see [[Title Data Structure]].
  
== title ==
+
'''Nintendo DSiWare''' - DSiWare titles are [[DSiWare_Exports|exported]] here.
/title/00040000/ Contains eshop downloads (can someone verify these and add for different regions?):
 
00032600 - Pokedex 3D - EUR (verified)
 
00042a00 - Legend of Zelda - Link's Awakening - EUR
 
0004ab00 - Nintendo Video - EUR
 
00052000 - Let's Golf 3D - EUR
 
00054300 - 3D Classics Excitebike - USA
 
00054e00 - 3D Classics Excitebike - EUR (verified)
 
00054300 - 3D Classics Excitebike - USA
 
00045C00 - 3D Classics Excitebike - JPN
 
For more IDs, see the 00040000 titles on the [[Title_list]].
 
  
The above title directories contain two dirs: content and data. content contains 00000000.tmd, .app files, and some cmd dir containing 00000001.cmd, all of which are encrypted with a console-unique key. The data dir contains 00000001.sav, this is the title's encrypted savegame. Although these saves look similar to FLASH savegames, these savegames use proper unique CTR for each AES block in the file, and the CTR properly changes for each savegame write. Renaming these savegames causes home-menu to hang while launching titles, modifying saves throws the usual checksum/hash corruption like gamecard flash saves.
+
== Private ==
 +
"Private" data is stored here as cleartext:
  
When renaming ''any'' of these files/dir under content, the icon in home-menu is still displayed. Modifying any of these files has same result as renaming them. When renaming the cmd dir/cmd file, or 00000000.app, the 3D banner isn't displayed. When renaming the cmd dir or the file contained in that dir, home-menu will refuse to run the title, and the manual will not work.(will display the black screen saying sdcard isn't inserted) Manual won't load when 00000001.app is renamed, so that .app might be the manual? When the main 00000000.app binary is renamed, the title will not launch and in the manual placeholder text is used for the title name/icon. Home-menu doesn't care at all when tmd is renamed.
+
/Nintendo 3DS/Private/<Title ID Low>/
 +
 
 +
00020400 - Nintendo 3DS Camera
 +
00020500 - Nintendo 3DS Sound
 +
 
 +
Under the camera private dir is [[phtcache.bin]].
 +
When you want to install and see pictures with 3DS, rename to 8 numbers.mpo and save it on /DCIM.
 +
Under the sound private dir is: voice/XX/*.m4a. Where XX is 01-10, with sound saved as .m4a.
 +
 
 +
== Other Private Data ==
 +
 
 +
There is also a directory called "private" on the root of the SD card that contains data, in which would otherwise be completely different from what the Nintendo 3DS normally uses, but known to the application itself.
 +
 
 +
Some apps, such as Flipnote Studio 3D create a directory called "private" on the root of the SD Card, it contains a Nintendo 3DS directory inside it. Inside the app directory contains a directory with the game code of the application (eg. "JKZP" for Flipnote Studio 3D), then its corresponding data, as shown here:
 +
 
 +
/private/Nintendo 3DS/app/<Game Code>/
 +
 
 +
In this case of Flipnote Studio 3D, there are multiple files with an ID, then ending with the .kwz extension. There is also a !!.lst file as well.

Revision as of 23:56, 11 August 2017

Overview

The 3DS uses an SD Card for general storage of game data, music, photos and videos taken with the 3DS.

sdmc
├── DCIM
├── Nintendo 3DS
│   ├── <ID0>
│   │   └── <ID1>
│   │       ├── backups
│   │       ├── dbs
│   │       ├── extdata
│   │       ├── title
│   │       └── Nintendo DSiWare
│   └── Private
└── private
    └── Nintendo 3DS
        └── app


  • Everything stored under sdmc/Nintendo 3DS/<ID0>/<ID1> is encrypted with console-unique keyslots, files stored under nand/data/<ID0> only use these keyslots for MACs. All CTR files under these directories use the keyslots initialized by nand/private/movable.sed.
  • ID0 is the first 0x10-bytes from a SHA256 hash.
  • ID1 is the scrambled SD card CID from the SD card which this directory was originally created on. To generate this directory name from the original CID, first the CID is rotated 8-bits to the left. Then, each u16 is moved as described in the below table:
Input rotated CID u16 index Output CID u16 index
6 0
7 1
4 2
5 3
2 4
3 5
0 6
1 7

DCIM - Photos and Videos taken by the Nintendo 3DS Camera application are stored in this directory. Internet Browser image downloads are stored here too.

Note: Playing/Recording (3D) Videos was introduced with update 3.0.0-5. The 3D videos are in .avi format and the video frames use MJPG.

backups - This directory contains SD Title Savedata backups. For more info, see SD Savedata Backups.

dbs - This contains database files relating to the titles installed on the SD Card. These files are encrypted. For more info, see Title Database

title - Title data for titles installed to the SD Card are found here. All data in this directory is encrypted with a console-unique keyslot. For a list of SD Card titles see the Title list. For more info on the title data structure see Title Data Structure.

Nintendo DSiWare - DSiWare titles are exported here.

Private

"Private" data is stored here as cleartext:

/Nintendo 3DS/Private/<Title ID Low>/
00020400 - Nintendo 3DS Camera 
00020500 - Nintendo 3DS Sound

Under the camera private dir is phtcache.bin. When you want to install and see pictures with 3DS, rename to 8 numbers.mpo and save it on /DCIM. Under the sound private dir is: voice/XX/*.m4a. Where XX is 01-10, with sound saved as .m4a.

Other Private Data

There is also a directory called "private" on the root of the SD card that contains data, in which would otherwise be completely different from what the Nintendo 3DS normally uses, but known to the application itself.

Some apps, such as Flipnote Studio 3D create a directory called "private" on the root of the SD Card, it contains a Nintendo 3DS directory inside it. Inside the app directory contains a directory with the game code of the application (eg. "JKZP" for Flipnote Studio 3D), then its corresponding data, as shown here:

/private/Nintendo 3DS/app/<Game Code>/

In this case of Flipnote Studio 3D, there are multiple files with an ID, then ending with the .kwz extension. There is also a !!.lst file as well.