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,

Disnino

Member
Newcomer
Joined
Feb 17, 2020
Messages
8
Trophies
0
Age
23
XP
50
Country
United States
Alright I found it out, thanks alot for taking the time to help me out!

Also Ik this is unrelated to the thread but after installing cfw, when I boot into atmosphere I am unable to play any games that I legally downloaded from the eshop on stock os. They are all on the sd and taking up space but atmosphere doesn't show them as installed and prompts me to download them again. Booting back to stock os I can run them without issue. I guess it's no big problem but it would be much more convenient to be able to play them all on cfw and not switch back and forth
 
Last edited by Disnino,

kickcross

Member
Newcomer
Joined
Feb 17, 2020
Messages
9
Trophies
0
Age
26
XP
66
Country
United States
Any word yet as to whether the software has updated to take the romfs of *updated* Sword n Shield? When I do mine, the randomizer function for both wilds and trainers just doesn't do anything. I'm just wondering if you guys think that might be the reason....
 

Noimus

Well-Known Member
Newcomer
Joined
Mar 15, 2010
Messages
54
Trophies
0
XP
69
Country
United States
Any word yet as to whether the software has updated to take the romfs of *updated* Sword n Shield? When I do mine, the randomizer function for both wilds and trainers just doesn't do anything. I'm just wondering if you guys think that might be the reason....

Did you try the base version? Does it work for you then? What if you changed the Title ID of the modified file to (01008DB008C2C800) for the update instead of the (01008DB008C2C000) for base? Does that make a difference? I haven't tested this mod yet, but I just dumped the RomFS and noted two different versions so I am currently in the process of dumping both.
 

kickcross

Member
Newcomer
Joined
Feb 17, 2020
Messages
9
Trophies
0
Age
26
XP
66
Country
United States
Did you try the base version? Does it work for you then? What if you changed the Title ID of the modified file to (01008DB008C2C800) for the update instead of the (01008DB008C2C000) for base? Does that make a difference? I haven't tested this mod yet, but I just dumped the RomFS and noted two different versions so I am currently in the process of dumping both.

I since tried with Sword on the base (no update data) and it still isn't working, strangely enough, my starters that I edited into Shield showed up in Sword (though they didn't in Shield), but no random Pokemon. And I deleted my Shield folder in titles, so I'm not even sure how that happened. Went back into PKNX and sure enough, the romfs of Sword didn't have the starters edited in any way....
 
Last edited by kickcross,

HarveyDent

Member
Newcomer
Joined
Feb 11, 2020
Messages
5
Trophies
0
Age
38
XP
44
Country
United States
OkazakiTheOtaku - Thanks for your help!
I finally figured out to get my game open in PKNX. I also figured out how to modify a "Raid," and save/dump the file. I have been successful in opening the raid in the game.

However, I am coming across a weird anomaly/issue. In PKNX you can choose "FlawlessIVs" when modifying a raid. I have chosen all 12 members to be species 809 - Melmetal Gigantamax, and all of them should have 6 Flawless IVs. I have caught many of them with various 1-5 star rankings, and none of them have are flawless 6IVs, most of them have 0IVs, occassionally 1-2IVS. Any suggestions?

Also is there any way you can think of in which PKNX would force them to be shiny?

Thanks Again 8-)

--------------------- MERGED ---------------------------

OkazakiTheOtaku - Thanks for your help!
I finally figured out to get my game open in PKNX. I also figured out how to modify a "Raid," and save/dump the file. I have been successful in opening the raid in the game.

However, I am coming across a weird anomaly/issue. In PKNX you can choose "FlawlessIVs" when modifying a raid. I have chosen all 12 members to be species 809 - Melmetal Gigantamax, and all of them should have 6 Flawless IVs. I have caught many of them with various 1-5 star rankings, and none of them have are flawless 6IVs, most of them have 0IVs, occassionally 1-2IVS. Any suggestions?

Also is there any way you can think of in which PKNX would force them to be shiny?

Thanks Again 8-)



PS - sorry I forgot to post the screenshots in my last post.
2020-02-26 (1).png
2020-02-26.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
OkazakiTheOtaku - Thanks for your help!
I finally figured out to get my game open in PKNX. I also figured out how to modify a "Raid," and save/dump the file. I have been successful in opening the raid in the game.

However, I am coming across a weird anomaly/issue. In PKNX you can choose "FlawlessIVs" when modifying a raid. I have chosen all 12 members to be species 809 - Melmetal Gigantamax, and all of them should have 6 Flawless IVs. I have caught many of them with various 1-5 star rankings, and none of them have are flawless 6IVs, most of them have 0IVs, occassionally 1-2IVS. Any suggestions?

Also is there any way you can think of in which PKNX would force them to be shiny?
I'm gonna be honest, I have no idea how to use the raid editor. I've just used this for modifying wild encounter tables and trainer battles. Sorry,
Any word yet as to whether the software has updated to take the romfs of *updated* Sword n Shield? When I do mine, the randomizer function for both wilds and trainers just doesn't do anything. I'm just wondering if you guys think that might be the reason....
https://github.com/kwsch/pkNX/commit/e3ca50178820deddd91ab0a269f5e50c2f76f4b8
https://github.com/kwsch/pkNX/commit/dc9563f0004fa50fe5b1d355e72277aafeba7b6e

