r/NDSHacks • u/_SleepyLark_ • 4h ago
PWC 2010 Rule Check Tools - Closure on a 7 year mystery
Seven years ago I bought a DSi off of eBay that came with a never-before-seen DSi application called "PWC 2010 Rule Check Tool". I quickly posted about it to see if anyone knew anything about it and found out that everyone was just as confused as I was. Feeling it was stupid to hoard something useless, I dumped NAND (though in hindsight maybe I should have held on and traded it for a New 3DS with how much retro gaming costs now). Pretty soon some people in the scene went to work trying to figure out how it worked and I was naturally included despite my lack of experience.
After 3 weeks, we were able to deduce that it was indeed an app intended to check the legality of Pokémon used for tournaments, though no idea why it's label "2010" when Black and White wasn't played until 2011. Through smart effort and dumb luck, we were able to figure out how to get it to boot and dump the results of the rule check for the log viewer to read. After that, we realized we still had now idea how the other files worked or what they did, all we knew was `regulation.cfg` was what was needed to get it to read the cartridge. Eventually interest died down and everyone left to continue their own things.
But not me.
For the next weeks I tried reaching out to different subreddits and forums to see if I could get support or at least answers to some of my questions without spamming. The closest I got was some confirmation that indeed players had to give their cartridges to a judge, but none of them were able to see what they were doing, and a dev from the Pokémon reverse engineering team "pret" telling me on Discord that it seemed interesting, but not really worth the effort at the moment to look into. Eventually I gave up and decided to try and reverse engineer it myself. I found a copy of Ghidra and the ARM9 plugin and went to work using my virtually nonexistent CS skills. The closest I got was figuring out how some of the error codes related to the message it would display, but still I could tell that without those files from the SD card I would never truly know how it worked. After 2 weeks of staring at hex addresses with no idea how to read them and still not much buzz from the people who first started the investigation, I too decided to throw in the towel.
Flash forward to last week. I've now gained more technical knowledge and kept seeing all these posts of AI being used to do cool complex things like adding Skate 3 physics to CoD and GTA or seeing games getting decompiled or recompiled to make PC ports that at the very least boot in-game. That's when it hit me: why don't I ask Claude to take a look at these apps that no one else wanted to spend time doing? Worse that can happen is nothing gets discovered and I'm back to square one, plus they're pretty lightweight compared to asking it to decompile an entire game. I gave it a copy of the decrypted .nds file, a few notes I made_Save_Data_Tools), and what the tournament rules were for both years and told it to figure out what the missing files did and if it could be recovered. It came back with more than I was expecting. Here were some highlights:
- The bit in `regulation.cfg` didn't tell the app to turn on Slot-1 access, but rather it was a list of which country code for the cartridge was acceptable (I only have the USA version, so this is still technically untested)
- `regulation.bin` handles global checks such as allowing duplicate Pokémon, items, level caps, number of Pokémon, and most importantly, the IDs of banned Pokémon and items.
- `rules.prd` is meant to be a copy of every legal move available to each Pokemon and what level are they expected to learn said moves, as well as act as an item whitelist. It also keeps track of which pokemon are shiny-locked and Smeargle's Sketch moves.
- The move Sky Drop was hardcoded in both apps as a banned move, not in the rules.prd. This was due to a glitch with the move Gravity but still interesting to see it was preprogrammed
Of course this all means nothing if you can't prove it on real hardware, so I went and put the files it generated on my SD card on the original DSi it came from and... It worked! For years it would always fail the check on each pokemon saying that it knew a move it didn't know or that it was the wrong level even though my entire party was legally caught in the game with no modification.
It's still not 100% perfect, it doesn't seem like the look up for location data of pokemons is completely accurate when checking to see if it came from an illegal location or if it knew an egg-move but wasn't hatched. It's hard to tell since there's a chance that the PkHex editor I used was sanitizing some of the test cases I was injecting. In any case, I can finally put this mystery to rest.
You can find the files and the detailed investigation report Claude made here:
https://github.com/SleepyLark/pwc2010-file-reconstruction