Tutorial  Updated

How to compile and use pkNX for Sword and Shield

(This is the same as from my GameBanana page)

This tutorial assumes you have intermediate knowledge of installing software and navigating common computer tasks, as well as navigating your hard drive. To be blunt, if these prerequisite skills are out of reach then perhaps using unreleased software is a bit irresponsible.
Also, I of course do not take responsibility for any issues or damage to any of your equipment.

Also, right click images and open them in a new window to see them larger.

Step 1: Installing Visual Studio 2019
Do you know how to run an installer? Good. Do that.

Go to this page and download Visual Studio Community 2019. Not Visual Studio Code. When installing just go through the process like normal. If asked, all you need to install is this package:
UplfXiW.png

Everything else can be left as default.


Step 2: Cloning the source code

bLt1ll7.png
Open Visual Studio 2019 and click on "Clone or check out code" on the right-hand side.
CvkxC0c.png
Enter this URL: https://github.com/kwsch/pkNX
Keep all of the other options default, just click "Clone."


Step 3: Compiling the source code

All of PPorg's software is dead-simple to compile. After the GitHub repo is finished being cloned by VS 2019, you will see a window similar to this:
iDqmyQ7.png
On the right-hand side of the screen, right-click on "pkNX.sln"
43qaoil.png
Click "Build"
VhHIM5Z.png

Step 4: Finding your binary
Depending on how fast your computer is, it will take a certain amount of time for the binary file to compile. When it is done, the bottom of the VS 2019 window will tell you "Build Succeeded" and also tell you where the actual .exe is.
X77WkPO.png
Assuming that you kept all other options as default, the steps below will help you find it.
Hit the Win+R keys on your keyboard to open the "Run" prompt. In it, type Source like so:
x9HExMA.png


In Windows Explorer, open repos, then pkNX, then pkNX.WinForms, then bin, then Debug.
hQwOmhf.png


This is your pkNX binary. These files need to be kept together. You can move them wherever you want on your hard drive, but they need to be together.

Step 5: Setting up your game files for pkNX
Obtain your Pokémon Sword or Shield romfs. Dump it yourself. Obtaining it is not in the scope of this guide.

When you have your romfs, you must structure them in a very specific way for pkNX to accept it. This is the best way to do it, using Sword as an example:

Have a top-level folder named Pokemon [Game]
Fm8uvlf.png

Inside of that folder you put your clean, unedited romfs.
In the same directory as the romfs folder, you need to have an exefs folder.
It can be completely empty, but it needs to be there.

Et5FQcX.png


Step 6: Using pkNX
Open your brand-new pkNX.exe and drag your top-level Pokemon Sword folder onto the window. It will load it in.

Using all of the actual elements of the tool is a bit complicated and outside of the scope of this guide, but what you need to know is this:
When you make your edits, the tool is keeping track of everything you changed. When you close pkNX, the software writes a file with the titleID of the game next to the romfs and exefs folders from step 5
yKCwGeh.png

This file gets loaded in with Atmosphere LayeredFS and is all you need to use your mod. You never need to actually edit the romfs folder.

When opening pkNX, if this Title ID folder exists, it will use it and display the modifications from it. If it does not, it will just base it off of the vanilla game and write a new folder.

Step 7: ???

Step 8: Profit

Troubleshooting
Some users are having issues regarding an error message to the effect of
project.assets.json' not found and/or A numeric comparison was attempted on "$(MsBuildMajorVersion)" that evaluates to "" instead of a number, in condition "($(MsBuildMajorVersion) < 16)".

This seems to happen when building on Windows 10. I was able to reproduce this in a clean VM with no variables and was able to fix it. A full tutorial is planned but if you get these issues then here is a quick-and-dirty solution:

In VS 2019, go to View -> Other Windows -> Package Manager Consoleand enter dotnet build
When that finishes, if you still receive the numeric comparison issue, then follow these steps:

