Tutorial  Updated

Dump Vertex and Fragment Shader code from Nintendo Switch Games

Okay, I don't understand why there's no tutorial about this. I am really thanked to @KillzXGaming and @gdkchan for helping me with this issue and of course, for making this possible.

Not all shaders work, but for most of them, you can get the code in a few steps.

upload_2019-8-22_1-48-6.png


What do you need?

- Ryujinx.ShaderTools: Download link (You can easily compile Ryujinx yourself too: https://github.com/Ryujinx/Ryujinx)
- Switch Toolbox (method 1): https://github.com/KillzXGaming/Switch-Toolbox
- HxD or your favourite hex editor (method 2): https://mh-nexus.de/en/hxd/
- Text Editor like Sublime Text: https://www.sublimetext.com/
- Decrypted switch games (RomFS format)

Step 1: Prepare your game

- Get the desired game (In this case Pokémon Let's Go Pikachu)
- Decrypt the game with your favourite method.
I recommend taking a look to these tutorials if you don't know how to do it: https://gbatemp.net/threads/decrypt...backup-loading-ryujinx-yuzu-in-1-click.506954 or https://gbatemp.net/threads/extract-nsp-nca-xci-update-all-in-one-tool-for-layeredfs.511156/

Step 2: Method 1 - Switch Toolbox

- Download Switch Toolbox from github and place it anywhere in your computer (you may have to install some packages. For more info, take a look to the github release info).
- Open Switch Toolbox. Click on File > Open.
- The files with extension .bnsh are shaders, so look for the .bnsh you wanna see the code and open it.
It's okay if the shader is called "name.bnsh_fsh" or "name.bnsh_vsh". "fsh" stands for Fragment Shader and "vsh" stands for Vertex Shader.
-
Open the visual folder structure by clicking on the "+" until you can see the Vertex Shader or Fragment Shader folder (after Shader Variation).

upload_2019-8-22_2-0-1.png


- Right click on the last one > Export Shader1.bin > save it anywhere in your computer. The name doesn't matter but it is recommended to save this file in ShaderTools folder (See step 3). Sometimes it's not shader1 but shader0, if one gives you error, try the other.

Step 2: Method 2 - HxD and manual file editing

- Open the .bnsh file with the hex editor (HxD in this case).
- All the shaders start with the hex values 78 56 34 12. Look for them.

upload_2019-8-22_2-13-48.png


- Count 0x30 bytes from that point.The shader code starts from there.

upload_2019-8-22_2-23-33.png


- Copy the data from there to the all zeros (can be the end of the file) to other new hex file.
- Save it as .bin. The name doesn't matter but it is recommended to save this file in ShaderTools folder (See step 3).

Step 3: See the code

- Go to the folder where you have the Ryujinx.ShaderTools.
- Open the cmd window with Windows + R > cmd or Shift + Right Click > Open CMD Prompt here.
- In the cmd window use the command:

(For FragmentShader) Ryujinx.ShaderTools f path/to/shader1.bin/relative/to/Ryujinx.ShaderTools folder.
(For VertexShader) Ryujinx.ShaderTools v path/to/shader1.bin/relative/to/Ryujinx.ShaderTools folder.

e.g, if the binary is in the Ryujinx Shader Tools folder:

Ryujinx.ShaderTools f fragmentShader.bin
Ryujinx.ShaderTools v vertexShader.bin

- if everything went well, the cmd window will display the code and you can copy it to your favourite text editor.
-Enjoy

Is there anything missing?

Leave a comment to know what I missed so we can help others too ^^

Credits:

- @KillzXGaming: Switch Toolbox
- @gdkchan: Ryujinx and huge help
- @PRAGMA: Romfs decrypting tutorial
- @huma_dawii: Other decrypting tutorial
 

Attachments

  • upload_2019-8-22_2-14-17.png
    upload_2019-8-22_2-14-17.png
    184.4 KB · Views: 478
  • upload_2019-8-22_2-23-18.png
    upload_2019-8-22_2-23-18.png
    184.7 KB · Views: 439
Last edited by Manurocker95,

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • BigOnYa
  • BakerMan
    I rather enjoy a life of taking it easy. I haven't reached that life yet though.
  • Veho @ Veho:
    Nobody is reading what you post.
  • Psionic Roshambo @ Psionic Roshambo:
    That Dell data breach is worse than people probably realize....
  • Psionic Roshambo @ Psionic Roshambo:
    When I worked for Dell we had access to data about military contracts and addresses for high ranking people.
  • Psionic Roshambo @ Psionic Roshambo:
    I personally handled a call from the second highest person at Raytheon. That call bothered me a lot... The guy was nice and smart what bothered me was the way management basically just blew him off instead of going the extra mile to help him.
  • Psionic Roshambo @ Psionic Roshambo:
    In the end that call ended up costing Dell millions in lost contracts with Raytheon, and really the issue could have been solved for like 450 bucks lol
  • NinStar @ NinStar:
    sometimes I wonder why anyone would ever buy mega man x legacy collection 2
  • NinStar @ NinStar:
    I always thought that capcom shuffled the games in these collection, but apparently they are all in chronological order, which makes legacy collection 2 worthless
  • BakerMan @ BakerMan:
    guys, i want to start singing pirate metal songs and sea shanties if i play sea of thieves
  • The Real Jdbye @ The Real Jdbye:
    find a pirate metal playlist
    +2
  • The Real Jdbye @ The Real Jdbye:
    and sing along
  • BakerMan @ BakerMan:
    nevermind i just learned swearing is against the rules in sea of thieves

    i was about to start singing the song i last put in "what song are you currently listening to" yesterday
  • BakerMan @ BakerMan:
    but yeah ig so
  • The Real Jdbye @ The Real Jdbye:
    swearing not allowed in a pirate game? what has the world come to
  • BakerMan @ BakerMan:
    (here's the song for context)
  • BigOnYa @ BigOnYa:
    Just add -izle to the end of every curse word, you will be fine.
    +2
  • The Real Jdbye @ The Real Jdbye:
    i like alestorm
    +1
  • The Real Jdbye @ The Real Jdbye:
    @BigOnYa too many syllables
    +1
  • BakerMan @ BakerMan:
    same lmao
  • BigOnYa @ BigOnYa:
    hi, welcome to the Temp!
    +1
  • BakerMan @ BakerMan:
    Welcome to the Underground!
    +1
  • BakerMan @ BakerMan:
    the booty boogie from (once again) the donkey kong country cartoon could also be a good song to sing while playing sea of thieves
  • BigOnYa @ BigOnYa:
    Please insert 25 cents for an additional 30 minutes of talk time.
    BigOnYa @ BigOnYa: Please insert 25 cents for an additional 30 minutes of talk time.