[Tutorial] How to Decrypt, Extract & Rebuild 3DS|CIA|CXI Files

Discussion in '3DS - ROM Hacking, Translations and Utilities' started by Asia81, Mar 4, 2015.

?

How is my english?

  1. So bad...

    33 vote(s)
    6.9%
  2. Good, sometimes it's not understandable

    76 vote(s)
    15.9%
  3. Very understandable

    293 vote(s)
    61.3%
  4. Perfect?

    76 vote(s)
    15.9%
  1. Asia81
    OP

    Asia81 In my Ecchi World <3

    Member
    4,766
    2,277
    Nov 15, 2014
    France
    Albi
    [​IMG]

    This tutorial will try to help you decrypt and extract a 3DS|CIA|CXI file to change its content, and will also explain how to rebuild your game once edited.

    Thanks a lot to Ericzander & BullyWiiPlaza for their help to translate this tutorial in english :)
    (Because I'm French, it’s difficult to make a full tutorial in a good english...).
    If anyone see any typo or something wrong with my english (in the setup, the script, the tutorial...) let me know!

    Ce tutoriel est également disponible ici pour les français (Pas à Jours) :
    This tutorial is also available here for french users (Outdated):
    http://www.pokemontrash.com/jeux-pokemon/decrypter-compiler-rom-3ds.php

    For this tutorial, some words will be shortened:
    - Homebrew(s) by HB (or HBs)
    - The HomeBrew Launcher by HBL
    - Decrypt9WIP by Decrypt9


    SUMMARY

    - What you need
    - Prerequisites
    - Decrypting
    - Extracting
    - Editing
    - Rebuilding​

    What you Need

    • A 2DS|O3DS|N3DS with a SysNand Firmware between 4.1 and 9.2 (4.1 and 11.3 with A9LH and/or SafeHax)
    • A 3DS|CIA|CXI File (It can either be a game, game's update, system application, but anyways not a DLC file nor a DSi Ware!)
    • WinRAR, or another archive extractor
    • A way to launch Homebrews, see here: http://smealum.github.io/3ds/
    • A SD card with a minimum free capacity of 2GB (4 is recommended)
    • HackingToolkit3DS -> Click Here

    Prerequisites

    Install the new SetupUS|FR.exe of HackingToolkit3DS as a common tool:


    Decrypting
    Once you have access to the HBL, copy the Decrypt9WIP folder to your 3ds folder (like another HB).
    In the root of your SD Card, create a new folder, and call it files9, then put inside your 3DS|CIA file(s).

    Put also in that files9 folder:
    - seeddb.bin
    - aeskeydb.bin
    (You have to find them yourself, it should not be that hard).

    If you plan to Decrypt a 3DS file:
    Start HBL, start Decrypt9, choose Content Decryptor Options, then NCCH/NCSD File Options and finally NCCH/NCSD Decryptor.
    [​IMG] [​IMG] [​IMG]

    If you plan to Decrypt a CIA file:
    Start HBL, start Decrypt9, choose Content Decryptor Options, then CIA File Options and finally CIA Decryptor (deep).
    [​IMG] [​IMG] [​IMG]

    Wait while it's decrypting.

    Once done, copy and paste your decrypted game in the folder where HackingToolkit3DS.exe is.
    Now it's done, go to Extracting.
    Extracting

    Open HackingToolkit3DS:
    [​IMG]

    Don't forget, your file(s) should not have any spaces in its(their) name(s), nor special characters, like é or à.
    You want extract PokemonMoon.3ds ? Just write PokemonMoon.


    If you decrypted and plan to extract a 3DS file:
    Write the "D" command, and enter the name of your decrypted file WITHOUT its extension.

    If you decrypted and plan to extract a CIA file:
    Write the "CE" command, and enter the name of your decrypted file WITHOUT its extension.

    If you decrypted and plan to extract a CXI file:
    Write the "CXI" command, and enter the name of your decrypted file WITHOUT its extension.

    You are asked if you want decompress your code.bin file, choose (n/y).
    Wait while it's extracting.

    The ExeFS content will be extracted in an ExtractedExeFS folder.
    The RomFS content will be extracted in an ExtractedRomFS folder.
    The DownloadPlay content will be extracted in an ExtractedDownloadPlay folder.
    The Old3DS update will be extracted in an ExtractedO3DSUpdate folder.
    The New3DS update will be extracted in an ExtractedN3DSUpdate folder.
    The Manual will be extracted in an ExtractedManual folder.
    The 3D Banner will be extracted in an ExtractedBanner folder.

    The work here should be ok.
    Now you’re able to edit the game, go to Editing.

    Editing

    Do what you want.
    Edit music, textures..
    If you follow this tutorial, you know what you want to do.
    Once it's finished, rebuild your game.

    Rebuilding for HANS
    Part 1: Rebuild your RomFS

    Open HackingToolkit3DS, write the "RFSB" command.
    [​IMG]

    RomFS Builder is now open.
    With it, open your ExtractedRomFS folder.

    Click GO. Wait and save it named CustomRomFS.bin.
    [​IMG]
    Done !

    Part 2: Set the files on your SD Card
    First of all, you'll need to have HBL and HANS already ready on your 3DS.

    In the root of your SD Card, create a new folder, and name it HANS.
    Inside, put your new RomFS file, and name it with the UniqueID of your game + romfs as the extension.
    Do the same for the code.bin file (only if you edited it, of course).
    The code.bin is in your ExtractedExeFS folder.

    For example, for Cubic Ninja, it's:
    It's ready. Start HBL, then start HANS.
    Use the Title Selector, select your game, and confirm.

    In HANS, you will have to edit:
    [​IMG]

    And OK, now start your game and enjoy!

    Rebuilding for CFW / FlashCards

    If you extracted and plan to rebuild a 3DS file:
    Open HackingToolkit3DS, write the "R" command, then enter the name you want for the output file.
    [​IMG]

    Once done, don't forget to encrypt it back using Decrypt9.
    Open it, choose Content Decryptor Options, then NCCH/NCSD File Options and finally NCCH/NCSD Encryptor.
    [​IMG] [​IMG] [​IMG]

    Enjoy!

    If you extracted and plan to rebuild a CIA file:
    Open HackingToolkit3DS, write the "CR" command, then enter the name you want for the output file.
    [​IMG]

    Once done, and only if you have dealed with a system application (HomeMenu, SystemSettings, etc...) you need to encrypt the CIA back before install it.
    Start Decrypt9, choose Content Decryptor Options, then CIA File Options and finally CIA Encryptor (NCCH).
    [​IMG] [​IMG] [​IMG]

    Enjoy!

    Troubleshooting

    Before report an issue, be sure:

    1. Your 3DS/CIA/CXI files are fully decrypted
    2. Your 3DS/CIA/CXI files doesn't have any space or special caracter in their names (such as é or à)
    3. To don't write the extension when asking for extract your game. Want extract "Game.cia"? Just write "Game".
    4. To have installed the Setup package for your langage.

    Changelogs

    [​IMG]

    Version 9
    Fixed CIA rebuild script.

    Version 8
    Fixed MassExtraction and MassRebuild scripts.

    Version 7
    32bits support should be fixed (I forgot to include a 32bits build of MakeRom).

    Version 6
    Added support for 32bits Windows.
    Deleted website in the header.

    Version 5.7
    Check added if the Setup file is installed.
    The tool will normally launch if it is, otherwise it will close.

    Version 5.6
    I just improved the MassExtraction Script.
    You can now choose to decompress (or don't) all code.bin files at once, or be asked for each.

    Version 5.5
    I just added a way to enter a custom minor and micro version when rebuilding a CIA file.

    Version 5.4
    Added a MassRebuild option

    Credits and Thanks

    Credits:
    CtrTool : Neimod & 3DSGuy
    Makerom : 3DSGuy
    RomFS Builder : SciresM
    RomFS Extractor : SciresM
    3DS Builder : SciresM
    BrainDump : neobrain
    Decrypt9 : d0k3, Shadowtrance & Archshift
    3DS Simple CIA Converter : Riku
    Pokemon RomFS Pointer Tool : AHP_Person
    HackingToolkit3DS : Asia81
    CleanTool : Asia81

    Thanks to:
    Megadrifter
    Stratovarius
    Reisyukaku
    Guitoh
    Weby
    Apache Thunder
    Ericzander
    BullyWiiPlaza
    Cellenseres​

    THE LAST WORD

    AS ALWAYS #TEAMONODERA AND #TEAMREM UNTIL THE DEATH

    [​IMG] [​IMG]
     
    Last edited by Asia81, Apr 3, 2017
    HBKoko, AyanamiRei, masskiss and 61 others like this.


  2. Apache Thunder

    Apache Thunder I have cameras in your head!

    Member
    4,025
    3,572
    Oct 7, 2007
    United States
    Levelland, Texas
    You can also perhaps provide an alternative method (which would be a lot shorter to explain then the old xorpad method) by using rxTools to decrypt the rom instead, then extract everything with CTRTool/3DSExplorer. The resulting files will already be decrypted and if ran on 7.x or newer sysnand, the key slot bin file won't be needed. :D
     
  3. g.a.u

    g.a.u Member

    Newcomer
    42
    2
    Oct 11, 2014
    Ho Chi Minh City, Vietnam
    --sorry for my bad english--
    i did all of these step ,when i rebuild Kingdom hearts 3d (with rsf editted) ,it created a 3ds rom has smaller size than it was (2,1gb -> 1.8gb)
    Load the rom on 3ds and nothing happen (the icon is blank)
    Tried to use this tool
    https://gbatemp.net/threads/tool-makerom-gui.376540/
    and this is error it give me
    [​IMG]
     
  4. Eli'

    Eli' Member

    Newcomer
    10
    0
    Feb 17, 2015
    France
    I have done all correctly your tutorial here without update but it does not work!
    The game freeze in the 3ds logo when you start to play. I edit nothing in the game (Extractedromfs's folder) only because I wanted to test before if it work or not but It does'nt work!
    I can even put a full video of your tutorial to show you that it don't work. (perhaps I made something wrong but I don't think because If I update the game it work so...) I don't want the update.
     
  5. Asia81
    OP

    Asia81 In my Ecchi World <3

    Member
    4,766
    2,277
    Nov 15, 2014
    France
    Albi
    Proof it's working :

    Just read the tutorial.



    I'm sorry, but i don't really know how to do this with other game such as Pokemon.
    Give me your RSF, i will try it.
    It's Kingdom Hearts 3D EUR ?
     
    Margen67 likes this.
  6. g.a.u

    g.a.u Member

    Newcomer
    42
    2
    Oct 11, 2014
    Ho Chi Minh City, Vietnam
    its KH3D US
    this is my RFS
     

    Attached Files:

    • RSF.rar
      File size:
      2.1 KB
      Views:
      429
  7. Asia81
    OP

    Asia81 In my Ecchi World <3

    Member
    4,766
    2,277
    Nov 15, 2014
    France
    Albi
    I haven't US version, i will download it later
     
  8. Leftshark

    Leftshark Member

    Newcomer
    11
    1
    Feb 25, 2015
    United States
    i did this but every time it loads pass 3s logo it stays on a black screen can anyone help?
     
    Eli' likes this.
  9. Asia81
    OP

    Asia81 In my Ecchi World <3

    Member
    4,766
    2,277
    Nov 15, 2014
    France
    Albi
    What's your game ?

    I will try to make a video tutorial if he can help someone
     
  10. Leftshark

    Leftshark Member

    Newcomer
    11
    1
    Feb 25, 2015
    United States
    pokemon AS. I tried changing the .mm files from the sprites around but it wont load the game :/
     
  11. Eli'

    Eli' Member

    Newcomer
    10
    0
    Feb 17, 2015
    France
    Just read the tutorial?

    Here a video to show you it don't work for me and i don't know for other (Video edited because I forget to not show the 3ds key):


    What is wrong? I don't understand!
     
  12. Fishaman P

    Fishaman P Speedrunner

    Member
    3,239
    505
    Jan 2, 2010
    United States
    Wisconsin
    I'm pretty sure it's against the rules to link the (copyrighted) 3DS keys.
     
  13. Asia81
    OP

    Asia81 In my Ecchi World <3

    Member
    4,766
    2,277
    Nov 15, 2014
    France
    Albi
    WtF ?
     
  14. Fishaman P

    Fishaman P Speedrunner

    Member
    3,239
    505
    Jan 2, 2010
    United States
    Wisconsin
    Did you not understand this was a rule, or what's the deal?
     
  15. Asia81
    OP

    Asia81 In my Ecchi World <3

    Member
    4,766
    2,277
    Nov 15, 2014
    France
    Albi
    I know, but where i give a 3DS key oO ?
    My slot0x25KeyX.bin in the pack is not blank ?
     
  16. Fishaman P

    Fishaman P Speedrunner

    Member
    3,239
    505
    Jan 2, 2010
    United States
    Wisconsin
    That's not the issue.


    The page you linked to directly features a link to the copyrighted key. The fact it's not directly included doesn't matter.
     
  17. Asia81
    OP

    Asia81 In my Ecchi World <3

    Member
    4,766
    2,277
    Nov 15, 2014
    France
    Albi
    fail, removed.
     
  18. Fishaman P

    Fishaman P Speedrunner

    Member
    3,239
    505
    Jan 2, 2010
    United States
    Wisconsin
    Also, a little more subjective, but your "preview" of the key shows more than half of it.
    Showing a single random byte in the middle is fine, but showing the first 2 bytes, the last byte, and quite a few in between would be enough for me to delete it were I a mod.
     
  19. Asia81
    OP

    Asia81 In my Ecchi World <3

    Member
    4,766
    2,277
    Nov 15, 2014
    France
    Albi
    and now ?
     
  20. Fishaman P

    Fishaman P Speedrunner

    Member
    3,239
    505
    Jan 2, 2010
    United States
    Wisconsin
    :yay: