Tutorial  Updated

Extract and Decrypt games, NAND backups, and SD contents with ninfs

This is a tutorial that shows you how to use ninfs (formerly fuse-3ds) to extract the contents of games, NAND backups, and SD card contents. This tutorial is a work in progress; please post a reply if something is confusing or needs a correction.

This supports Windows, macOS, and Linux. This tutorial mostly focuses on the GUI on Windows. For macOS/Linux steps plus CLI/installable-module usage, see the README and latest release at the repository.

What sets ninfs apart from others like ctrtool is that it doesn't need to decrypt separately first. Instead, files are decrypted as needed. For example, if you mount a CIA, you can see all of the files in it, and you only need to copy out what you need. This makes it much faster and more efficient, especially for larger games where it can take a while (and several gigabytes of space) to decrypt!

Want to see a video demonstration? Here is one with Pokémon Ultra Moon, using fuse-3ds v1.0.
In this short video, I show that the CIA is encrypted, then I use ninfs to mount it and browse its contents in Windows/File Explorer. I can also use the decrypted.cxi file to immediately start playing it in Citra.
(Note that slowness is due to the virtual machine, speed would be faster on a normal computer!)

Getting started

Windows users simply need two things:
  • Install the latest release of WinFsp
  • Download the latest release of ninfs at GitHub or the GBAtemp Download Center
    • You should download the win64 version if you're using 64-bit Windows.
Please see the latest release notes for macOS and Linux (+ alternative steps for Windows).

You also need the ARM9 bootROM. You can use boot9strap to dump it by holding START+SELECT+X at boot, and finding it at /boot9strap/boot9.bin on the SD card. You can find boot9strap setup at 3DS Hacks Guide.

For newer digital games (2015+), you also need a SeedDB. Check out the SeedDB list.

Setting up boot9/SeedDB

You will need boot9.bin or boot9_prot.bin, and seeddb.bin. This will be placed at %APPDATA%\3ds on Windows, and `~/.3ds` on macOS/Linux.

If one of the files could not be found, an error will be displayed.
mainwindow-err-win.png

Both boot9 and SeedDB use similar steps for setup. This part shows boot9 steps, but it is the same for SeedDB.

If you click "Fix boot9", you will see a dialog allowing you to choose the boot9 file, and the searched paths.
b9-missing-win.png

Click "Select boot9 to copy..." then find the boot9.bin or boot9_prot.bin file. If it is valid, it will be copied.
b9-copied-win.png

Using the GUI

Run ninfs (either the exe, or the module if you installed it). A console window will appear, then a GUI a few seconds later.
mainwindow-win.png

First, choose the type that you want at the top:
  • CTR Cart Image (".3ds", ".cci")
  • CDN contents (directory with "cetk", "tmd", and contents)
  • CTR Importable Archive (".cia")
  • Executable Filesystem (".exefs", "exefs.bin")
  • Nintendo 3DS NAND backup ("nand.bin")
    • Using a directory instead of drive letter is highly recommended for this!
    • You need the OTP for this if the NAND backup does not have essential.exefs embedded by GodMode9. If you have essential.exefs as a separate file, you can extract it from that. If the Counter can't be automatically generated, you also need the CID.
    • You can write to the NAND. In the GUI, you need to enable this option. Otherwise, the mount will be read-only.
  • NCCH (".cxi", ".cfa", ".ncch", ".app")
  • Read-only Filesystem (".romfs", "romfs.bin")
  • SD Card Contents ("Nintendo 3DS" from an SD card)
    • You need movable.sed from the system whose SD card contents you want to browse. You can get it from essential.exefs, or by copying it from CTRNAND -> private -> movable.sed.
    • You can write to the SD contents. In the GUI, you need to enable this option. Otherwise, the mount will be read-only.
  • 3DSX Homebrew (".3dsx")
  • Titles directory ("title" from NAND or SD)
    • To browse SD card titles, the contents must be decrypted first. You can use the SD Card Contents mount first to do that, then use this one.
  • Nintendo DSi NAND backup ("nand_dsi.bin")
  • Nintendo DS ROM image (".nds", ".srl")
  • Nintendo Switch NAND backup ("rawnand.bin")
