Ninfs 3DS

From GameBrew
Revision as of 13:31, 13 April 2020 by HydeWing (talk | contribs) (Created page with "{{Infobox 3DS homebrew | title = Ninfs | image = https://dlhb.gamebrew.org/3dshomebrew/Ninfs.png|250px | type = PC Utilities | version = v1.7b2 | licence = Mixed | author = ih...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Template:Infobox 3DS homebrew

  1. ninfs

ninfs (formerly fuse-3ds) is a FUSE program to extract data from Nintendo game consoles. It works by presenting a virtual filesystem with the contents of your games, NAND, or SD card contents, and you can browse and copy out just the files that you need.

Windows, macOS, and Linux are supported.

<img src="ciamount-mac.png" width="882">

    1. Supported types
  • Nintendo 3DS:
  • CTR Cart Image (".3ds", ".cci")
  • CDN contents ("cetk", "tmd", and contents)
  • CTR Importable Archive (".cia")
  • Executable Filesystem (".exefs", "exefs.bin")
  • Nintendo 3DS NAND backup ("nand.bin")
  • NCCH (".cxi", ".cfa", ".ncch", ".app")
  • Read-only Filesystem (".romfs", "romfs.bin")
  • SD Card Contents ("Nintendo 3DS" from SD)
  • 3DSX Homebrew (".3dsx")
  • Nintendo DS / DSi
  • Nintendo DSi NAND backup ("nand\_dsi.bin")
  • Nintendo DS ROM image (".nds", ".srl")
  • Nintendo Switch
  • Nintendo Switch NAND backup ("rawnand.bin")
    1. Example uses
  • Mount a NAND backup and browse CTRNAND, TWLNAND, and others, and write back to them without having to extract and decrypt them first.
  • Browse decrypted SD card contents. Dump installed games and saves, or copy contents between two system's SD contents.
  • Extract a game's files out of a CIA, CCI (".3ds"), NCCH, RomFS, raw CDN contents, just by mounting them and browsing its files. Or use the virtual decrypted file and start playing the game in [Citra](https://citra-emu.org) right away.
    1. Setup

For 3DS types, The ARM9 bootROM is required. You can dump it using boot9strap, which can be set up by [3DS Hacks Guide](https://3ds.hacks.guide). To dump the bootROM, hold START+SELECT+X when you boot up your 3DS. It is checked in order of:

  • `--boot9` argument (if set)
  • `BOOT9_PATH` environment variable (if set)
  • `%APPDATA%\3ds\boot9.bin` (Windows-specific)
  • `~/Library/Application Support/3ds/boot9.bin` (macOS-specific)
  • `~/.3ds/boot9.bin`
  • `~/3ds/boot9.bin`

`boot9_prot.bin` can also be used in all of these locations.

"`~`" means the user's home directory. "`~/3ds`" would mean `/Users/username/3ds` on macOS and `C:\Users\username\3ds` on Windows.

CDN, CIA, and NCCH mounting may need [SeedDB](https://github.com/ihaveamac/3DS-rom-tools/wiki/SeedDB-list) for mounting NCCH containers of newer games (2015+) that use seeds. SeedDB is checked in order of:

  • `--seeddb` argument (if set)
  • `SEEDDB_PATH` environment variable (if set)
  • `%APPDATA%\3ds\seeddb.bin` (Windows-specific)
  • `~/Library/Application Support/3ds/seeddb.bin` (macOS-specific)
  • `~/.3ds/seeddb.bin`
  • `~/3ds/seeddb.bin`

Python 3.6.1+ and pycryptodomex are required. PySide2 is required for the GUI.

      1. Windows

Windows 7 or later is required.

(GUI in progress of being re-created.) Python does not have to be installed, but [WinFsp](http://www.secfs.net/winfsp/download/) is still required.

        1. Install with existing Python
      1. macOS

(GUI in progress of being re-created.) Python does not have to be installed, but [FUSE for macOS](https://osxfuse.github.io/) is still required.

        1. Install with existing Python

Versions of macOS supported by Apple are highly recommended. OS X Mavericks is the oldest version that should work.

      1. Linux
    1. Usage
      1. Graphical user interface

A GUI can be used, if ninfs was installed with GUI support, by specifying the type to be `gui` (e.g. Windows: `py -3 -mninfs gui`, \*nix: `python3 -mninfs gui`). The GUI controls mounting and unmounting.

      1. Command line

Run a mount script by using "`mount_<type>`" (e.g. `mount_cci game.3ds mountpoint`). Use `-h` to view arguments for a script.

If it doesn't work, the other way is to use `<python-cmd> -mninfs <type>` (e.g. Windows: `py -3 -mninfs cci game.3ds mountpoint`, \*nix: `python3 -mninfs cci game.3ds mountpoint`).

Windows users can use a drive letter like `F:` as a mountpoint, or use `*` and a drive letter will be automatically chosen.

Developer-unit contents are encrypted with different keys, which can be used with `--dev` with CCI, CDN, CIA, NANDCTR, NCCH, and SD.

        1. Unmounting
  • Windows: Press Ctrl + C in the command prompt/PowerShell window.
  • macOS: Two methods:
  • Right-click on the mount and choose "Eject �_drive name_�".
  • Run from terminal: `diskutil unmount /path/to/mount`
  • Linux: Run from terminal: `fusermount -u /path/to/mount`
      1. Examples
  • 3DS game card dump:

`mount_cci game.3ds mountpoint`

  • Contents downloaded from CDN:

`mount_cdn cdn_directory mountpoint`

  • CDN contents with a specific decrypted titlekey:

`mount_cdn --dec-key 3E3E6769742E696F2F76416A65423C3C cdn_directory mountpoint`

  • CIA:

`mount_cia game.cia mountpoint`

  • ExeFS:

`mount_exefs exefs.bin mountpoint`

  • 3DS NAND backup with `essential.exefs` embedded:

`mount_nandctr nand.bin mountpoint`

  • 3DS NAND backup with an OTP file (Counter is automatically generated):

`mount_nandctr --otp otp.bin nand.bin mountpoint`

  • 3DS NAND backup with OTP and CID files:

`mount_nandctr --otp otp.bin --cid nand_cid.bin nand.bin mountpoint`

  • 3DS NAND backup with OTP file and a CID hexstring:

`mount_nandctr --otp otp.bin --cid 7468616E6B7334636865636B696E6721 nand.bin mountpoint`

  • DSi NAND backup (Counter is automatically generated):

`mount_nandtwl --console-id 4E696E74656E646F nand_dsi.bin mountpoint`

  • DSi NAND backup with a Console ID hexstring and specified CID hexstring:

`mount_nandtwl --console-id 4E696E74656E646F --cid 576879446F657344536945786973743F nand_dsi.bin mountpoint`

  • DSi NAND backup with a Console ID file and specified CID file:

`mount_nandtwl --console-id ConsoleID.bin --cid CID.bin nand_dsi.bin mountpoint`

  • Switch NAND backup

`mount_nandhac --keys prod.keys rawnand.bin mountpoint`

  • Switch NAND backup in multiple parts

`mount_nandhac --keys prod.keys -S rawnand.bin.00 mountpoint`

  • NCCH container (.app, .cxi, .cfa, .ncch):

`mount_ncch content.cxi mountpoint`

  • RomFS:

`mount_romfs romfs.bin mountpoint`

  • `Nintendo 3DS` directory from an SD card:

`mount_sd --movable movable.sed "/path/to/Nintendo 3DS" mountpoint`

  • `Nintendo 3DS` directory from an SD card with an SD key hexstring:

`mount_sd --sd-key 504C415900000000504F4B454D4F4E21 "/path/to/Nintendo 3DS" mountpoint`

  • Nintendo DS ROM image (NDS/SRL, `mount_nds` also works):

`mount_srl game.nds mountpoint`

  • 3DSX homebrew application:

`mount_threedsx boot.3dsx mountpoint`

    1. Useful tools
    1. Related tools
  1. License/Credits

Special thanks to @Stary2001 for help with NAND crypto (especially TWL), and @d0k3 for SD crypto.

OTP code is from [Stary2001/3ds_tools](https://github.com/Stary2001/3ds_tools/blob/10b74fee927f66865b97fd73b3e7392e81a3099f/three_ds/aesengine.py), and is under the MIT license.

Warning: Using the GUI on macOS 10.14.6 will crash WindowServer and force you back to the login screen. The issue can be followed here: http://github.com/pyinstaller/pyinstaller/issues/4334

Changes since v1.6.1 SD: Properly decrypt contents of backup folder NANDHAC: Support "raw" partition-based emuMMC images with -R/--raw-emummc Display application name for CIA, CCI, and NCCH in mount title on macOS Allow assuming contents are decrypted for CCI and NCCH Major internal changes and rewriting Remove titledir mount - better tools will be coming later to search for installed titles Other things, probably Changes since v1.7b1 Display application name for CCI in mount title on macOS Allow assuming contents are decrypted for CCI and NCCH Interested in filling out a quick survey on how you use ninfs? Click here!

Important note This is not a full release, so some things may still be broken. Please file issues if this happens.

NAND and SD mounts allow writing. Keep backups before writing to these, in the event an unknown bug corrupts data.

There is a Windows tutorial for ninfs on GBAtemp. README also explains how to use it via command line and on non-Windows platforms. If you are unsure about something, you can ask at Nintendo Homebrew on Discord, or the GBAtemp thread.

The signatures are created with the PGP key 90725113CA578EAA.

Usage Windows and macOS users can download the standalone applications attached to this release, which works without needing Python installed. WinFsp for Windows or FUSE for macOS must still be installed.

Linux users (and users who prefer to use their installed Python) can install this release via pip, or by downloading the "Source code" archive. Python 3.6.1 or later is required. Read the README for more setup and usage details.

Command line install Windows py -3 -mpip install --upgrade https://github.com/ihaveamac/ninfs/releases/download/v1.7b2/ninfs-1.7b2-src.zip With GUI support: py -3 -m pip install --upgrade https://github.com/ihaveamac/ninfs/releases/download/v1.7b2/ninfs-1.7b2-src.zip#egg=ninfs[gui] macOS FUSE for macOS is required.

python3 -mpip install --upgrade https://github.com/ihaveamac/ninfs/releases/download/v1.7b2/ninfs-1.7b2-src.zip With GUI support: python3 -m pip install --upgrade https://github.com/ihaveamac/ninfs/releases/download/v1.7b2/ninfs-1.7b2-src.zip#egg=ninfs[gui] Linux python3 -mpip install --upgrade --user https://github.com/ihaveamac/ninfs/releases/download/v1.7b2/ninfs-1.7b2-src.zip --user is not required if you are using a virtualenv. With GUI support: python3 -m pip install --upgrade --user https://github.com/ihaveamac/ninfs/releases/download/v1.7b2/ninfs-1.7b2-src.zip#egg=ninfs[gui]

Advertising: