Skip to content

Commit

Permalink
Merge pull request #14 from Shadowtrance/master
Browse files Browse the repository at this point in the history
Master
  • Loading branch information
Shadowtrance committed Jan 19, 2016
2 parents 5914304 + 2d7bb47 commit 98593d7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ release:
@-cp $(OUTPUT).3dsx $(RELEASE)/$(TARGET)
@-cp $(OUTPUT).smdh $(RELEASE)/$(TARGET)
@cp $(CURDIR)/scripts/*.py $(RELEASE)/scripts
@cp $(CURDIR)/README.md $(RELEASE)
@-[ ! -n "$(strip $(THEME))" ] || (mkdir $(RELEASE)/$(THEME) && cp $(CURDIR)/resources/$(THEME)/*.bin $(RELEASE)/$(THEME))
@-7z a $(RELEASE)/$(TARGET)-`date +'%Y%m%d-%H%M%S'`.zip $(RELEASE)/*

Expand Down
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ You may discuss this work in progress version, help testing, participate in the
There are at the present time, three main versions of Decrypt9 available:
* __[Decrypt9 by Archshift](https://github.com/archshift/Decrypt9)__: This is the original version of Decrypt9 by Archshift. New features are pulled into this once they are thoroughly tested. This is as stable as it gets, but may also miss some of the newer features.
* __[Decrypt9 WIP by d0k3](https://github.com/d0k3/Decrypt9)__: This is the work in progress fork of Archshifts original Decrypt9. It contains the newest features and is always up to date. Releases in here can be considered tested beta versions.
* __[Decrypt9 UI by Shadowtrance](https://github.com/shadowtrance/Decrypt9)__: This is a themed version of Decrypt9 WIP created by Shadowtrance. It contains a nice graphical user interface (instead of text only as the other two versions), but is not up to date at the moment.
* __[Decrypt9 UI by Shadowtrance](https://github.com/shadowtrance/Decrypt9)__: This is a themed version of Decrypt9 WIP created by Shadowtrance. It contains a nice graphical user interface (instead of text only as the other two versions), but may not be up to date at all times

## What can I do with this?

Expand Down Expand Up @@ -55,7 +55,9 @@ Features in Decrypt9 are categorized into 5 main categories, see the description
### XORpad Generator Options
This category includes all features that generate XORpads. XORpads are not useful on their own, but they can be used (with additional tools) to decrypt things on your PC. Most, if not all, of the functionality provided by these features can now be achieved in Decrypt9 in a more comfortable way by newer dump/decrypt features, but these are still useful for following older tutorials and to work with other tools.
* __NCCH Padgen__: This generates XORpads for NCCH/NCSD files ('.3DS' f.e.) from `ncchinfo.bin` files. Generate the `ncchinfo.bin` via the included Python script `ncchinfo_gen.py` (or `ncchinfo_tgen.py` for theme packs) and place it into the `/Decrypt9/` work folder. Use [Archshift's XORer](https://github.com/archshift/xorer) to apply XORpads to .3DS files. NCCH Padgen is also used in conjunction with [Riku's 3DS Simple CIA Converter](https://gbatemp.net/threads/release-3ds-simple-cia-converter.384559/). Important Note: Depending on you 3DS console type / FW version and the encryption in your NCCH/NCSD files you may need additional files `slot0x25KeyX.bin` and / or `seeddb.bin`. You're on your own for `slot0x25KeyX.bin`, but for `seeddb.bin` [this](http://tinivi.net/seeddb/) will help you.
* __SD Padgen__: This generates XORpads for files installed into the '/Nintendo 3DS/' folder of your SD card. Use the included Python script `sdinfo_gen.py` and place the the resulting `sdinfo.bin` into your `/Decrypt9/` work folder. If the SD files to generate XORpads for are from a different NAND (your EmuNAND, f.e.), you also need the respective `movable.sed` file (dumpable via Dercrypt9) to generate valid XORpads. Use [padXORer by xerpi](https://github.com/polaris-/3ds_extract) to apply XORpads.
* __SD Padgen (SDinfo.bin)__: This generates XORpads for files installed into the '/Nintendo 3DS/' folder of your SD card. Use the included Python script `sdinfo_gen.py` and place the the resulting `sdinfo.bin` into your `/Decrypt9/` work folder. If the SD files to generate XORpads for are from a different NAND (different console, f.e.), you also need the respective `movable.sed` file (dumpable via Dercrypt9) to generate valid XORpads. By now, this feature should only make sense when decrypting stuff from another 3DS - use one of the two features below or the SD Decryptor instead. Use [padXORer by xerpi](https://github.com/polaris-/3ds_extract) to apply XORpads.
* __SD Padgen (SysNAND)__: This is basically an improved version of the above feature. For typical users, there are two folders in '/Nintendo 3DS/' on the SD card, one belonging to the SysNAND, the other to EmuNAND. This feature will generate XORpads for encrypted content inside the folder belonging to the SysNAND. It won't touch your SysNAND, thus it is not a danegrous feature. A folder selection prompt will allow you to specify exactly the XORpads you want to be generated. Generating all of them at once is not recommended, because this can lead to several GBs of data and very long processing time.
* __SD Padgen (EmuNAND)__: This is the same as the above feature, but utilizing the EmuNAND folder below '/Nintendo 3DS/' on the SD card. The EmuNAND folder is typically a lot larger than the SysNAND folder, so be careful when selecting the content for which to generate XORpads for.
* __CTRNAND Padgen__: This generates a XORpad for the CTRNAND partition inside your 3DS console flash memory. Use this with a NAND (SysNAND/EmuNAND) dump from your console and [3DSFAT16Tool](https://gbatemp.net/threads/port-release-3dsfat16tool-c-rewrite-by-d0k3.390942/) to decrypt and re-encrypt the CTRNAND partition on PC. This is useful for any modification you might want to do to the main file system of your 3DS.
* __TWLNAND Padgen__: This generates a XORpad for the TWLNAND partition inside your 3DS console flash memory. Use this with a NAND (SysNAND/EmuNAND) dump from your console and [3DSFAT16Tool](https://gbatemp.net/threads/port-release-3dsfat16tool-c-rewrite-by-d0k3.390942/) to decrypt and re-encrypt the TWLNAND partition on PC. This can be used, f.e. to set up the [SudokuHax exploit](https://gbatemp.net/threads/tutorial-new-installing-sudokuhax-on-3ds-4-x-9-2.388621/).

Expand All @@ -66,7 +68,7 @@ This category includes all titlekey decryption features. Decrypted titlekeys (`d
* __Titlekey Decrypt (EmuNAND)__: This will find and decrypt all the titlekeys contained on your EmuNAND, without the need for additional tools. The `decTitleKeys_emu.bin` will be generated on your SD card.

### SysNAND / EmuNAND Options
This is actually two categories in the main menu, but the functionality provided is largely the same (for SysNAND / EmuNAND respectively). These categories include all features that dump, inject, modify or extract information from/to the SysNAND/EmuNAND. For an extra layer of safety, critical(!) features - meaning all features that actually introduce change to the NAND - are protected by a warning message and an unlock sequence that the user has to enter. Caution is adviced with these protected features. They should only be used by the informed user.
This is actually two categories in the main menu, but the functionality provided is largely the same (for SysNAND / EmuNAND respectively). These categories include all features that dump, inject, modify or extract information from/to the SysNAND/EmuNAND. For functions that output files to the SD card, the user can choose a filename from a predefined list. For functions that use files from the SD card for input, the user can choose among all candidates existing on the SD card. For an extra layer of safety, critical(!) features - meaning all features that actually introduce change to the NAND - are protected by a warning message and an unlock sequence that the user has to enter. Caution is adviced with these protected features. They should only be used by the informed user.
* __(Emu)NAND Backup__: Dumps the `NAND.bin` file from your SysNAND or the `ÈmuNAND.bin` file from your EmuNAND. This is a full backup of your 3DS System NAND and can be used to restore your 3DS SysNAND / EmuNAND to a previous state or for modifications.
* __(Emu)NAND Restore(!)__: This fully restores your SysNAND or EmuNAND from the provided `NAND.bin` file (needs to be in the `/Decrypt9/` work folder). Be careful not to restore a corrupted NAND.bin file. Also note that you won't have access to this feature if your SysNAND is too messed up or on a too high FW version to even start Decrypt9 (should be self explanatory).
* __Partition Dump...__: This allows you to dump & decrypt any of the partitions inside your NANDs (TWLN / TWLP / AGBSAVE / FIRM0 / FIRM1 / CTRNAND). Partitions with a file system (TWLN / TWLP / CTRNAND) can easily be mounted, viewed and edited on Windows via [OSFMount](http://www.osforensics.com/tools/mount-disk-images.html). These partitions are included in your NAND and can be dumped by this feature:
Expand All @@ -90,7 +92,7 @@ This is actually two categories in the main menu, but the functionality provided
* __updtsave.bin__: _Contains some data relating to system updates_ - it is possible to block automatic system updates (ie. the 'update nag') with this file. Research is still in progress. [Read this](https://gbatemp.net/threads/poc-removing-update-nag-on-emunand.399460/page-5#post-5863332) and the posts after it for more information.
* __File Inject...(!)__: This allows you to directly encrypt & inject various files of interest into the SysNAND and EmuNAND. For more information check out the list above.
* __Health&Safety Dump__: This allows you to to dump the decrypted Health and Safety system app to your SD card. The dumped H&S app can be used to [create injectable files for any homebrew software](https://gbatemp.net/threads/release-inject-any-app-into-health-safety-o3ds-n3ds-cfw-only.402236/).
* __Health&Safety Inject(!)__: This is used to inject any app into your Health & Safety system app (as long as it is smaller than the original H&S app). Multiple safety clamps are in place, and this is a pretty safe feature. Users are still adviced to be cautious using this and only use inject apps created with the [Universal Inject Generator](https://gbatemp.net/threads/release-inject-any-app-into-health-safety-o3ds-n3ds-cfw-only.402236/).
* __Health&Safety Inject(!)__: This is used to inject any app into your Health & Safety system app (as long as it is smaller than the original H&S app). Multiple safety clamps are in place, and this is a pretty safe feature. Users are still adviced to be cautious using this and only use eiter the original hs.app or inject apps created with the [Universal Inject Generator](https://gbatemp.net/threads/release-inject-any-app-into-health-safety-o3ds-n3ds-cfw-only.402236/). This feature will detect all injectable apps on the SD card and let the user choose which one to inject.
* __Update SeedDB__: (EmuNAND only) Use this to create or update the ´seeddb.bin´ file on your SD card with the seeds currently installed in your EmuNAND. Only new seeds will get added to `seeddb.bin` and all ones are untouched.

### Game Decryptor Options
Expand All @@ -100,7 +102,9 @@ This category includes all features that allow the decryption (and encryption) o
* __CIA Decryptor (shallow)__: Use this to decrypt, for all CIA files in the folder, the first layer of CIA decryption. The internal NCCH encryption is left untouched.
* __CIA Decryptor (deep)__: Use this to fully decrypt all CIA files in the folder. This also processes the internal NCCH encryption. Deep decryption of a CIA file is otherwise known as _cryptofixing_. This also may need additional files `slot0x25KeyX.bin` and / or `seeddb.bin`, see above.
* __CIA Decryptor (CXI only)__: This is the same as CIA Decryptor (deep), but it does not process the 'deep' NCCH encryption for anything but the first CXI content. On some hardware, fully deep decrypted CIA files might not be installable, but CIA files processed with feature will work.
* __SD Decryptor/Encryptor__: Use this to decrypt or encrypt 'SD files'. SD files are titles, extdata and databases found inside the `/Nintendo 3DS/<id0>/<id1>/` folder. For this feature to work, you need to manually copy the file(s) you want to process. Copy them with their full folder structure (that's everything _after_ `/Nintendo 3DS/<id0>/<id1>/`) to the work / game folder.
* __SD Decryptor/Encryptor__: Use this to decrypt or encrypt 'SD files'. SD files are titles, extdata and databases found inside the `/Nintendo 3DS/<id0>/<id1>/` folder. For this feature to work, you need to manually copy the file(s) you want to process. Copy them with their full folder structure (that's everything _after_ `/Nintendo 3DS/<id0>/<id1>/`) to the work / game folder. This feature should by now only be useful to encrypt content, decryption is much easier handled by the two features below.
* __SD Decryptor (SysNAND dir)__: An improved version of the feature above. This allows you to select content from '/Nintendo 3DS/' (more specifically from the subfolder belonging to SysNAND) to be directly copied to your work / game folder and then decrypted from there.
* __SD Decryptor (EmuNAND dir)__: This has the same functionality as the feature above, but handles the content of the '/Nintendo 3DS/' subfolder belonging to the EmuNAND instead.

## Credits by Archshift
* Roxas75 for the method of ARM9 code injection
Expand Down
2 changes: 2 additions & 0 deletions source/decryptor/nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,8 @@ u32 RestoreNand(u32 param)
if (InputFileNameSelector(filename, "NAND.bin", NULL, NULL, 0, nand_size) != 0)
return 1;

if (!DebugFileOpen(filename))
return 1;
if (nand_size != FileGetSize()) {
FileClose();
Debug("NAND backup has the wrong size!");
Expand Down

0 comments on commit 98593d7

Please sign in to comment.