Once you choose the type, you need to choose the file (or directory) that you want to mount. This would be the game, NAND, or "Nintendo 3DS" SD card folder that you want.

Finally, click "Mount". If there are no errors, Windows Explorer/File Explorer will automatically open at the mount. Some example contents are shown below.
ciamount-win.png
ncchmount-win.png
nandmount-win.png
Now you can copy out the files you want.
  • If you mounted CCI, CDN, CIA, NCCH, or Titledir, you can see "decrypted.cxi" (or "decrypted.cfa" for non-executable contents) which acts like a decrypted version of the game. You can use it in applications that require decrypted contents like Citra.
  • For NAND, you can use a tool like OSFMount to mount partitions like CTRNAND, TWLN, and TWLP. Make sure you used directory mount, not drive letter.
    If you enabled writing, you can also write back to the partitions. They will be re-encrypted as you write.
  • For SD, you can browse the decrypted contents, and use something like the titledir mount to browse the installed games. You can also write to it, and the files you write will be re-encrypted.
    You can extract game saves and extdata with a tool like 3ds-save-tool.
Once you are done, click "Unmount". The mount will be removed.

Add to context/right-click menu

You can add "Mount with ninfs" to the context menu when you right-click on files. It will try to automatically detect the file type and show it in the GUI, so you can just click Mount.

Open ninfs, click "Help & Extras", then click "Add to menu". Read the dialog, then click "Add entry" or "Remove entry" to add or remove the context menu entry.

If you move or rename the EXE, you will need to re-add it.

Troubleshooting

  • I am using Windows 7, 8, or 8.1 and am getting "The procedure entry point ucrtbase.terminate could not be located in the dynamic link library api-ms-win-crt-runtime-l1-1-0.dll.".
  • I am on Windows 7 and am getting an error saying the driver is not signed when trying to install WinFsp.
    I am on Windows 7 and am getting "Cannot create WinFsp-FUSE file system: unspecified error."
 
Last edited by ihaveahax,

Startropic1

Well-Known Member
Member
Joined
May 1, 2013
Messages
163
Trophies
0
Age
44
Location
C-Island
XP
491
Country
United States
Nice tutorial, but one critical thing is missing: How to put the files you edit BACK into the .CIA

I just had to edit a config.ini to fix resolution for an unofficial VC .CIA (ie. SeedDB is not applicable.) The mount appears to be read only, and deleting the file I'm going to replace appears to leave insufficient space in the mount to copy the edited file over. So how to I re-inject the edited config.ini ?
 
  • Like
Reactions: beats1234

ihaveahax

Well-Known Member
OP
Member
Joined
Apr 20, 2015
Messages
6,069
Trophies
2
XP
7,827
Country
United States
Nice tutorial, but one critical thing is missing: How to put the files you edit BACK into the .CIA

I just had to edit a config.ini to fix resolution for an unofficial VC .CIA (ie. SeedDB is not applicable.) The mount appears to be read only, and deleting the file I'm going to replace appears to leave insufficient space in the mount to copy the edited file over. So how to I re-inject the edited config.ini ?
You can't edit the contents of files except NAND and SD (which are designed to be written to). Formats like CIA, RomFS, etc. are read-only and not designed to be changed. Changes require rebuilding the file.
 

Startropic1

Well-Known Member
Member
Joined
May 1, 2013
Messages
163
Trophies
0
Age
44
Location
C-Island
XP
491
Country
United States
You can't edit the contents of files except NAND and SD (which are designed to be written to). Formats like CIA, RomFS, etc. are read-only and not designed to be changed. Changes require rebuilding the file.

Ok then, once I have everything extracted from the mount, how do I rebuild the .cia?
I tried the tutorial here: https://gbatemp.net/threads/tutorial-how-to-decrypt-extract-rebuild-3ds-cia-cxi-files.383055/
However, it was pretty useless. The tools in that tutorial don't do much. I either ended up with nothing or corrupted extractions. 3dsexplorer either crashes or reports that the files I extracted from those other tools are corrupted. Fuse-3DS finally granted me access to the config.ini I had to edit. Now I just need to rebuild the .CIA It's not a licensed 3DS .CIA so there are no keys or anything to worry about.
 

