PKM File Fields

From ProjectPokemon Wiki
Revision as of 20:05, 24 January 2013 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,
sanity1_1,
sanity2_2,
sanity3_3,
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 176 fields.

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

0- pid
1- (sanity)unused short
2- (sanity)unused short
3- (sanity)is species egg
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- spe ev
11- spa ev
12- spd 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 current pp
3b- move2 current pp
3c- move3 current pp
3d- move4 current pp
3e- move1 pp up
3f- move2 pp up
40- move3 pp up
41- move4 pp up
42- move 1 pp
43- move 2 pp
44- move 3 pp
45- move 4 pp
46- hp iv
47- atk iv
48- def iv
49- spe iv
4a- spa iv
4b- spd iv
4c- is_egg
4d- 
--------------------------------------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- 
-----------------------------------------
6e- gender(0 male, 1 female)
6f- form
70- nature
71- has dw abil
72- N's pokemon(?)
73- name
74-
75- is_nicknamed
76-
77- game of origin
8d- OT name
8e- 
8f- year met(0-99)
90- month(1-12)
91- day(1-end of month)
92- egg year met(0-99)
93- egg month(1-12)
94- egg day(1-end of month)
95- egg met location
96- location
97- pokerus
98- poke ball
99- met at level
9a- set if OT gender is female
9d- 
9e- level
9f- capsule seal index
-----------------------------------------
a0- current hp
a1- max hp
a2- attack
a3- def
a4- speed
a5- spa
a6- spd
a7- mail

a9- is slot filled

ad- is species NOT nido F/M
ae- get arceus type from plate
af- get arceus type from plate
b2- n's pokemon