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:
- the latest release of pk3DS
- the latest release of Jisagi's PokeTool (Windows only!)
- the latest release of GodMode9
- the latest release of Zeta's dumping scripts
On your PC:
On your 3DS:
Section I - Dumping RomFS/ExeFS
- Power off your system and insert the SD card into your PC
- Put the script for your game type (digital or physical) in /gm9/scripts/on the root of your SD
- Insert your SD into your 3ds and boot into Godmode9 by holding 'Start' on boot
- Press the Home button
- Navigate to Scripts...
- 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 be00000000or a different number.
- 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
- Put romfsandexefsfrom/gm9/out/into an extra folder
Section II - Randomizing the game
- Launch pk3DS, and open the folder you put romfs and exefs into
- 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
- Open Poketool
- Select the game you want to randomize
- Select the backup folder of your game inside /pk3ds/backup/as "Backup Folder"
- Select the folder you dumped yourself (with the Godmode script) as "RomFS Folder"
- Hit Start to confirm your selection, PokeTool will create a folder with the titleID of your game and the required files for the randomization
- The titleID folder will be in the folder where PokeTool is
- Navigate to your SD card
- Navigate to /luma/titles/and copy the titleID folder there
- Insert your SD back into your device
- Boot into Luma Config by holding (Select) before pressing the power button
- Press (A) on Enable Game Patchingto 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
- Navigate to /luma/on your SD
- Inside, of /luma/create a folder namedtitlesif you don't have it already
- Inside of /luma/titles/create a folder with the TitleID of the game you want to randomize
- Inside of /luma/titles/TitleID, create a folder named romfs
- Inside of /romfs/create a folder nameda
- Navigate to the pk3ds folder, then go to /backups/the folder you randomized in pk3ds/a/
- Inside, you will find these files (filesizes and names can vary, please only use your own files as reference):
  
- The number in the brackets will show you their position in the romfs folder
- So for example, encdata (a083)is a file named3inside of/a/0/8/
- Navigate to romfs in your randomized folder
- Navigate to the file you randomized, and remember its location
- Inside of /romfs/ain your/luma/titles/titleIDfolder, create the path to your randomized files
- So for our example, you would create /0/8/in/a/and put3(aka encdata) in there
- Navigate to exefs in your randomized folder
- Copy .code(Can also be „code.bin“ or „.code.bin“ after pk3ds randomized it)
- Put that file into /luma/titles/TitleID, rename to code.binif needed
- XY/ORAS only:
- Copy DllPoke3Select.cro,DllField.croandDllBattle.crofrom/romfs/to/luma/titles/TitleID/romfs
- USUM and Sun/Moon only:
- Copy Shop.crofrom/romfs/to/luma/titles/TitleID/romfs
- Insert your SD back into your device
- Boot into Luma Config by holding (Select) before pressing the power button
- Press (A) on Enable Game Patchingto 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