It is true - the whole reason we use decrypted PKM files is because COM (creator of Pokesav) did it. He didn't do many things correctly, but we learned some of his bad habits all the same.
Really? Cleaner than just defining the binary layout in a multi-tier structure then creating a pointer at the memory location of the save file? I find my way so easy to work with in code!
struct pokemon_obj : pkmunencryptblock,pkmblocka,pkmblockb,pkmblockc,pkmblockd {};
//...
struct box_obj { // size: 0x1000
public:
std::array<pokemon_obj,30> pokemon; //
uint16 : 16;
uint16 checksum;
byte buf[0x0c];
box_obj()
{
memset(this,0,sizeof(box_obj));
}
};
//...
struct bw2savblock_obj { //
//...
std::array<box_obj,24> boxes; // size: 0x18000
//...
};
Then I get to do nifty stuff like:
std::cout << "The Attack IV of the Pokemon stored in Box 1, slot 1 is " << sav->cur.boxes[0].pokemon[0].ivs->attack << "\n";