Skip to content

[Testing needed] Add support for decrypting gamecart saves#963

Open
ZeroSkill1 wants to merge 6 commits intod0k3:masterfrom
ZeroSkill1:cart-save-crypto
Open

[Testing needed] Add support for decrypting gamecart saves#963
ZeroSkill1 wants to merge 6 commits intod0k3:masterfrom
ZeroSkill1:cart-save-crypto

Conversation

@ZeroSkill1
Copy link
Copy Markdown
Contributor

@ZeroSkill1 ZeroSkill1 commented May 2, 2026

This adds support for decrypting and reading the inner DISA save image stored on gamecarts.

For gamecarts using SPI flash for save data, this also processes the underlying wear leveling layer (that is, the blockmap and journal) and reconstructs the save image accordingly.

All possible crypto methods should be supported (but not all have been tested yet, see below).

Currently, this feature only provides read access to the decrypted save data. (would be half of what #726 is asking for)

The decrypted save image is provided as an additional file in the gamecart (C:) drive, as {title_id}_v{version}.dec.sav. For carts using wear leveling, the decrypted save image will be smaller than the raw version by exactly one flash sector (4 KiB) due to the wear leveling blockmap and journal being stored in it. For CARD2 carts both versions will be equal in size because those carts do not implement wear leveling.

In addition, these changes have been made to the gamecart code:

  • Any mounted image (.nds, .3ds, decrypted save for 3DS cartridges) will be unmounted if the cart is physically ejected (as opposed to the "dead" remaining drive and files inside it after the cart has been removed)
  • Card ID2 is now also provided in the .txt file of the gamecart drive for 3DS cartridges
  • Removed an unnecessary spam of command A2h during secure init - this improves init times by up to 2.5s

Example (Super Mario 3D Land):

Example showing decrypted savegame in gamecart menu.

More testing is required as I do not personally have all possible types of cartridges. Here are the ones I have tested:

  • Zoo Resort 3D (000400000004B200) - CARD1 - SPI Flash (128 KiB) - Crypto Type 0
  • Super Mario 3D Land (0004000000053F00) - CARD1 - SPI Flash (128 KiB) - Crypto Type 1

Test build available here.

Feel free to share test results. Working means you can mount the DISA image and see plaintext save data (or visible DISA, DIFI, DPFS, and IVFC magic in the hex editor). Please include the .txt file GodMode9 generates in the gamecart drive when doing so. If something doesn't work right, please also provide the ncsd.bin of your cartridge (can be extracted from the .3ds file by mounting it - only the last 0x100 bytes of the whole 0x200 bytes are necessary in this case).

The following cart types need testing (checked entries mean these have been tested to be working by other users):

  • 512 KiB SPI Flash
  • 1 MiB SPI Flash
  • Carts using crypto type 2 (used in games such as Pokémon Omega Ruby and Alpha Sapphire)
  • New3DS-only carts using crypto type 2 (used in the physical version of Runbow Pocket and possibly some other New3DS exclusives)
  • CARD2 (also used in above games)

@ZeroSkill1 ZeroSkill1 changed the title [Testinng needed] Add support for decrypting gamecart saves [Testing needed] Add support for decrypting gamecart saves May 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant