PKM File Fields

From ProjectPokemon Wiki
Revision as of 18:19, 12 October 2012 by Bond697 (talk | contribs)
Jump to navigation Jump to search

PKM files have been ripped from saved and traded online for roughly the last 5 years or so by players. Pulling them out of games is very easy and makes trading or giving out pokemon to friends a simple task. When GameFreak needs to get or set specific data for a pokemon, they do it using a switch statement and a series of fields. They do it like so:

typedef enum{

PID,
field2,
field3,
field4,
CHECKSUM,
SPECIES,
ITEM,
ID,
EXP,
HAPPINESS,

-and so forth-

} PKMField;

When they need to write data to the pkm file, they use this function:

void setPKMStat(void* pPKM, PKMField field, int data)

and when they need to retrieve data from a PKM file, they use this:

PKMField getPKMStat(void* pPKM, PKMField field, int data)
(data is basically always 0 in the "get" function)

So to get a piece of data from a pokemon, say if the pokemon is an egg(0x4C), it would look something like this:

getPKMStat(pkm_pointer, IS_EGG, 0);

The switch statements for these functions are large. In gen 3 they used 2 switches, one for party data and one for box data. In gens 4 and 5 they switched to a single massive switch that can retrieve anything. In B2W2 a PKM file has 180 fields. In BW PKM files had 175 fields.

The following is a partial list of field values for these functions: (all are in hexadecimal)

0- pid
1- unused short
2- unused short
3- unused short
4- checksum
5- species
6- item
7- tidsid
8- exp
9- happiness
a- abil
b- markings
c- region
d- hp ev
e- atk ev
f- def ev
10- spa ev
11- spd ev
12- spe ev
13- cool contest
14- beauty contest
15- cute contest
16- smart contest
17- tough contest
18- sheen contest
------------------------------------sinnoh ribbons
19- Sinnoh Champ Ribbon
1A- Ability Ribbon
1B- Great Ability Ribbon
1C- Double Ability Ribbon
1D- Multi Ability Ribbon
1E- Pair Ability Ribbon
1F- World Ability Ribbon
20- Alert Ribbon
21- Shock Ribbon
22- Downcast Ribbon
23- Careless Ribbon
24- Relax Ribbon
25- Snooze Ribbon
26- Smile Ribbon
27- Gorgeous Ribbon
28- Royal Ribbon
29- Gorgeous Royal Ribbon
2a- Footprint Ribbon
2b- Record Ribbon
2c- History Ribbon
2d- Legend Ribbon
2e- Red Ribbon
2f- Green Ribbon
30- Blue Ribbon
31- Festival Ribbon
32- Carnival Ribbon
33- Classic Ribbon
34- Premier Ribbon
----------------------------------------
35-
36- move1
37- move2
38- move3
39- move4
3a- move1 pp
3b- move2 pp
3c- move3 pp
3d- move4 pp
3e- move1 pp up
3f- move2 pp up
40- move3 pp up
41- move4 pp up

46- hp iv
47- atk iv
48- def iv
49- spa iv
4a- spd iv
4b- spe iv
4c- is_egg
4d- is_nicknamed
--------------------------------------hoenn ribbons
4e- Cool Ribbon
4f- Cool Ribbon Super
50- Cool Ribbon Hyper
51- Cool Ribbon Master
52- Beauty Ribbon
53- Beauty Ribbon Super
54- Beauty Ribbon Hyper
55- Beauty Ribbon Master
56- Cute Ribbon
57- Cute Ribbon Super
58- Cute Ribbon Hyper
59- Cute Ribbon Master
5a- Smart Ribbon
5b- Smart Ribbon Super 
5c- Smart Ribbon Hyper 
5d- Smart Ribbon Master
5e- Tough Ribbon
5f- Tough Ribbon Super
60- Tough Ribbon Hyper
61- Tough Ribbon Master
62- Champion Ribbon
63- Winning Ribbon
64- Victory Ribbon
65- Artist Ribbon
66- Effort Ribbon
67- Marine Ribbon
68- Land Ribbon
69- Sky Ribbon
6a- Country Ribbon
6b- National Ribbon
6c- Earth Ribbon
6d- World Ribbon
-----------------------------------------
6e- gender(0 male, 1 female)
6f- form
70- nature
71- has dw abil
72- N's pokemon
73- 
97- pokerus
98- poke ball