1. In the right-hand side of VS 2019, double click the pkNX.sln file
2. Go to Tools -> NuGet Package Manager ->Manage NuGet Packages for this Solution
3. Under Installed, find Costura.Foddy and click on it.
4. On the right-hand side of the pane that appeared, select all of the pkNX choices and hit "uninstall"
5. Accept all of the resulting warnings and dialogue boxes
6. When it finishes, in the NuGet Package Manager, go to Browse and find Costura.Foddy
7. Do the same as step 4 but Install instead. Accept all of the warnings.

It should build properly after this.
 
Last edited by OkazakiTheOtaku,
D

Deleted User

Guest
This was a nice guide, thank you for writing it. Do you have plans to write a guide for making the most out of pkNX perhaps?

In particular, I am curious to know the scope of changes we're able to make through pkNX; For Example, It would be great if we could replace the Wild Battle & Capture mechanics in the Let's Go games with the mechanics we're more familiar with from the mainline pokemon games by utilizing the relevant scripts in Sword & Shield, but would such a drastic change even be possible to implement?
 
Last edited by ,
  • Like
Reactions: OkazakiTheOtaku

OkazakiTheOtaku

no thanks, I don't want a custom title
OP
Member
Joined
Jul 20, 2016
Messages
1,461
Trophies
1
Location
127.0.0.1
XP
3,114
Country
Japan
This was a nice guide, thank you for writing it. Do you have plans to write a guide for making the most out of pkNX perhaps?

In particular, I am curious to know the scope of changes we're able to make through pkNX; For Example, It would be great if we could replace the Wild Battle & Capture mechanics in the Let's Go games with the mechanics we're more familiar with from the mainline pokemon games by utilizing the relevant scripts in Sword & Shield, but would such a drastic change even be possible to implement?
I considered it, but being that it isn’t released software I think I might be wasting my time, lest it gets changed drastically before release and everything is moved around or changed.
 
  • Like
Reactions: Deleted User

Toni456

Well-Known Member
Member
Joined
Oct 31, 2012
Messages
344
Trophies
1
XP
490
Country
Australia
Mine didn't work for some reason this is the only output it shows.

>------ Build started: Project: pkNX, Configuration: Debug|Any CPU ------

Build failed.
 

OkazakiTheOtaku

no thanks, I don't want a custom title
OP
Member
Joined
Jul 20, 2016
Messages
1,461
Trophies
1
Location
127.0.0.1
XP
3,114
Country
Japan
Could anyone gen me a Pokémon pls or just trade me a exp candie xl I’m stuck on the water gym pls ty
This has nothing to do with pkNX or my tutorial. Please find a more suitable place to make requests such as these.

Mine didn't work for some reason this is the only output it shows.

>------ Build started: Project: pkNX, Configuration: Debug|Any CPU ------

Build failed.
Did you make sure to wait until the git repo was completely cloned?
 

Toni456

Well-Known Member
Member
Joined
Oct 31, 2012
Messages
344
Trophies
1
XP
490
Country
Australia
Did you make sure to wait until the git repo was completely cloned?

Yes i did but in the end i got it working though, it was weird but it was looking for a file that didn't exist in the repo as i checked on the github page and it wasn't there either so i had to mess around a bit with re-opening the project until it worked.
 

OkazakiTheOtaku

no thanks, I don't want a custom title
OP
Member
Joined
Jul 20, 2016
Messages
1,461
Trophies
1
Location
127.0.0.1
XP
3,114
Country
Japan
Yes i did but in the end i got it working though, it was weird but it was looking for a file that didn't exist in the repo as i checked on the github page and it wasn't there either so i had to mess around a bit with re-opening the project until it worked.
Huh, weird. If you're able to reproduce it maybe consider getting screenshots of the missing file error so I can investigate. Thank you for the report back :)
 

SanjiBlackLeg

Member
Newcomer
Joined
Aug 5, 2018
Messages
8
Trophies
0
Age
33
XP
73
Country
Italy
Hi, I have this error when build:
Fody: No weavers found for the configuration entries Costura. Add the desired weavers via their nuget package.
 

MikeTheQuick

New Member
Newbie
Joined
Dec 28, 2019
Messages
2
Trophies
0
Age
25
XP
66
Country
United States
mine says "The type or namespace ma,e 'FluentAssertions' could not be found (are you missing a using directive or an assembly reference?)"