ihaveahax

Well-Known Member
OP
Member
Joined
Apr 20, 2015
Messages
6,069
Trophies
2
XP
7,827
Country
United States
Ok then, once I have everything extracted from the mount, how do I rebuild the .cia?
I tried the tutorial here: https://gbatemp.net/threads/tutorial-how-to-decrypt-extract-rebuild-3ds-cia-cxi-files.383055/
However, it was pretty useless. The tools in that tutorial don't do much. I either ended up with nothing or corrupted extractions. 3dsexplorer either crashes or reports that the files I extracted from those other tools are corrupted. Fuse-3DS finally granted me access to the config.ini I had to edit. Now I just need to rebuild the .CIA It's not a licensed 3DS .CIA so there are no keys or anything to worry about.
3dstool and makerom could probably help out with that. If you know how to use the command line/terminal, you can probably get this quickly. I've not used other rebuilders.

Quick example:
Code:
# copy all the RomFS contents out and put your changes in
# then rebuild it with 3dstool
3dstool -cvtf romfs romfs-custom.bin --romfs-dir romfs
# rebuild the CXI (if logo doesn't exist, ignore and don't add it)
3dstool -cvtf cxi custom.cxi --header ncch.bin --exh extheader.bin --logo logo.bin --plain plain.bin --exefs exefs.bin --romfs romfs-custom.bin
# build CIA with CXI
makerom -f cia -o custom.cia -content custom.cxi:0:0
3dstool can be obtained from: https://github.com/dnasdw/3dstool/releases
Latest makerom build is attached here (commit 046bb35, built with mingw-w64)
 

Attachments

  • makerom-046bb35.zip
    284.8 KB · Views: 175

Startropic1

Well-Known Member
Member
Joined
May 1, 2013
Messages
163
Trophies
0
Age
44
Location
C-Island
XP
491
Country
United States
3dstool and makerom could probably help out with that. If you know how to use the command line/terminal, you can probably get this quickly. I've not used other rebuilders.

I know how to do command line stuff. (I am a little bit of a programmer.) The one possible complication here is when I used Fuse-3DS, I got some .bins but not a romfs.bin for example. These got extracted as folders within a folder called 0000.00000000

Do I need extra command line options to handle this structure?
 

ihaveahax

Well-Known Member
OP
Member
Joined
Apr 20, 2015
Messages
6,069
Trophies
2
XP
7,827
Country
United States
I know how to do command line stuff. (I am a little bit of a programmer.) The one possible complication here is when I used Fuse-3DS, I got some .bins but not a romfs.bin for example. These got extracted as folders within a folder called 0000.00000000

Do I need extra command line options to handle this structure?
You would use the files in 0000.00000000, since it's the first content (0000) of the CIA. The root of the mount is about the CIA, the sub-folders are the individual contents.
 

Startropic1

Well-Known Member
Member
Joined
May 1, 2013
Messages
163
Trophies
0
Age
44
Location
C-Island
XP
491
Country
United States
You would use the files in 0000.00000000, since it's the first content (0000) of the CIA. The root of the mount is about the CIA, the sub-folders are the individual contents.

I'm getting an error:
Code:
I:\editing>makerom -f cia -o custom.cia -content custom.cxi:0:0
[NCCH ERROR] Failed to load ncch aes key
[CIA WARNING] CXI AES Key could not be loaded
      Meta Region, SaveDataSize, Remaster Version cannot be obtained

Since this is an unofficial/custom .cia I suppose aes key wouldn't exist, thus I can just ignore this error?
 

KaiH

New Member
Newbie
Joined
Aug 7, 2018
Messages
2
Trophies
0
Age
25
XP
46
Country
United States
Hey, I'm a total noob when it comes to this stuff so this might be a dumb problem but I can't seem to find movable.sed
 

SirNapkin1334

Renound Aritst
Member
Joined
Aug 20, 2017
Messages
1,665
Trophies
1
XP
975
Country
United States
You can also mount essential.exefs (which gm9 creates automatically) in fuse-3DS and extract movable.sed from there . (It might be called movable.bin.)
No, it’s called movable (with no extension), but yes, this works too.

