Jump to content

[HELP WANTED] Reverse-engineering Rule Check Tool for B/W & B2/W2


Recommended Posts

Background

About a month ago I ordered a DSi off of eBay (it was only $40).  When I got it I noticed there was something strange on it:18buh4mz78i31.jpg

"PWC2010"?  I never heard about there being DSiWare for Pokemon?  I consulted with other people on the internet and it turns out nobody else has heard it either.   I tried to message the seller, but he said that he has no idea either (most likely he bought them in bulk as he was selling a lot of other models at the time).  The mystery was just starting, a group of individuals from the DS(i) homebrew scene started to get to the bottom of this (me being invited despite my lack of knowledge due to being the one who found it), here's what we were able to figure out:

The Investigation Begins...

  • The hardware
    • The system itself is appears to be a normal black DSi, nothing about it is different from that of a stock model
    • The casing has some minor scratches and such, and is missing the original stylus.
    • On the front side where the camera is, there are two faded silhouettes of what look to be rectangular stickers
    • The system was formatted when I got it and it didn't come with an SD card (this will become a problem later on)

 

  • The Software
    • The apps included are: Flipnote Studios, DSi + Internet, PWC2010 Rule Check Tool, PWC2010 Log Viewer, and PokemonBW2 Rule Check Tool.  All of which were preinstalled to the NAND as there is no way to access "Data Mangement" to move them to a SD card.
    • At first, the only app that would boot was Log Viewer as both of the Rule Check Tools would just crash and return back to the menu.  It was later revealed the apps were looking for 3 files at the root of an SD card before being able to boot.
    • Through observations we were able to get some insights on what each of the 3 mystery apps do:

rulecheck1.png.3403a71ea5eecfd0dc39eea2fd58ca0d.png PWC2010 Rule Check Tool

  •  From what the name implies, this tool must have been used for the Pokemon World Championship (PWC) in 2010
  • The app looks for 3 file on the SD card: regulation.binregulation.cfg, and rule.prd.  
  • By making 3 dummy files full of garbage data and naming them as the files listed before, we were able to get it to boot, after which we were greeted with a lovely message:
  • rulecheckboot.png.e3731bfb47ae9194b13e419b8528c408.png
  • The weird thing is, Black and White were used for the 2011 PWC, not 2010.  This could imply that the app was a carry over from a previous tool used the year before.
  • Luckily, I just so happen to have a copy of Black.  Putting in the correct cartridge displays the message "No problems found" and ask if you want to save the results.
  • Through testing we were able to figure out how to get past this screen as it turns out "No problems found" also acts as a default message, if something does fail one of the checks it will display what the error was.
  • It's possible to make it check both the party Pokemon and Pokemon in the Battle Box by editing regulation.cfg file.

 

rulecheck2.png.258ffafe887d2122d21eb11dcf652825.png PWC2010 Log Viewer

  • Log viewer shows the results saved from Rule Check, it shows the player's username and gives a technical description of each Pokemon in the party (stats, friendship, exp, moveset, etc.). By pressing "X" it will do the same thing but for the Battle Box instead.
  •  logboot.png.f457960de0810877c730659eab6c9147.pnglogpkmn.png.bd885bcfb578497b225cb9fcb15704a7.png

 

PokBW2.png.3f2574a1d51c2822b76d0eeccfda52a5.png PokemonBW2 Rule Check Tool

  • Exactly the same as PWC2010, expect looks for the Black2/White2 cartridge instead

 

More Technical Details

  • Looking into the game's files, we were able to extract the messages displayed by Rule Check: Rule Check Messages
  • regulation.cfg is, as the name suggests, a config file.  Through dumb luck I was able to figure out this much:
    Offset  0x00:  checks party
    Offset  0x01:  checks battlebox
    Offset  0x05:  turns on cart access
    Offset  0x0C:  save to livematch.dat 
    These values have to be "turned on" meaning the value is set to '1'
    If offset 0x05 isn't turned on then it will say that the cart isn't inserted.
    If offset 0x00 or 0x01 aren't turned on but 0x05 is, then it will say that it passed all checks (probably the default message)
  • The files saved from Rule Check and are viewed in Log Viewer are named "logTYYMMDD.dat" and "logBYYMMDD.dat" (YYMMDD is the date, so something like Oct. 31 2019 would be 191031).  LogT is for the results from the party (T=Team?) and logB is from the Battle Box. Through great efforts, users Epicpkmn11 and edo9300 were both able to reverse-engineer these files before we were able to figure out how to save it: Google Sheets
  • regulation.bin appears to handle simple checks like invalid number of Pokemon in party, level caps, and duplicate items/Pokemon
  • rule.prd may be used for more advance checks like invalid movesets and banned Pokemon/items

 

Conclusion

As of right now, interest has been dying as people began shifting to their own personal projects.  For the past 3 weeks nobody has found anything new and I'm left to try and figure it out on my own.  The problem is I know very little about NDS development and how the Pokemon games work in a technical level, which is why I'm turning here for help.  

  • We still know very little about regulation.bin and rule.prd, which are believe to be two key factors in order to get Rule Check to work properly, and without the original SD card we are left in the dark.
  • It's possible that rule.prd is somehow linked to the hex values found in Pokemon (movesets, lvls, type, etc.), but can't really determine where and what to look for
  • We don't know how much is relied on the files or if certain checks are programmed

Any insights, suggestions, resources, or tips are greatly accepted!

  • Like 4
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...