Installing mods/hacks for Citra 3DS emulator

Discussion in '3DS - Tutorials' started by FriendlyHacker, Oct 19, 2018.

  1. FriendlyHacker
    OP

    FriendlyHacker Member

    Newcomer
    2
    Oct 19, 2018
    Italy
    127.0.0.1
    What you will need:

    - A decrypted .3ds file of the game you want to mod
    - The mod you want to install
    - 3DS to CIA by Katsu (python 2.7 required)
    - 3dstool
    - Citra 3DS Emulator (you won't need it to do the hacking, only to run the game afterwards)

    How to install the mod:

    0. Before you start, if you don't already have it, download Python 2.7 with the link provided and install it; also, if you use Windows you must add Python to the PATH Environmental Variable. (To check whether you need to do this last bit, type python in the command prompt and hit Enter: if you get the message ‘python’ is not recognized as an internal or external command, you need to add Python to PATH.)

    <!> Since many people are asking me about Fire Emblem Fates, namely adding the Same-sex Marriage patch by @UnassumingVenusaur, I'll use it as an example.

    1. Rename your .3ds to <filename_modified.3ds>. Extract the archives of both 3DS to CIA and 3dstool

    step1.

    2. Drag and drop your .3ds on Make2.07.bat in the 3DS to CIA folder you've previously extracted.

    step2.

    Wait until you get this window:

    step3.

    4. Leaving this command prompt (3ds_to_cia_2.07) open so you can later rebuild the game, go to the folder where the files have been extracted (don't move or delete the .3ds file which has been moved there) and copy the romfs file to the 3dstool directory which you've previously extracted.

    step4.

    5. To extract the romfs file, use the following command:

    3dstool -xvtf romfs romfs.bin --romfs-dir romfs

    If you're not familiar with using the command prompt, here is a quick walkthrough:

    +++++++

    To open the command prompt, go to Start and type "cmd" and open the program that comes up.

    step5.

    You'll get a black window. Type this in (including the first space): cd "path to the 3dstool folder on your computer goes here"
    Hit Enter, and you should get a string with the path to the 3dstool folder.
    For instance, on my pc, I type:

    C:\Users\Username> cd "C:\Giochi\Nintendo3DS\3ds hacking tools\3dstool"

    And I get:

    C:\3dstool>

    To extract the romfs file, use the command:

    3dstool -xvtf romfs romfs.bin --romfs-dir romfs

    Following the example above, it'll look like this:

    step6.

    To use the command, after you've copy-pasted 3dstool -xvtf romfs romfs.bin --romfs-dir romfs, hit Enter.
    Wait until 3dstool is done extracting the romfs.bin file. You'll know when it stops and the same string with the path to the 3dstool folder appears.

    step7.

    +++++++

    6. Keeping the console open so you can later rebuild the romfs file, delete the file you've extracted and go to the folder which contains the extracted files.

    step8.

    7. Depending on the mod, you'll now have to follow the instructions provided by the modder themselves, but generally you'll have to copy and paste the files provided by the modder (usually replacing the original ones). Modders often provide different folders for HANS, Luma and NTR CFW but the files inside are the same. Just use the HANS ones if you don't know which ones to choose, and remember to use the ones for your region (USA/EUR/JP)!

    In the case of FEF, copy the contents of the HANS version>Your region folder, and paste them in the romfs folder:

    step9.

    step10.

    8. Having applied the mod/hack, go back to the command prompt and use the following command to rebuild the romfs file:

    3dstool -cvtf romfs romfs.bin --romfs-dir romfs

    step11.

    9. Replace the modified romfs file with the one in the extracted folder.

    step12. step13.

    10. Go back to the 3ds_to_cia_2.07 window from step 3, press 6 (Rebuild 3DS) and then s to start

    step14.

    Wait until the rebuilding is done. (The process is pretty long and heavy, you likely won't be able to do anything else in the meantime.)

    step15.

    step16.

    step17.

    You should get two folders with your original file and the modded one respectively. Done!

    step18.

    POSSIBLE ERRORS

    An issue people who use Windows 10 have run into is the batch file (3ds to cia; step 2) not running at all (opening and closing right after). This may be caused by encoding.
    If you've got notepad++ (or if you don't, you can find it among the 3ds to cia "tools": 3ds_to_cia_v2.07\tools\n++), you can open the batch file for editing with it and check "Encoding". If anything else besides UTF-8 (or ANSI) is selected, you should select UTF-8 (without BOM) and save the file.

    Most errors occur when rebuilding the .3ds file (step 10), and they're mostly related to the rsfgen.py script and Python by extension.

    error.
    If you get this error up here, it means you have Python 3.5 installed, and it's being used to run the script instead of Python 2.7
    Other instances:
    - You don't have Python installed
    - [Windows] Python's directory hasn't been added to the PATH e.v. (see Step 0)
    - Python is not selected as the program to open .py files. If this happens, Pythonw.exe might have been selected to open .py files, while it should be Python.exe. In this case a white window with the script will appear, and once you close it, you'll get the fateful ERROR. You'll have to change the default program to open .py files to the correct one.

    error pythonw.
    (If you see this the default program used to open .py files is pythonw.exe, you need to change it to python.exe)

    In case you experience any other issues, tell me and I'll help you out!

    -------

    If you have any questions, feel free to ask!

    Credits go to the creators of Citra, 3DS to CIA and 3dstool. Thank you!
     
    Last edited by FriendlyHacker, May 11, 2019
  2. Lglaplante

    Lglaplante Pkmn Rom Hacker

    Member
    3
    Feb 12, 2017
    Canada
    Quebec
    actually, 3dstool isn't needed for the most part, since you can just extract, mod, and rebuild the rom directly, but that's a good tutorial anyway
     
  3. FriendlyHacker
    OP

    FriendlyHacker Member

    Newcomer
    2
    Oct 19, 2018
    Italy
    127.0.0.1
    Oh, I'm sorry about that, it's just the method I used among all the possible ones. ^_^
    There are many tools out there one could use instead, but I found that 3dstool works like a charm for Japanese games because it supports unicode characters (which are often used in filenames), and not all tools do.
    I wasn't sure if 3ds to cia supported unicode characters or not so I used this method to be on the safe side just in case. :)
     
  4. Astragon

    Astragon Advanced Member

    Newcomer
    2
    Feb 13, 2017
    United States
    Okay, so I'm using the Karameru archive extractor to open up and mod Fire Emblem Fates to play the Good Guy Garon mod on Citra. The vanilla game runs just fine on Citra. But the mod only alters the cutscenes and dialogue between levels, nothing else, and yet the game opens but doesn't run at all on Citra.

    What am I doing wrong here?

    The only bit I think I might have not done right that you stated here was renaming the game to "filename_modified.3ds", but since I'm not using 3dstool I'm not sure if that's even necessary.

    I'm also interested in trying to run Pokemon Supernova Sun or Penumbra Moon in the future on Citra.
     
    Last edited by Astragon, Nov 20, 2018
  5. FriendlyHacker
    OP

    FriendlyHacker Member

    Newcomer
    2
    Oct 19, 2018
    Italy
    127.0.0.1
    Hi there! If you use 3DS to CIA, renaming the file that way is needed so that 3DS to CIA can recognize your .3ds file as a decrypted file. If you don't do that you can't extract & rebuild it properly, as the program assumes your file is encrypted by default.
    Try renaming it to something like "FireEmblemFates_modified.3ds", extracting and rebuilding with 3DS to CIA and let me know if it works! (by the way I also modded both Fates and Awakening using this exact method so they should work!)

    As for the Pokémon games they should run without any problems since the person who made those hacks has run them on Citra as well.

    EDIT:
    I tried the method I described to install the Good Guy Garon hack and it works!
    However, since I have the EUR edition I had to change the name of the directories in the hack's files from romfs\m\@E and romfs\m\B\@E to romfs\m\@U and romfs\m\B\@U. Then I copy-pasted them in the romfs folder (replacing the files) and rebuilt the romfs.bin and .3ds. Citra runs it just fine, so you shouldn't have any problems making it work if you use this method. Please try it and let me know if you still have trouble!
     
    Last edited by FriendlyHacker, Nov 21, 2018
  6. Astragon

    Astragon Advanced Member

    Newcomer
    2
    Feb 13, 2017
    United States
    I'm not using 3ds to CIA and vice versa.

    Karameru allows me to open up the 3ds file directly and alter it if I desire.

    I have the US .3ds file for FE Fates, and in the mod there are files are "m/@E" and "m/B".
     
  7. FriendlyHacker
    OP

    FriendlyHacker Member

    Newcomer
    2
    Oct 19, 2018
    Italy
    127.0.0.1
    I've used Karameru (and its siblings) for other things but for some reason I haven't managed to make it work for extracting+rebuilding purposes, so if you insist on using it, I can't help you there, I'm sorry!
    I've tried installing the GGG mod for Fates using Karameru and had the exact same problems you've run into. Either there is something specific we should do to make it work, or the program doesn't rebuild the GameData.cxi file or the .3ds file the way it should.
    I know this tutorial sounds like it's a lot of work, but it's not really. If you use the method I described you won't get a .cia file instead of a .3ds file, you'll simply get a modded .3ds file which will run on Citra without any problems.
    If you still don't like it and don't want to try using it, I'm sorry I couldn't help you out!
     
    Last edited by FriendlyHacker, Nov 25, 2018
  8. Peyton

    Peyton Newbie

    Newcomer
    1
    Dec 16, 2018
    United States
    Okay, I made it up to four but five is really confusing me as I have zero experience working with this kind of stuff. If you could explain step by step, I'd really appreciate it. Thank you so much for this tutorial.
     
  9. FriendlyHacker
    OP

    FriendlyHacker Member

    Newcomer
    2
    Oct 19, 2018
    Italy
    127.0.0.1
    Hi, sorry for the late reply! You're welcome, I hope this method will help you! :)

    So, to open the command prompt, go to Start and type "cmd" and open the program that comes up. You'll get a black window. Type this in (including the first space): cd "path to the 3dstool folder on your computer goes here"
    Hit Enter, and you should get a string with the path to the 3dstool folder.
    For instance, on my pc, I type:

    C:\Users\Username> cd "C:\3dstool"

    And I get:

    C:\3dstool>

    To extract the romfs file, use the command:

    3dstool -xvtf romfs romfs.bin --romfs-dir romfs

    Following the example above, it'll look like this:

    C:\3dstool>3dstool -xvtf romfs romfs.bin --romfs-dir romfs

    To use the command, after you've copy-pasted 3dstool -xvtf romfs romfs.bin --romfs-dir romfs, hit Enter.
    Wait until 3dstool is done extracting the romfs.bin file. You'll know when it stops and the same string with the path to the 3dstool folder appears.
    Keep this window open so you can later rebuild the romfs file (step 8), and delete the romfs.bin file you've just extracted (because you'll rebuild it later and it'd only get in the way).

    Step 8 is identical, the only difference is the command used.

    If you find anything to be not clear or have any more questions, feel free to ask!
     
    Last edited by FriendlyHacker, Dec 24, 2018
  10. Miguel Gomez

    Miguel Gomez GBAtemp Addict

    Member
    8
    Jan 10, 2016
    Planet Earth
    FriendlyHacker likes this.
  11. FriendlyHacker
    OP

    FriendlyHacker Member

    Newcomer
    2
    Oct 19, 2018
    Italy
    127.0.0.1
    Thank you for reading this and sharing another method!
    If a different way of doing this works better for someone (or for a specific game), then by all means it should be included and shared!
    Thank you, feel free to edit the initial post if you want to!

    On that note, @Fishmalk has written another method for installing hacks to run on Citra which is worth checking out!
     
    Last edited by FriendlyHacker, Dec 24, 2018
  12. RobinThePhoenix

    RobinThePhoenix Newbie

    Newcomer
    1
    Dec 26, 2018
    Ireland
    Hello, I really appreciate the tutorial you've done but im just not great at programming :/ I thought I had everything done right but I think I'm missing something obvious. Thats the error I keep getting. Any help would be greatly appreciated!
    Screenshot (10).
     
  13. FriendlyHacker
    OP

    FriendlyHacker Member

    Newcomer
    2
    Oct 19, 2018
    Italy
    127.0.0.1
    I assume your .3ds file is not decrypted. This tutorial skips the dumping & decrypting part which many nice people described in different guides and tutorials. You can try looking it up on this site. Or I guess... if you got your .3ds file on that site, then look for "decrypted for Citra" or smtg along those lines in the download...
     
    Last edited by FriendlyHacker, Dec 26, 2018
  14. RobinThePhoenix

    RobinThePhoenix Newbie

    Newcomer
    1
    Dec 26, 2018
    Ireland
    The file runs on citra before I start doing any of the modifying so i believe its decrypted? I used Batch CIA 3DS Decryptor, do I need to do it a different way instead cause then I'll try one of the tutorials on here. Also thanks for replying so quickly :)
     
  15. FriendlyHacker
    OP

    FriendlyHacker Member

    Newcomer
    2
    Oct 19, 2018
    Italy
    127.0.0.1
    Ok, I'm very very very sorry about not mentioning this before... do you have Python 2.7? If not, that may be what causes the error! (Again, I'm really really sorry about not writing this anywhere and assuming everyone to already have Python... sorry) It's said in Katsu's post that you need to have python 2.7 installed (in C:\python27 I believe).
     
    Last edited by FriendlyHacker, Dec 26, 2018
  16. RobinThePhoenix

    RobinThePhoenix Newbie

    Newcomer
    1
    Dec 26, 2018
    Ireland
    I think that's it! I don't have it so I'll give that a go. Don't worry about it thank you so much for taking the time to do this!
     
    FriendlyHacker likes this.
  17. RobinThePhoenix

    RobinThePhoenix Newbie

    Newcomer
    1
    Dec 26, 2018
    Ireland
    Yep that was it knew i was missing something stupid! Once again thanks so much for the tutorial and help, cant wait to play!
     
  18. FriendlyHacker
    OP

    FriendlyHacker Member

    Newcomer
    2
    Oct 19, 2018
    Italy
    127.0.0.1
    You're welcome, I'm glad it works for you! Thank you for your patience! :)
     
  19. Orsin456

    Orsin456 Newbie

    Newcomer
    1
    Jan 3, 2019
    United States
    Quick question, do i need to also replace certain files such as: .code.bin, banner.bin, icon.bin, etc?

    Another words, I typically see the main folder I need to replace (romfs) that is included in the mod. But my concern is that i see other things as well. What should i do?
     
  20. FriendlyHacker
    OP

    FriendlyHacker Member

    Newcomer
    2
    Oct 19, 2018
    Italy
    127.0.0.1
    Usually you don't have to touch the other .bin files unless the mod creator stated so. From my experience, hackers usually change files only within the romfs.bin file. (I hope I understood your question correctly)
     
Loading...