Code Monkey home page Code Monkey logo

3dsconv's Introduction

3dsconv

3dsconv.py is a Python 3 script that converts Nintendo 3DS CTR Cart Image files (CCI, ".cci", ".3ds") to the CTR Importable Archive format (CIA).

3dsconv can detect if a CCI is decrypted, encrypted using original NCCH (slot 0x2C), or encrypted using zerokey. Encryption requires pyaes (pip install pyaes). Original NCCH encryption requires a copy of the protected ARM9 bootROM.

Decrypt9WIP and GodMode9 can dump game cards to CIA directly now, rendering this tool partially obsolete. It can still be used for existing game dumps, however.

Usage

Basic use

On Windows, CCIs can be dragged on top of 3dsconv.exe. See Encryption for details about encrypted files.

Advanced options

3dsconv can be used as a standalone script, or installed using python3 setup.py install.

python3 3dsconv.py [options] game.3ds [game.3ds ...]
  • --output=<dir> - Save converted files in specified directory; default is current directory or value of variable output-directory
  • --boot9=<file> - Path to dump of protected ARM9 bootROM
  • --overwrite - Overwrite existing converted files
  • --ignore-bad-hashes - Ignore invalid hashes and CCI files and convert anyway
  • --ignore-encryption - Ignore the encryption header value, assume the ROM as unencrypted
  • --verbose - Print more information
  • --dev-keys - Use developer-unit keys

Encryption

3dsconv requires the Nintendo 3DS full or protected ARM9 bootROM to decrypt files using Original NCCH encryption (slot 0x2C). The file is checked for in the order of:

  • Value of option --boot9= or variable boot9_path, if set
  • boot9.bin (full) in current working directory
  • boot9_prot.bin (protected) in current working directory
  • ~/.3ds/boot9.bin (full)
  • ~/.3ds/boot9_prot.bin (protected)

boot9strap is required to dump. Setup can be found at 3DS Guide. Hold START+SELECT+X at boot to dump to sdmc:/boot9strap/boot9.bin.

boot9 SHA256: 2f88744feed717856386400a44bba4b9ca62e76a32c715d4f309c399bf28166f
boot9_prot SHA256: 7331f7edece3dd33f2ab4bd0b3a5d607229fd19212c10b734cedcaf78c1a7b98

Developer titles (not fully tested)

Conversion for developer-unit systems is possible with --dev-keys. This is required for titles encrypted using dev-unit keys (only seems to be used for SystemUpdater). Titles encrypted with retail keys can't be converted this way without external decryption.

This does not decrypt or change the encryption of the output file, therefore CIAs will still only work on dev-units without separate decryption or changing encryption.

The dev certchain must be provided. The file is searched for is certchain-dev.bin in current working directory, or ~/.3ds/certchain-dev.bin.

To extract from a dev CIA, use ctrtool --certs=certchain-dev.bin title.cia.

SHA256: 7921ae82c9dcf411351314f2fe2c67378c6a872d2524f71b3c002b4d4a56846f

Pack into standalone executable for Windows

Using py2exe for Python 3, you can pack the script into a Windows executable, primarily for use on a computer without Python, or for easy use in the Windows Command Prompt. Python 3.4 is required, 3.5 or later is currently not supported.

  1. Clone or download the repository, or the latest release.
  2. Open the Windows Command Prompt (cmd.exe) in the current directory.
  3. Run py -3.4 -m py2exe.build_exe 3dsconv.py -b 0. See the py2exe page for more options.
  4. 3dsconv.exe will be in dist after it finishes. If anything but 0 was used for -b/--bundle-files, dependencies will also be saved.

License / Credits

  • 3dsconv.py and pyaes are under the MIT license.

For versions older than "2.0", see this Gist.

3dsconv's People

Contributors

dr1s avatar drizzt avatar fuckermansayin avatar ihaveamac avatar putnam avatar thisisareku avatar xendke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

3dsconv's Issues

Convert cia to 3ds?

Is there a way that you can convert a cia to a 3ds? Most games I find that I want are cia files but I want to play them as a 3ds rom on my sky3ds+.

--output not respected