the code is CS0246
 

Juanny

New Member
Newbie
Joined
Jan 1, 2020
Messages
3
Trophies
0
Age
27
XP
82
Country
United Kingdom
Whenever i try to build i keep getting this message

Error MSB4236 The SDK 'Microsoft.NET.Sdk' specified could not be found. C:\Users\jonny\Source\Repos\pkNX\pkNX.sln C:\Users\jonny\Source\Repos\pkNX\pkNX.Containers\pkNX.Containers.csproj 1
 

Juanny

New Member
Newbie
Joined
Jan 1, 2020
Messages
3
Trophies
0
Age
27
XP
82
Country
United Kingdom
Whenever i try to build i keep getting this message

Error MSB4236 The SDK 'Microsoft.NET.Sdk' specified could not be found. C:\Users\jonny\Source\Repos\pkNX\pkNX.sln C:\Users\jonny\Source\Repos\pkNX\pkNX.Containers\pkNX.Containers.csproj 1
 

HarveyDent

Member
Newcomer
Joined
Feb 11, 2020
Messages
5
Trophies
0
Age
38
XP
44
Country
United States
I am getting an error message in Microsoft Visual Studio when I try to "build" the application. Attached is a screenshot of the error message. I would greatly appreciate any assistance in fixing the issue.

PS - I have even tried working on another computer, and still get the same error.
2020-02-10.png
 

OkazakiTheOtaku

no thanks, I don't want a custom title
OP
Member
Joined
Jul 20, 2016
Messages
1,461
Trophies
1
Location
127.0.0.1
XP
3,114
Country
Japan
I am getting an error message in Microsoft Visual Studio when I try to "build" the application. Attached is a screenshot of the error message. I would greatly appreciate any assistance in fixing the issue.

PS - I have even tried working on another computer, and still get the same error. View attachment 195973
Did you try the troubleshooting steps at the bottom of the post?
 

HarveyDent

Member
Newcomer
Joined
Feb 11, 2020
Messages
5
Trophies
0
Age
38
XP
44
Country
United States
Did you try the troubleshooting steps at the bottom of the post?

First off, OkazakiTheOtaku thank you so much for creating this thread! Thank you so much for writing up this article!


That appears to have fixed the problem creating the pkNX.exe application. However I am still having issues importing my Pokemon Shield game file that I dumped to my microSD card then copied to my computer.
 

OkazakiTheOtaku

no thanks, I don't want a custom title
OP
Member
Joined
Jul 20, 2016
Messages
1,461
Trophies
1
Location
127.0.0.1
XP
3,114
Country
Japan
However I am still having issues importing my Pokemon Shield game file that I dumped to my microSD card then copied to my computer.
Yeah, so, pkNX is veeery specific about how it wants its game files and there really isn't any way to go about it besides exactly how it wants. Basically, just make sure you are following Step 5 exactly, including making a top-level Shield folder, with a ROMFS and EXEFS folder inside the Shield folder. The Exefs folder can be empty, but it needs to be there. What are you using to dump the game files? Hactool or NXDumpTool?

Personally, I used NXDumpTool to just dump the entire romfs and then I structured it as I said above. Also keep in mind, I don't know if they have updated the software to use the newest update's romfs so make sure you are just dumping the base game without the update.
 
  • Like
Reactions: HarveyDent

HarveyDent

Member
Newcomer
Joined
Feb 11, 2020
Messages
5
Trophies
0
Age
38
XP
44
Country
United States
Yeah, so, pkNX is veeery specific about how it wants its game files and there really isn't any way to go about it besides exactly how it wants. Basically, just make sure you are following Step 5 exactly, including making a top-level Shield folder, with a ROMFS and EXEFS folder inside the Shield folder. The Exefs folder can be empty, but it needs to be there. What are you using to dump the game files? Hactool or NXDumpTool?

Personally, I used NXDumpTool to just dump the entire romfs and then I structured it as I said above. Also keep in mind, I don't know if they have updated the software to use the newest update's romfs so make sure you are just dumping the base game without the update.




Thanks for the repsonse!

