How to randomize 3DS Pokémon games (LayeredFS)

This guide will show you how to randomize a Pokemon game without creating a new CIA.
This patch can be disabled any time.

What you will need:


Section I - Dumping RomFS/ExeFS

  1. Power off your system and insert the SD card into your PC
  2. Put the script for your game type (digital or physical) in /gm9/scripts/ on the root of your SD
  3. Insert your SD into your 3ds and boot into Godmode9 by holding 'Start' on boot
  4. Press the Home button
  5. Navigate to Scripts...
  6. Select the Script to dump your game
    • The script will ask you for the TIDlow of your game. You can find those IDs in the readme of the repository
    • Always overwrite files when prompted to
    • If your game is a digital copy, the scripts will prompt you to select the correct .app file. This is never 00000001. Your's might be 00000000 or a different number.
  7. After the the script has finished dumping both the base game and update, shut off your console and insert your SD back into your PC
  8. Put romfs and exefs from /gm9/out/ into an extra folder

Section II - Randomizing the game

  1. Launch pk3DS, and open the folder you put romfs and exefs into
  2. Randomize your game, remember what you randomized, pk3ds will save automatically
    • If prompted, decompress code.bin
    • If code.bin can't be found, rename .code in exefs to code.bin

Section III - Patching the game

Windows/Automated

  1. Open Poketool
  2. Select the game you want to randomize
  3. Select the backup folder of your game inside /pk3ds/backup/ as "Backup Folder"
  4. Select the folder you dumped yourself (with the Godmode script) as "RomFS Folder"
  5. Hit Start to confirm your selection, PokeTool will create a folder with the titleID of your game and the required files for the randomization
  6. The titleID folder will be in the folder where PokeTool is
  7. Navigate to your SD card
  8. Navigate to /luma/titles/ and copy the titleID folder there
  9. Insert your SD back into your device
  10. Boot into Luma Config by holding (Select) before pressing the power button
  11. Press (A) on Enable Game Patching to enable it and press (Start) to save and reboot
    • If this was enabled already, do not press (A) on it again

Mac and Linux/Manual

  1. Navigate to /luma/ on your SD
  2. Inside, of /luma/ create a folder named titles if you don't have it already
  3. Inside of /luma/titles/ create a folder with the TitleID of the game you want to randomize
  4. Inside of /luma/titles/TitleID, create a folder named romfs
  5. Inside of /romfs/ create a folder named a
  6. Navigate to the pk3ds folder, then go to /backups/the folder you randomized in pk3ds/a/
  7. Inside, you will find these files (filesizes and names can vary, please only use your own files as reference):
  8. The number in the brackets will show you their position in the romfs folder
    • So for example, encdata (a083) is a file named 3 inside of /a/0/8/
  9. Navigate to romfs in your randomized folder
  10. Navigate to the file you randomized, and remember its location
  11. Inside of /romfs/a in your /luma/titles/titleID folder, create the path to your randomized files
    • So for our example, you would create /0/8/ in /a/ and put 3 (aka encdata) in there
  12. Navigate to exefs in your randomized folder
  13. Copy .code (Can also be „code.bin“ or „.code.bin“ after pk3ds randomized it)
  14. Put that file into /luma/titles/TitleID, rename to code.bin if needed
  15. XY/ORAS only:
    • Copy DllPoke3Select.cro, DllField.cro and DllBattle.cro from /romfs/ to /luma/titles/TitleID/romfs
  16. USUM and Sun/Moon only:
    • Copy Shop.cro from /romfs/ to /luma/titles/TitleID/romfs
  17. Insert your SD back into your device
  18. Boot into Luma Config by holding (Select) before pressing the power button
  19. Press (A) on Enable Game Patching to enable it and press (Start) to save and reboot
    • If this was enabled already, do not press (A) on it again
Done! You can now launch your game, and it should be randomized!
This guide was written by Zeta. Also a big thanks to Jisagi for making PokeTool and olliz0r for testing! If you need assistance, you can join the Nintendo Homebrew Discord