Jump to content

Recommended Posts

  • 4 weeks later...
Posted

pokemon data works differently in gen 6. in gen 3/4/5, pointers to specific pokes were passed directly into functions. in gen 6, a higher-level struct is passed in that contains different pokemon info. also, in gens 3/4/5, data was read from and written to pkms by only 2-4 functions. those 2-4 functions were switch statements that were up to a couple hundred cases. so for example. in gen 3/4/5, you had something like this:

u8 PKM_getNature(void* pkm)

{

PKM_decryptPartyPoke(pkm);

u8 nature = PKM_readPartyPkmStat(pkm, FIELD_ABILITY, NULL);

PKM_encryptPartyPoke(pkm);

return nature;

}

in gen 6, it looks more like this:

u8 PKM_getNature(void* pkm_data)

{

PKM_decryptPartyPoke(pkm_data);

struct PKM_blk0* b0 = PKM_getBlock0ShuffleTypePtr(pkm_data, 1);

u8 pk_nature = b0->nature;

PKM_encryptPartyPoke(pkm_data);

return pk_nature;

}

in the first function, void* pkm is the actual pkm file in ram. in the second, pkm_data is a set of data about a pkm. the data struct looks like this so far:

0 -

4 - is pkm is party (this is used in PKM_decryptPoke and PKM_encryptPoke to decide what exactly to en/decrypt

8 - pkm pointer

C - bool is pkm encrypted

D - bool encrypt pkm

so as you can see, while data is handled by PKM_readPartyPkmStat in the former, gen 6 actually reads each piece of data out in the get function for that data. they use functions to get pointers to each of the shuffled blocks and read from there.

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...