Jump to content
  • Shiny Rate 100% (for non-shiny locked) via code.bin editing

    2011-04-04_17-59-48.960_top.png2011-04-04_18-11-37.784_top.png2011-04-04_18-29-11.702_top.png2011-04-04_20-05-06.163_top.png
    Images above are from XY, ORAS, SM and USUM, respectively.

    Disclaimer
    This guide requires a hacked 3DS, and will use Luma3DS LayeredFS to achieve the desired result.
    For non-shiny locked entries, this shiny patch will shinify wild encounters, static encounters, gifts, fishing, eggs when received from breeder, and wonder card redemptions.

    Note: this ROM patch may affect some event redemptions that were not meant to be shiny. Wonder cards that have preset/fixed PID may get their PID overwritten and end up being shiny. Those specific cases will be illegal. (I experienced this with Ash-Greninja)

    Unlike shiny patches of previous generation games, these Pokémon retain their shininess even when transferred to games that do not have the shiny patch.

    While PK3DS does have a shiny rate editor, this guide is for people who somehow can't get it to work (maybe computer compatibility issues, unable to extract all the necessary files from the games, etc), or simply doesn't like to use it.

    We will not be providing any exefs.bin or code.bin, as linking to or providing data files extracted from ROMs are against our forum's rules.
    However do not fear, as the steps regarding how to extract them from your own purchases, are included in this guide.
     

    Additional Misc. Info
    While it is possible to compile the edited code.bin into a .3DS/.cia, that is not the focus of this tutorial.
    Do note that if you're running a version of the game that is updated (i.e you have the update patch installed), you'll have to dump the exefs.bin of the update patch instead. Instructions for this step is included below as well.
    If you have the update patch installed, and you use the exefs.bin/code.bin from the main game (instead of the one in the update patch), it will definitely result in a crash when the game is being loaded.


    Additionally, this patch will not work on any entries that's shiny locked, and it also won't work on entries that use a different method of generating their PIDs, such as non-legends/non-UB wild Wormhole encounters, Partner Cap Pikachu, Poké Pelago etc.


    The 4 easy steps:
    1. Extracting the exefs.bin
    2. Decompressing exefs.bin to obtain the decompressed code.bin
    3. Performing the edit
    4. Pasting the code.bin into Luma

     

    Extracting the exefs.bin

    Spoiler

    1. Have GodMode9 on your SD card.
    (gm9 folder on SD root, GodMode9.firm in luma/payloads)

    2. Hold down the START button while booting 3DS, and launch into GodMode9
    image002.png
    default screen for the [root] folder

    3. On top screen, go to SYSNAND SD, and enter the folder
    I am not sure if EMUNAND SD actually appears as an option if you have EMUNAND.
    If it does, and your game/update is installed on EMUNAND, then go to that option.

    Also, if your only copy of the game is on a cart AND if you play the game without any game updates installed, follow the steps (3a to 3f) in the spoiler below.
    Else, ignore the content in the spoiler directly below and go to step (4).

    Spoiler

    3a. With the cart inserted, top screen, open GAMECART
    image.png

    3b. Top screen, choose {name}.3ds and press the A button
    (not the -priv, trim nor split one)
    snap000.png

    3c. Bottom screen, NCSD image options...
    image.png

    3d. Bottom screen, Mount image to drive
    image.png

    3e. Top screen, open content0.game folder
    snap001.png

    3f. At this step, exefs.bin can be seen. Skip to step 11 to continue.
    snap002.png


    4. On top screen, navigate to title, and enter the folder

    5. On top screen: if you're playing the game without a game update, navigate to 00040000
    If you're playing the game and have a game update installed, navigate to 0004000e
    image003.png
    inside the title folder.

    6. On top screen, navigate to the folder that has the game ID that represents the game you're trying to extract from:

    Game Name Game ID
    Pokémon X 00055D00
    Pokémon Y 00055E00
    Pokémon Omega Ruby 0011C400
    Pokémon Alpha Sapphire 0011C500
    Pokémon Sun 00164800
    Pokémon Moon 00175E00
    Pokémon Ultra Sun 001B5000
    Pokémon Ultra Moon 001B5100

    image004.png
    Example of hovering over Omega Ruby folder

    7. On top screen, enter the content folder
    image005.png
    example of the inside of Omega Ruby folder

    8. On top screen, go to the {some digits}.app that has a larger file size, and press the A button once. Options will appear on the bottom screen.
    image006.png
    The {some digits}.app can be seen

    9. On bottom screen, select NCCH image options...

    10. On bottom screen, Mount image to drive
    image.png

    11. On top screen, navigate down to exefs.bin, and press the Y button once. (This copies the exefs.bin file)
    image007.png
    Hovering over exefs.bin on top screen, and button options on bottom screen

    12. Keep pressing the B button until you get back out into the root folder. (Top screen, shows [root], SDCARD, SYSNAND etc)
    image001.png
    Back at [root] folder, hovering over SDCARD

    13. On top screen, enter SDCARD

    14. Choose a folder you want to paste into, then press the Y button once. (This pastes the exefs.bin into the folder you entered)
    Bottom screen will ask you if you want to paste the file into this folder. Press the A button once, to confirm.

    15. Once pasting is done, hold down both the R bumper/shoulder button and the START button simultaneously, to shutdown the 3DS.

    16. Now, take the SD card out of your 3DS and copy the exefs.bin file over onto your Computer.


    Decompressing exefs.bin to obtain the decompressed code.bin

    Spoiler

    1. On your computer, create a CTRtools folder.

    2. Download CTRtools and extract it into that folder.

    3. Paste the exefs.bin into the CTRtools folder.
    Ensure the file is named exefs.bin (all small capitalization)

    4. If you're running windows (or if you have Wine on your Linux machine), I've prepared a batch file to go along with this tutorial. Paste it into the same CTRtools folder.
    extract exefs.bat
    If you're not on windows (or if you don't have Wine on your Linux machine), you can ignore the batch file.

    At this stage, the folder will looks like this:
    image.png

    5. If you're on Windows (or Wine+Linux), run the extract exefs.bat.
    If you're not on Windows (or no Wine+Linux), simply use a command window to run:
    ctrtool.exe -t exefs --exefsdir=exefs exefs.bin --decompresscode

    6. Check that an exefs folder appeared, and there's a code.bin inside that folder.
    image.png


    Performing the edit

    Spoiler

    1. Download a Hex Editor. I'll be using the program HxD

    2. Open the code.bin in the Hex Editor.

    3. Find/Search for this string, in Hex Values/Bytes
    String:
    21 E2 03 20 92 E1 1C
    image.png

    4. Once found, modify the closest 0x0A to 0xEA (specifically, it'll be the same distance away, as per seen below)
    image.png

    5. Now save the code.bin
    image.png


    Pasting the code.bin into Luma

    Spoiler

    1. With your 3DS' SD card plugged into your computer, navigate to the folder Luma/titles
    If the folder titles doesn't exist, create it inside the Luma folder.

    2. Check that the folder that named after your wanted game ID exists. If the folder doesn't exist, create it.

    Game Name Full Game ID
    Pokémon X 0004000000055D00
    Pokémon Y 0004000000055E00
    Pokémon Omega Ruby 000400000011C400
    Pokémon Alpha Sapphire 000400000011C500
    Pokémon Sun 0004000000164800
    Pokémon Moon 0004000000175E00
    Pokémon Ultra Sun 00040000001B5000
    Pokémon Ultra Moon 00040000001B5100

    Here's a look at what my folder looks like:
    image.png

    3. Go into the folder that has your game ID, and paste the edited code.bin into it.
    Example:
    image.png
     

    4. Reinsert the SD card into your 3DS

    5. Hold down SELECT button while booting 3DS.
    Ensure this option is checked.
    image.png


    Congratulations, shinies await you!
    2011-04-04_20-04-36.971_top.png2011-04-04_16-25-45.668_top.png

     

    Original source of this method is from our one and only, @SciresM.
    This method was adopted from his tweet back during Pokémon Sun & Moon's release.
    It took me a while, but I've come to realize the leading bytes were exactly the same across the 3DS Pokémon games, making this method work for Gen 6 and 7 3DS games.
    sciresm shiny.PNG

     

     

    POST TUTORIAL EDIT:
    It appears extracting the .code.bin directly from the exefs folder in GodMode9 works, bypassing the entire requirement of ctrtools

    • Like 1
    • Thanks 2



    User Feedback

    Recommended Comments



    My only question is that every time I try to run the 'extract exefs' batch file, nothing happens and I do not get the exefs folder or bin files that are inside of it. I think it's just because maybe some stuff is outdated but I can't find anything else to help me.. everything else is working fine though, just can't get the 'extract exefs' to work and I also really don't know what to do with the 'ctrtool' application lol. Maybe that is also an issue. Thank you for your time.

    Share this comment


    Link to comment
    Share on other sites

    If I’m not mistaken GodMode9 should allow you to decompress ExeFS by allowing you to enter it like a folder, then copy paste the code.bin

    you could give that a try in the mean time. I’ll take a look in my free time when I get around to it.

    Share this comment


    Link to comment
    Share on other sites

    I'm going to be honest, I don't really know what that means hahaha. I'm sorry, but I appreciate your help. Take as much time as you need. I know nothing about any of this homebrew stuff and it's my first time!

    Share this comment


    Link to comment
    Share on other sites

    17 minutes ago, FireBirdeez said:

    I'm going to be honest, I don't really know what that means hahaha. I'm sorry, but I appreciate your help. Take as much time as you need. I know nothing about any of this homebrew stuff and it's my first time!

    Step 3f of Extracting ExeFS.

    instead of copying the bin, go into the folder that is 2 entries above it.

    Share this comment


    Link to comment
    Share on other sites

    Okay, so I'm supposed to enter the ExeFS directory 2 above the ExeFSbin. Then what? 

     

    Do I copy the '.code' and put that into HxD? Or am I supposed to do something else. I'm sorry this is so difficult.

     

    Okay so this is what I see. I put the '.code' into the HxD program. So I replace the nearest A0 with EA?xAzseqT.png

    Share this comment


    Link to comment
    Share on other sites

    37 minutes ago, FireBirdeez said:

    Okay, so I'm supposed to enter the ExeFS directory 2 above the ExeFSbin. Then what? 

     

    Do I copy the '.code' and put that into HxD? Or am I supposed to do something else. I'm sorry this is so difficult.

     

    Okay so this is what I see. I put the '.code' into the HxD program. So I replace the nearest A0 with EA?xAzseqT.png

    Not A0, 0A. Refer to the original picture of mine, should only be 2 spaces behind. 
    Hmm, does the values to search exist again in the hex?

    Share this comment


    Link to comment
    Share on other sites

    Hmmm. There are 0As in multiple places but I think they're all pretty far from the string highlighted. Let me detail what I did. I went into gm9. Then I went the section in step 3f. From there I went to the ExeFs directory and copied the '.code' from it and pasted it into my general SD card settings where everything else is stored. I then put the file into HxD and this is now what you see. Did I do a step previously wrong?

    Captur2.PNG

    Edited by FireBirdeez

    Share this comment


    Link to comment
    Share on other sites

    4 hours ago, FireBirdeez said:

    Hmmm. There are 0As in multiple places but I think they're all pretty far from the string highlighted. Let me detail what I did. I went into gm9. Then I went the section in step 3f. From there I went to the ExeFs directory and copied the '.code' from it and pasted it into my general SD card settings where everything else is stored. I then put the file into HxD and this is now what you see. Did I do a step previously wrong?

    Captur2.PNG

    Maybe it’s not decompressed, hence why it’s not showing the 0A properly

    Share this comment


    Link to comment
    Share on other sites

    18 hours ago, theSLAYER said:

    Maybe it’s not decompressed, hence why it’s not showing the 0A properly

    Ahh okay. Can you please explain to me how to decompress it? The programs you have given me like the batch file don't work for me.. are there any alternatives? Also, not blaming you for the files not working!!!

    Edited by FireBirdeez

    Share this comment


    Link to comment
    Share on other sites

    sigh i did everything right but i had to improvise.

    wine ctrtool.exe -t exefs --exefsdir=exefs exefs.bin --decompresscode Did Not Work, Threw: [tc::cli::OptionParser ERROR] Option parameter was provided without an option.
     

    So Instead I Did wine ctrtool.exe -t exefs --exefsdir=exefs --decompresscode exefs.bin Which Did Work. It Successfully Decompiled But I Have A Different Issue Now.


    EDIT:
    If Your Wondering Why I Didn't Use The Batch File Ill Read The Error: 0009:err:module:__wine_process_init L"C:\\windows\\system32\\extract.exe" not found(yes i tried adding a official extract.exe but no luck) So I Just Used The Program Directly.

    Anytime I Try Running The Code.Bin(edited version with 0A --> EA) It Crashes On Game Boot Up. I Don't Think I Did Anything Wrong So Why Is It Crashing? Does It Have To Do With It Being A Game Cart? I Don't Know But Its Annoying For The Amount Of Time I Put Into Getting That Modified Code File.

    Edit 2: I Updated The Correct File This Time XD (the update file) It Now Works x) Sorry For Being An Idiot And Not Reading Properly. But Can I Ask A Question If I May? Why Does The Game Crash If The Update File Is Installed And You Attempt To Modify The Game? Does It Have To Do With Conflicting Code?

    Edited by Zeninari

    Share this comment


    Link to comment
    Share on other sites

    Really appreciate for this nice tutorial, just one add up that, I looked up the helper info for ctrtool, for mac arm64 version, the command should be, which put all options before the file name. Thanks!

    ./ctrtool -t exefs --exefsdir=exefs --decompresscode exefs.bin

     

    Share this comment


    Link to comment
    Share on other sites

    Hello, I'm trying to do this and I got to the step with the exefs, CTRtool, extract exefs, and makerom all in the ctrtools folder and no matter what I've tried I cannot decompress the file the way shown in the tutorial. I tried dumping the game off my 3ds and using packhacks to extract the code.bin that way and searched for that series of digits and couldn't find it anywhere I tried on two games and unsuccessful on both. Any help would be greatly appreciated 👍

     

    Share this comment


    Link to comment
    Share on other sites

    4 hours ago, Jmscheuer said:

    Hello, I'm trying to do this and I got to the step with the exefs, CTRtool, extract exefs, and makerom all in the ctrtools folder and no matter what I've tried I cannot decompress the file the way shown in the tutorial. I tried dumping the game off my 3ds and using packhacks to extract the code.bin that way and searched for that series of digits and couldn't find it anywhere I tried on two games and unsuccessful on both. Any help would be greatly appreciated 👍

     

    Yeah there were times I randomly had issues with packhacks a while back, and I have no idea why. As much as it is a great combination of tools, don't use packhacks for this tutorial.

    Only grab CTRtool from the link I've provided.
    Only dump your game files from your 3DS and grab exeFS from there (I'm under the impression you're trying that with packhacks, else why would you need it?).
    Also, make sure you decompress the bin before searching for the values

     

    On 7/28/2022 at 9:13 PM, Zeninari said:

    Why Does The Game Crash If The Update File Is Installed And You Attempt To Modify The Game? Does It Have To Do With Conflicting Code?

    Because the game uses the code.bin to do stuff. and LayeredFS forces the code.bin you placed to load first.
    So let's say the game has v1.4 game files, and other v1.4 instructions to run, but you force it to run a v1.0 code.bin,  naturally stuff is only going to partially loaded incorrectly, the game won't have all resources loaded correctly, and won't be able to function. Thus crash.

    Pretty much why I specified if you have a game update, gotta use the game update's code.bin..

    I experienced the crash firsthand myself, had to guess why it was even happening ><

    Share this comment


    Link to comment
    Share on other sites

    15 hours ago, theSLAYER said:

    Yeah there were times I randomly had issues with packhacks a while back, and I have no idea why. As much as it is a great combination of tools, don't use packhacks for this tutorial.

    Only grab CTRtool from the link I've provided.
    Only dump your game files from your 3DS and grab exeFS from there (I'm under the impression you're trying that with packhacks, else why would you need it?).
    Also, make sure you decompress the bin before searching for the values

     

    Because the game uses the code.bin to do stuff. and LayeredFS forces the code.bin you placed to load first.
    So let's say the game has v1.4 game files, and other v1.4 instructions to run, but you force it to run a v1.0 code.bin,  naturally stuff is only going to partially loaded incorrectly, the game won't have all resources loaded correctly, and won't be able to function. Thus crash.

    Pretty much why I specified if you have a game update, gotta use the game update's code.bin..

    I experienced the crash firsthand myself, had to guess why it was even happening ><

    So I did that I followed the guide exactly. I if try to decompress the file nothing works if I run cmd prompt and try to run it I get any number of errors and If I run the extract exefs batch file you provided, it appears for half a second then dissapears and I'm not sure what make ROM does but I can't get that to work either ill tag my pics maybe you have insight to what Im doing wrong

    1675558270966962026990004395488.jpg

    16755583799683153811108053484244.jpg

    16755583907608414200565238558185.jpg

    Share this comment


    Link to comment
    Share on other sites

    3 hours ago, theSLAYER said:

    @Jmscheuer I believe CTRtool changed it's structure between when I posted the tutorial and now.

    Maybe give this bat a try. Same instructions as the tutorial but try this bat instead. Let me know how it goes.

    extract exefs 05-02-23 test.bat 60 B · 2 downloads

    So I just downloaded the file and added it to the ctrtools folder. When I click run as administrator or I try to open the exefs file with the batch file a screen opens for a second then dissapears. Does PP support videos if I took one? 

    Share this comment


    Link to comment
    Share on other sites

    1 hour ago, Jmscheuer said:

    So I just downloaded the file and added it to the ctrtools folder. When I click run as administrator or I try to open the exefs file with the batch file a screen opens for a second then dissapears. Does PP support videos if I took one? 

    I've seen that happen before. No videos necessary.
    Grant administrator access to the files.

    To confirm, you're double clicking on the bat, and nothing happens?
    And no new folders nor files appear?

    If it still doesn't work, do the same things with this file:
    extract exefs 05-02-23 test 2.bat

    At this point I'm just throwing random bats at the problem.

    Share this comment


    Link to comment
    Share on other sites

    2 minutes ago, theSLAYER said:

    I've seen that happen before. No videos necessary.

    Right click > Properties on the .bat, and unblock.
    Just to be sure, you're dragging the exeFS onto the .bat file, right?

    And no new folders nor files appear?

    Yep I had it unblocked and no new folders appear :(. I re dumped my file off my 3ds in the off chance I had a corrupted or bad file and no dice with either 

    Share this comment


    Link to comment
    Share on other sites

    6 minutes ago, Jmscheuer said:

    Yep I had it unblocked and no new folders appear :(. I re dumped my file off my 3ds in the off chance I had a corrupted or bad file and no dice with either 

    sorry I made an edit to that post, do check it out

    Share this comment


    Link to comment
    Share on other sites

    9 minutes ago, theSLAYER said:

    sorry I made an edit to that post, do check it out

    It's the same thing but the screen showed up for a second longer than usual. It was the command prompt with the pathway but it quickly disappeared completely unfortunately it goes away too quickly to get a picture 

    Share this comment


    Link to comment
    Share on other sites

    @Jmscheuer can you use the printscreen function on your keyboard, or alternatively the snipping tool loaded into modern Windows computer, and show me a screenshot of the contents of your files in your folder?

    Share this comment


    Link to comment
    Share on other sites

    5 minutes ago, theSLAYER said:

    @Jmscheuer can you use the printscreen function on your keyboard, or alternatively the snipping tool loaded into modern Windows computer, and show me a screenshot of the contents of your files in your folder?

    Is this good? 

    Screenshot 2023-02-04 223940.png

    Share this comment


    Link to comment
    Share on other sites

    11 minutes ago, Jmscheuer said:

    Is this good? 

    Screenshot 2023-02-04 223940.png

    okay let's try to do this manually then.

    Go to your Windows > Run > CMD > Right click on Program, run as administrator.

    Then cd <your current directory>
    You should notice the command line change to the current folder

    If you type ctrtool and hit enter, you should get the entire spiel of "not enough arguments" as seen earlier.
    Lemme know when you reach there

    Share this comment


    Link to comment
    Share on other sites

    5 minutes ago, theSLAYER said:

    okay let's try to do this manually then.

    Go to your Windows > Run > CMD > Right click on Program, run as administrator.

    Then cd <your current directory>
    You should notice the command line change to the current folder

    If you type ctrtool and hit enter, you should get the entire spiel of "not enough arguments" as seen earlier.
    Lemme know when you reach there

    I typed CD and got this 

    16755806495129164904903531501384.jpg

    Share this comment


    Link to comment
    Share on other sites

    3 minutes ago, Jmscheuer said:

    I typed CD and got this 

    16755806495129164904903531501384.jpg

    cd <the directory containing your ctrtool>

    Open your folder, click the hotbar once, and it should chance to C:\Users\...etc...

    Now copy that, and paste is after the cd

     

    Also when possible, use the snipping tool or a screenshot. Better than a photo from your phone.

    Share this comment


    Link to comment
    Share on other sites




    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...