1) I used NXDumpTool and chose to dump the "romfs" to my microSD card. When I look at the properties of the folder the "size" is 9.47 GB, it also says the "size on disk" is 13.8 GB.
2) I copied the whole NXDumpTool folder to my desktop.
3) I found the folder called "Pok__mon Shield v0 (01008DB008C2C000) (BASE)" inside the folder for NXDumpTool
4) I copied the Pok__mon Shield v0 (01008DB008C2C000) (BASE) folder to my desktop,
5) I made 2 empty folders inside of the aforementioned folder named: the 1st named "exefs" & the 2nd named "romfs"
6) I then dried dragging the Pok__mon Shield v0 (01008DB008C2C000) (BASE) folder into PKNX and get an error message.

I attached screen shots of the folders & the error message that pops up on pkNX
 

Attachments

  • 2020-02-11 (7).png
    2020-02-11 (7).png
    128.3 KB · Views: 428
  • 2020-02-11 (8).png
    2020-02-11 (8).png
    142.3 KB · Views: 455
  • 2020-02-11 (9).png
    2020-02-11 (9).png
    5.7 MB · Views: 518

OkazakiTheOtaku

no thanks, I don't want a custom title
OP
Member
Joined
Jul 20, 2016
Messages
1,461
Trophies
1
Location
127.0.0.1
XP
3,114
Country
Japan
Thanks for the repsonse!

1) I used NXDumpTool and chose to dump the "romfs" to my microSD card. When I look at the properties of the folder the "size" is 9.47 GB, it also says the "size on disk" is 13.8 GB.
2) I copied the whole NXDumpTool folder to my desktop.
3) I found the folder called "Pok__mon Shield v0 (01008DB008C2C000) (BASE)" inside the folder for NXDumpTool
4) I copied the Pok__mon Shield v0 (01008DB008C2C000) (BASE) folder to my desktop,
5) I made 2 empty folders inside of the aforementioned folder named: the 1st named "exefs" & the 2nd named "romfs"
6) I then dried dragging the Pok__mon Shield v0 (01008DB008C2C000) (BASE) folder into PKNX and get an error message.

I attached screen shots of the folders & the error message that pops up on pkNX
Structure it like this
X8E4S4X.png

The exefs folder should be empty, not the romfs folder. Bin and system_resource goes in romfs. Then drag the Pokemon Shield/Sword folder into pkNX
 

Disnino

Member
Newcomer
Joined
Feb 17, 2020
Messages
8
Trophies
0
Age
23
XP
50
Country
United States
Hey I was planning on editing this mod that I found on gamebanana which puts all the exclusive pokemon from shield to sword and vice versa. All it is, is a .gfpak file in a a bunch of folders in the romfs folder. Anyway I messaged him and he of course told me I can edit it using Pknx, and I of course have no idea on all this. Pknx says that its unable to recognize game data, so I've been trying to work this out for a few days and i'd appreciate some help :). He hasn't been very responsive on discord so I've been thrown in the deep end.

The Directory is: 0100ABF008968000 > romfs > bin > archive > field > resident > Data_Table.gfpak
 
Last edited by Disnino,

OkazakiTheOtaku

no thanks, I don't want a custom title
OP
Member
Joined
Jul 20, 2016
Messages
1,461
Trophies
1
Location
127.0.0.1
XP
3,114
Country
Japan
Hey I was planning on editing this mod that I found on gamebanana which puts all the exclusive pokemon from shield to sword and vice versa. All it is, is a .gfpak file in a a bunch of folders in the romfs folder. Anyway I messaged him and he of course told me I can edit it using Pknx, and I of course have no idea on all this. Pknx says that its unable to recognize game data, so I've been trying to work this out for a few days and i'd appreciate some help :). He hasn't been very responsive on discord so I've been thrown in the deep end.

The Directory is: 0100ABF008968000 > romfs > bin > archive > field > resident > Data_Table.gfpak
You have to have the entirety of the game's romfs as shown in this image:
and then, take the 0100ABF008968000 folder and place it next to the romfs folder. pkNX will then load your modded files and allow you to edit them
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    K3Nv2 @ K3Nv2: It's mostly the ones that are just pictures and no instructions at all