--------------------- MERGED ---------------------------

It can also be mounted from inside GM9.
 

Ezegardiz

New Member
Newbie
Joined
Oct 20, 2018
Messages
3
Trophies
0
Age
19
XP
54
Country
Spain
Hi! I need help, because my head is going to explode in a few minutes.
I had mounted a cia as a new drive. Now, I want to replace 2 songs in .bcstm format, when I tried it for the first time, it gave me an error, saying that the drive hasn´t enough memory. I edited the song that will replace the game's one to have the same number of Kb, but, when I delete the cia's file, and add the new one, the memory error is there again. What should I do? Can I edit the RomFs with this program? because is the only one that worked
 

ZeroHunta

Well-Known Member
Newcomer
Joined
Oct 20, 2016
Messages
60
Trophies
0
Location
Planeptune
XP
536
Country
United States
Hi @ihaveamac.
It's possible to use this tool alongside Luma to extract and insert custom images in games?
I can mount the games as cias but when looking for the images using the Kukki editor I can't find any.
Idk if I am missing a step and the files are still encrypted because the game that I'm trying to edit (Etrian Odyssey) is supposed to be compatible with the Kukki editor. Can you help me? Thanks.

PS: I'm a newbie in this things so sorry if I say something that don't make sense :P
 

Kwyjor

Well-Known Member
Member
Joined
May 23, 2018
Messages
4,323
Trophies
1
XP
4,454
Country
Canada
  • Like
Reactions: ZeroHunta

richardZeldaModder

Well-Known Member
Newcomer
Joined
Sep 11, 2018
Messages
47
Trophies
0
Age
34
XP
237
Country
United States
I'm able to get this running, and tested mounting a nand backup.... But I'm confused. If I want to set up a 2nd 3DS/2DS to use the files from my broken 2DS (from the old SD card), where do I start? Is there a tutorial specifically for this?

I'm guessing, first I would need to set up all the custom firmware like I did on the 1st 2DS. And then what? :wacko:
 

Kwyjor

Well-Known Member
Member
Joined
May 23, 2018
Messages
4,323
Trophies
1
XP
4,454
Country
Canada
If I want to set up a 2nd 3DS/2DS to use the files from my broken 2DS (from the old SD card), where do I start?
That depends on exactly what you want to use. If you want to re-use save data, then after you decrypt the save data on the SD card, you will have to unpack it using 3ds-save-tool. That will give you files that you can then import on your second 3DS using JKSM or Checkpoint.

Alternatively, I think you can use ninfs to copy the decrypted save data to the appropriate folder on your new SD card (re-encrypting it in the process) and then use gm9 to fix the CMAC.
 
Last edited by Kwyjor,

richardZeldaModder

Well-Known Member
Newcomer
Joined
Sep 11, 2018
Messages
47
Trophies
0
Age
34
XP
237
Country
United States
That depends on exactly what you want to use. If you want to re-use save data, then after you decrypt the save data on the SD card, you will have to unpack it using 3ds-save-tool. That will give you files that you can then import on your second 3DS using JKSM or Checkpoint.

Alternatively, I think you can use ninfs to copy the decrypted save data to the appropriate folder on your new SD card (re-encrypting it in the process) and then use gm9 to fix the CMAC.

I might restore everything, but it seems risky. Actually I'm just interested in copying a few games that I had modded and didn't back up the files on my computer. Is it possible to extract cias from this to be reinstalled on a different 3ds/2ds? I don't care about save data.
 

Kwyjor

Well-Known Member
Member
Joined
May 23, 2018
Messages
4,323
Trophies
1
XP
4,454
Country
Canada
I might restore everything, but it seems risky. Actually I'm just interested in copying a few games that I had modded and didn't back up the files on my computer. Is it possible to extract cias from this to be reinstalled on a different 3ds/2ds?
I might be mistaken, but I don't think there's a way to extract CIAs. It might be possible to inject the old moveable.sed into the NAND on your new 3DS, and that will let you use your old SD card as-is, but I don't know how well that works – certainly, I've never tried it.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    Veho @ Veho: The cybertruck is a death trap.