In January, support was added. Check the commits listed above ^^
In addition, the edits that I made for 1.0.0 still work on 1.1.0, as that's what I'm updated to. I didn't have to change my encounter table and raid trainer mods.
I since tried with Sword on the base (no update data) and it still isn't working, strangely enough, my starters that I edited into Shield showed up in Sword (though they didn't in Shield), but no random Pokemon. And I deleted my Shield folder in titles, so I'm not even sure how that happened. Went back into PKNX and sure enough, the romfs of Sword didn't have the starters edited in any way....
Both Sword and Shield contain the romfs data for both versions. The executable just chooses what to load in during runtime.
For example, with my romfs dump of Sword I can change the stuff for Shield.
Make sure that in pkNX you are editing the right tables-- you can make changes for Sword with the romfs of Shield and vice versa. IIRC, Sword tables will be "SW" and Shield will be "SH."
 
Last edited by OkazakiTheOtaku,

kickcross

Member
Newcomer
Joined
Feb 17, 2020
Messages
9
Trophies
0
Age
26
XP
66
Country
United States
Both Sword and Shield contain the romfs data for both versions. The executable just chooses what to load in during runtime.
For example, with my romfs dump of Sword I can change the stuff for Shield.
Make sure that in pkNX you are editing the right tables-- you can make changes for Sword with the romfs of Shield and vice versa. IIRC, Sword tables will be "SW" and Shield will be "SH."

I definitely did. I've spent about 3 days working on this, so I've tried just about every option there is at this point. Using updated and nonupdated romfs for both games, tried each aspect independently to see if I could get one part to work, etc. So far the only luck was that random bit with the starters.
 

Shin Atomoz

Member
Newcomer
Joined
Apr 15, 2009
Messages
8
Trophies
1
XP
372
Country
United States
How do I edit the learnset of Slowpoke-1 in pknx? It is entry 915 in the pokemon list and everything u der it was shifted 1 space. I dont know how to edit the dlc additions like Galarian Slowpoke. It still shows up as a blank in the program. This is what Matt told me:

"Currently, entries 001 (Bulbasaur) to 914 (Galarian Rapidash) remain unchanged. As of Ver. 1.1.0, Galarian Slowpoke was added making it entry 915, shifting everything starting from Galarian Farfetch'd up by 1.

1154 used to be Toxtricity-1, but it is now Sinistea-1 (reason is explained above). Your mods will need to be renamed to match the new entries, and this will likely happen again as more DLC is released for the games in June and Fall later this year. I recommend Bulk Rename Utility."

I don't know to open the wazaoboe_total.bin found in the romfs/bin/pml directory. Normally there would be as many entries as there are pokes, but...it's just the one...

I feel I need to edit the 1.1.0 update or do I need something from that to allow pknx to recognize Galar Slowpoke?
 

MegaNiko17

New Member
Newbie
Joined
May 28, 2020
Messages
2
Trophies
0
Age
33
XP
46
Country
United States
Hey everyone! Can someone link me the latest pknx.exe? I can't compile it on my Mac/Linux machines unfortunately. Thanks in advance!!
 

SoupMaker

New Member
Newbie
Joined
Jun 25, 2020
Messages
1
Trophies
0
Age
29
XP
43
Country
Norway
So hey... I was wondering why i get this error when i try to open up my game file in PKnx..? I tried to use an older version of PKnx, and it works just fine :) But not on the github version? I am confusion :o I want the newer version cuz of raid edditing, to help one of my friends out in local mode :)

Thanks for answers in advance! <3
 

Attachments

  • Feil 1.png
    Feil 1.png
    3.3 MB · Views: 277
  • feil 2.png
    feil 2.png
    3.3 MB · Views: 212
  • Feil 3.png
    Feil 3.png
    3.3 MB · Views: 204
  • feil 4.png
    feil 4.png
    3.3 MB · Views: 238

AvatarMew

Well-Known Member
Member
Joined
Sep 5, 2015
Messages
391
Trophies
0
Age
30
XP
602
Country
Can someone help me?

I've followed the guide but when I clone the code this is what I get:
sLcdNqY.png
:
Am I doing something wrong?
 

xPASx

New Member
Newbie
Joined
Mar 16, 2021
Messages
1
Trophies
0
Age
26
XP
36
Country
United States
C:\Users\pocho\source\Repos\pkNX\pkNX.Structures\Scripts\PawnUtil.cs(131,31): error CS1503: Argument 1: cannot convert from 'int' to 'byte' [C:\Users\pocho\source\Repos\pkNX\pkNX.Structures\pkNX.Structures.csproj] Getting this error not sure how to fix it
 

Yerk

New Member
Newbie
Joined
Jan 28, 2022
Messages
2
Trophies
0
Age
21
XP
25
Country
United States
I cannot find the Newtonsoft.jsoon.xml file needed to be with the other pknx files. This is very frustrating please help.
 

Nebby-DC

New Member
Newbie
Joined
Mar 10, 2022
Messages
1
Trophies
0
Age
21
Location
Australia
XP
34
Country
Australia
Hi, im getting errors whenever i try to build the sln:
Severity Code Description Project File Line Suppression State
Error CS1617 Invalid option '10' for /langversion. Use '/langversion:?' to list supported values. pkNX.Containers

this appears 4 times and im unsure how to fix this
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    BakerMan @ BakerMan: jus levelled up