Expected: --output=c:\cias converts the files and puts the new one in c:\cias
Actual: the folder c:\cias is made, but it just puts the new file next to the 3dsconv.exe file (as is it's default location, as per the documentation)

Error: invalid ExtHeader hash / But Rom works on citra like a charm

Hi,

I tried really every tool out there to transform trimed, decrypted .3ds files to .cia I found on the net. None worked out of the box. With 3dsconv I get at least an error witch is a hint for something.

Here an Examble for "0487 - Legend of Zelda, The - A Link Between Worlds (Europe) (En,Fr,De,Es,It) Decrypted.3ds"

Errorlog:
"C:\Users*\Desktop\3ds to cia>3dsconv.exe --boot9=boot9.bin --verbose 0487.3ds
3dsconv.py ~ version 4.1
pyaes found, Searching for protected ARM9 bootROM
... boot9.bin: Correct key found.

Processing 0487.3ds...

Title ID: 00040000000EC400

Game Executable CXI Size: 2AABC000
Manual CFA Size: 1D3000
Download Play child CFA Size: 0

Normal key: {normalkey}
Converting 0487 (encrypted)...

Verifying ExtHeader...
Decrypting ExtHeader...
This file may be corrupt (invalid ExtHeader hash).
Done converting 0 out of 1 files. "

The file workes absolutely perfect on citra emu. Why is a transform to .cia always giving that error and how can it be fixed?

Thanks for your work!

SyntaxError: invalid syntax

When i try to run
python3 3dsconv.py game.3ds

i got this error

File "3dsconv.py", line 24 global boot9_path = os.environ[namevar] ^ SyntaxError: invalid syntax
can you help?

Using OSX v. 10.15.2

This works

Just a note for lurkers that this script still works great.

Used godmode9 to decrypt in-place on the system, then converted to cia using the script + installed the CIA with FBI + worked great.

While gm9 is great also for doing the conversion on device, I didn't have the SD space, so this script is a good option.

Can't convert Bravely Default dump properly

I made a decrypted, trimmed rip of Bravely Default EU using D9WIP and have tried converting it with 3dsconv multiple times, but the result has always been the same: The converter generates a cxi and a cfa file then exits without making a .cia.
Using the 64 bit Windows version with latest makerom, FYI.

Manual/Download Play child container breaking (again)

not sure why this is happening, but game cards dumped with Decrypt9 (haven't tested others recently), whether dump+decrypt or dump+xorpads generated, seem to have Manual and Download Play broken(results in "The SD Card was removed" error for manual).

I might just have to switch back to makerom :/

Add exe easier to use for multiple builds option

what about creating an exe with something like this:

import os
import sys


def run3dsconv():
    if not os.path.exists("cias"):
        os.makedirs("cias")
    input_directory = "roms"
    for root, dirs, files in os.walk(input_directory):
        for file in files:
            if file.endswith(".3ds"):
                input_path = os.path.join(root, file)
                output_dir = "cias"
                print("Converting", input_path, "to", output_dir)
                os.system("python 3dsconv.py --output=\"" + output_dir + "\" --boot9=\"boot9.bin\" \"" + input_path + "\"")


if __name__ == "__main__":
    if not os.path.exists("roms"):
        print("Error: roms directory not found")
        os.makedirs("roms")
        sys.exit(1)
    if not os.path.exists("boot9.bin"):
        print("Error: boot9.bin not found")
        sys.exit(1)
    run3dsconv()

so you can simply run the code and everything will be done automaticaly without any data parsing in

Name "exefs_icon" is not defined

Seems like no matter what 3ds files I try, whether or not they were things I dumped previously for Citra, will not convert back into CIA files, giving me this error every single time.
exefs_name

ncchinfo.bin generation (missing headers)

Hi there.
I'm the guy having issues with converting 3ds files with your script. I think the ncchinfo.bin header isn't complete. After your last update the file is valid for converting, but it fails to install. With simple CIA Converter generated xorpads I can build valid CIA files.
I use Monster Hunter Ultimate 4, which I converted from my cart ridge.

I attached bot ncchinfo.bin files and a screenshot with the error message after installing monster hunter 4 Ultimate.

ncchinfo.zip
img_20160421_234126

Decrypted roms detected as Encrypted

I have several *.3ds roms that are already decrypted. They works fine on Citra, but trying to convert them to *.cia leads to an error (invalid ExtHeader hash) as 3dsconv try to decrypt them before converting.

I tried to force the encrypted variable to False (

encrypted = not encryption_bitmask & 0x4
) and the resulting CIA file is working.

wth

"3dsconv.py ~ version 4.2
Error: bootROM not found, encryption will not be supported
Error: "x.3ds" is encrypted using Original NCCH and pyaes or the bootROM were not found, therefore this can not be converted. See the README at https://github.com/ihaveamac/3dsconv for details.
Done converting 0 out of 1 files."

When I open the .exe archive it instantly closes

I'm kinda newbie in this encrypting/decrypting/converting thing in the 3DS hacking community (kinda newbie in 3DS hacking in general) and when I try to drag the decrypted .3ds file to the 3dsconv.exe, a prompt pops up on the screen and then automatically closes. What can I do to fix it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.