So I just finished a project called CC4Wifi (Challenge Cup for Wi-Fi), which generates pkm files for random pokemon with random movesets, as per "Challenge Cup" rules.
Here's the weird thing, though--while the files import fine into Pokesav, when I try importing one into Pokegen, it's complete nonsense.
I've done some additional testing. My template file imports fine. But when I load the template, change just *one* byte (see below)--even something as innocuous as an EV value--and write it back, Pokegen refuses to read it any more. Does Pokegen have some sort of weird checksum thing that Pokesav does not? Or is something else going on?
Test code (in python):
And I've tried looking at the files in a hex editor--the only difference between the files is indeed the value at 0x18.
from array import *
p=array('B'); p.fromstring(open("template.pkm",'rb').read()) #template.pkm imports fine into Pokegen
p.tofile(open("test.pkm",'wb')) #test.pkm imports as garbage
Edit: Looked back over this handy reference. So there is indeed a checksum. Now I just gotta figure out how to calculate it...