diff --git a/3dsconv.py b/3dsconv.py index 2f798fe..4ed031e 100755 --- a/3dsconv.py +++ b/3dsconv.py @@ -39,7 +39,7 @@ Options: --output= - Save converted files in specified directory Default: {} - --boot9= - Path to dump of protected ARM9 bootROM + --boot9= - Path to dump of ARM9 bootROM, protected or full --overwrite - Overwrite existing converted files --ignore-bad-hashes - Ignore invalid hashes and CCI files and convert anyway --verbose - Print more information'''.format( @@ -188,10 +188,13 @@ def show_progress(val, maxval): print_v('pyaes found, Searching for protected ARM9 bootROM') def set_keys(boot9_file): + prot_offset = 0 + if os.path.getsize(boot9_file) == 0x10000: + prot_offset = 0x8000 with open(boot9_file, 'rb') as f: global keys_set, orig_ncch_key # get Original NCCH (slot 0x2C key X) - f.seek(0x59D0) + f.seek(0x59D0 + prot_offset) key = f.read(0x10) key_hash = hashlib.md5(key).hexdigest() if key_hash == 'e35bf88330f4f1b2bb6fd5b870a679ca': @@ -208,13 +211,28 @@ def set_keys(boot9_file): set_keys(boot9_path) else: print_v('File doesn\'t exist.') - # check current directory + # check current directory for boot9.bin + if not keys_set: + print_v('... boot9.bin: ', end='') + if os.path.isfile('boot9.bin'): + set_keys('boot9.bin') + else: + print_v('File doesn\'t exist.') + # check current directory for boot9_prot.bin if not keys_set: print_v('... boot9_prot.bin: ', end='') if os.path.isfile('boot9_prot.bin'): set_keys('boot9_prot.bin') else: print_v('File doesn\'t exist.') + # check ~/.3ds/boot9.bin + if not keys_set: + path = os.path.expanduser('~') + '/.3ds/boot9.bin' + print_v('... ' + path + ': ', end='') + if os.path.isfile(path): + set_keys(path) + else: + print_v('File doesn\'t exist.') # check ~/.3ds/boot9_prot.bin if not keys_set: path = os.path.expanduser('~') + '/.3ds/boot9_prot.bin' diff --git a/README.md b/README.md index 53501fc..497dd28 100644 --- a/README.md +++ b/README.md @@ -21,11 +21,15 @@ python3 3dsconv.py [options] game.3ds [game.3ds ...] * `--verbose` - Print more information ## Encryption -3dsconv requires the Nintendo 3DS protected ARM9 bootROM to decrypt files using Original NCCH encryption (slot 0x2C). The file is checked for in the order of: +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_prot.bin` in current working directory -* `$HOME/.3ds/boot9_prot.bin` (Linux/Unix systems) or `%USERPROFILE%\.3ds\boot9_prot.bin` (Windows) +* `boot9.bin` (full) in current working directory +* `boot9_prot.bin` (protected) in current working directory +* `~/.3ds/boot9.bin` (full) +* `~/.3ds/boot9_prot.bin` (protected) + +Instructions to dump the bootROM will be put here later. ## Pack into standalone executable for Windows Using [py2exe for Python 3](https://pypi.python.org/pypi/py2exe/), 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](https://www.python.org/downloads/release/python-344/) is required, 3.5 or later is currently not supported.