PKM File Fields: Difference between revisions

From ProjectPokemon Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 37: Line 37:
(all are in hexadecimal)
(all are in hexadecimal)
<pre>
<pre>
0- pid
0x0 pid
1- (sanity)unused short
0x1 (sanity) pkm party data is decrypted
2- (sanity)unused short
0x2 (sanity) pkm box data is decrypted
3- (sanity)is species egg
0x3 (sanity) is pkm species egg
4- checksum
0x4 checksum
5- species
0x5 species
6- item
0x6 item
7- tidsid
0x7 sidtid
8- exp
0x8 exp
9- happiness
0x9 happiness
a- abil
0xA, 10 ability
b- markings
0xB, 11 markings
c- region
0xC, 12 region
---------------------------------
0xD, 13 hp ev
d- hp ev
0xE, 14 atk ev
e- atk ev
0xF, 15 def ev
f- def ev
0x10, 16 spe ev
10- spe ev
0x11, 17 spa ev
11- spa ev
0x12, 18 spd ev
12- spd ev
0x13, 19 cool contest
---------------------------------
0x14, 20 beauty contest
13- cool contest
0x15, 21 cute contest
14- beauty contest
0x16, 22 smart contest
15- cute contest
0x17, 23 tough contest
16- smart contest
0x18, 24 sheen contest
17- tough contest
0x19, 25 sinnoh champ ribbon
18- sheen contest
0x1A, 26 ability ribbon
------------------------------------sinnoh ribbons
0x1B, 27 great ability ribbon
19- Sinnoh Champ Ribbon
0x1C, 28 double ability ribbon
1A- Ability Ribbon
0x1D, 29 multi ability ribbon
1B- Great Ability Ribbon
0x1E, 30 pair ability ribbon
1C- Double Ability Ribbon
0x1F, 31 world ability ribbon
1D- Multi Ability Ribbon
0x20, 32 alert ribbon
1E- Pair Ability Ribbon
0x21, 33 shock ribbon
1F- World Ability Ribbon
0x22, 34 downcast ribbon
20- Alert Ribbon
0x23, 35 careless ribbon
21- Shock Ribbon
0x24, 36 relax ribbon
22- Downcast Ribbon
0x25, 37 snooze ribbon
23- Careless Ribbon
0x26, 38 smile ribbon
24- Relax Ribbon
0x27, 39 gorgeous ribbon
25- Snooze Ribbon
0x28, 40 royal ribbon
26- Smile Ribbon
0x29, 41 gorgeous royal ribbon
27- Gorgeous Ribbon
0x2A, 42 footprint ribbon
28- Royal Ribbon
0x2B, 43 record ribbon
29- Gorgeous Royal Ribbon
0x2C, 44 history ribbon
2a- Footprint Ribbon
0x2D, 45 legend ribbon
2b- Record Ribbon
0x2E, 46 red ribbon
2c- History Ribbon
0x2F, 47 green ribbon
2d- Legend Ribbon
0x30, 48 blue ribbon
2e- Red Ribbon
0x31, 49 festival ribbon
2f- Green Ribbon
0x32, 50 carnival ribbon
30- Blue Ribbon
0x33, 51 classic ribbon
31- Festival Ribbon
0x34, 52 premier ribbon
32- Carnival Ribbon
0x35, 53 ribbon
33- Classic Ribbon
0x36, 54 move1
34- Premier Ribbon
0x37, 55 move2
----------------------------------------
0x38, 56 move3
35-
0x39, 57 move4
36- move1
0x3A, 58 move1 current pp
37- move2
0x3B, 59 move2 current pp
38- move3
0x3C, 60 move3 current pp
39- move4
0x3D, 61 move4 current pp
3a- move1 current pp
0x3E, 62 move1 ppup count
3b- move2 current pp
0x3F, 63 move2 ppup count
3c- move3 current pp
0x40, 64 move3 ppup count
3d- move4 current pp
0x41, 65 move4 ppup count
3e- move1 pp up
0x42, 66 move1 max pp
3f- move2 pp up
0x43, 67 move2 max pp
40- move3 pp up
0x44, 68 move3 max pp
41- move4 pp up
0x45, 69 move4 max pp
42- move 1 pp
0x46, 70 hp iv
43- move 2 pp
0x47, 71 atk iv
44- move 3 pp
0x48, 72 def iv
45- move 4 pp
0x49, 73 spe iv
46- hp iv
0x4A, 74 spa iv
47- atk iv
0x4B, 75 spd iv
48- def iv
0x4C, 76 is egg
49- spe iv
0x4D, 77 cool ribbon
4a- spa iv
0x4E, 78 cool ribbon super
4b- spd iv
0x4F, 79 cool ribbon hyper
4c- is_egg
0x50, 80 cool ribbon master
4d-
0x51, 81 beauty ribbon
--------------------------------------hoenn ribbons
0x52, 82 beauty ribbon super
4e- Cool Ribbon
0x53, 83 beauty ribbon hyper
4f- Cool Ribbon Super
0x54, 84 beauty ribbon master
50- Cool Ribbon Hyper
0x55, 85 cute ribbon
51- Cool Ribbon Master
0x56, 86 cute ribbon super
52- Beauty Ribbon
0x57, 87 cute ribbon hyper
53- Beauty Ribbon Super
0x58, 88 cute ribbon master
54- Beauty Ribbon Hyper
0x59, 89 smart ribbon
55- Beauty Ribbon Master
0x5A, 90 smart ribbon super
56- Cute Ribbon
0x5B, 91 smart ribbon hyper
57- Cute Ribbon Super
0x5C, 92 smart ribbon master
58- Cute Ribbon Hyper
0x5D, 93 tough ribbon
59- Cute Ribbon Master
0x5E, 94 tough ribbon super
5a- Smart Ribbon
0x5F, 95 tough ribbon hyper
5b- Smart Ribbon Super
0x60, 96 tough ribbon master
5c- Smart Ribbon Hyper
0x61, 97 champion ribbon
5d- Smart Ribbon Master
0x62, 98 winning ribbon
5e- Tough Ribbon
0x63, 99 victory ribbon
5f- Tough Ribbon Super
0x64, 100 artist ribbon
60- Tough Ribbon Hyper
0x65, 101 effort ribbon
61- Tough Ribbon Master
0x66, 102 marine ribbon
62- Champion Ribbon
0x67, 103 land ribbon
63- Winning Ribbon
0x68, 104 sky ribbon
64- Victory Ribbon
0x69, 105 country ribbon
65- Artist Ribbon
0x6A, 106 national ribbon
66- Effort Ribbon
0x6B, 107 earth ribbon
67- Marine Ribbon
0x6C, 108 world ribbon
68- Land Ribbon
0x6D, 109
69- Sky Ribbon
0x6E, 110 gender(0 male, 1 female)
6a- Country Ribbon
0x6F, 111 form
6b- National Ribbon
0x70, 112 nature
6c- Earth Ribbon
0x71, 113 has dw abil
6d-
0x72, 114
-----------------------------------------
0x73, 115 name
6e- gender(0 male, 1 female)
0x74, 116 nickname
6f- form
0x75, 117 is nicknamed
70- nature
0x76, 118
71- has dw abil
0x77, 119 game of origin
72- N's pokemon(?)
0x78, 120
73- name
0x79, 121
74-
0x7A, 122
75- is_nicknamed
0x7B, 123
76-
0x7C, 124
77- game of origin
0x7D, 125
8d- OT name
0x7E, 126
8e-
0x7F, 127
8f- year met(0-99)
0x80, 128
90- month(1-12)
0x81, 129
91- day(1-end of month)
0x82, 130
92- egg year met(0-99)
0x83, 131
93- egg month(1-12)
0x84, 132
94- egg day(1-end of month)
0x85, 133
95- egg met location
0x86, 134
96- location
0x87, 135
97- pokerus
0x88, 136
98- poke ball
0x89, 137
99- met at level
0x8A, 138
9a- set if OT gender is female
0x8B, 139
9d-
0x8C, 140
9e- level
0x8D, 141 OT name in
9f- capsule seal index
0x8E, 142 OT name out
-----------------------------------------
0x8F, 143 year met (0-99)
a0- current hp
0x90, 144 month met(1-12)
a1- max hp
0x91, 145 day met(1-end of month)
a2- attack
0x92, 146 egg year met(0-99)
a3- def
0x93, 147 egg month met(1-12)
a4- speed
0x94, 148 egg day met(1-end of month)
a5- spa
0x95, 149 location
a6- spd
0x96, 150 egg met location
a7- mail
0x97, 151 pokerus
0x98, 152 poke ball
0x99, 153 met at level
0x9A, 154 set if OT gender is female
0x9B, 155
0x9C, 156
0x9D, 157
0x9E, 158 level
0x9F, 159 capsule seal index
0xA0, 160 current hp
0xA1, 161 max hp
0xA2, 162 attack
0xA3, 163 defense
0xA4, 164 speed
0xA5, 165 spa
0xA6, 166 spd
0xA7, 167 mail
0xA8, 168
0xA9, 169 is slot filled
0xAA, 170 is egg(both sanity bits)
0xAB, 171 get species if filled slot is egg(ret 0 otherwise)
0xAC, 172
0xAD, 173 is species NOT nido F/M
0xAE, 174 pkm type
0xAF, 175 pkm type
0xB0, 176
0xB1, 177
0xB2, 178 N's poke


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
</pre>
</pre>

Revision as of 13:05, 8 May 2013

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:

(starting from 0, obviously)
typedef enum{

PID,
sanity1_1,
sanity2_2,
sanity_egg_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)

0x0	pid
0x1	(sanity) pkm party data is decrypted
0x2	(sanity) pkm box data is decrypted
0x3	(sanity) is pkm species egg
0x4	checksum
0x5	species
0x6	item
0x7	sidtid
0x8	exp
0x9	happiness
0xA, 10	ability
0xB, 11	markings
0xC, 12	region
0xD, 13	hp ev
0xE, 14	atk ev
0xF, 15	def ev
0x10, 16	spe ev
0x11, 17	spa ev
0x12, 18	spd ev
0x13, 19	cool contest
0x14, 20	beauty contest
0x15, 21	cute contest
0x16, 22	smart contest
0x17, 23	tough contest
0x18, 24	sheen contest
0x19, 25	sinnoh champ ribbon
0x1A, 26	ability ribbon
0x1B, 27	great ability ribbon
0x1C, 28	double ability ribbon
0x1D, 29	multi ability ribbon
0x1E, 30	pair ability ribbon
0x1F, 31	world ability ribbon
0x20, 32	alert ribbon
0x21, 33	shock ribbon
0x22, 34	downcast ribbon
0x23, 35	careless ribbon
0x24, 36	relax ribbon
0x25, 37	snooze ribbon
0x26, 38	smile ribbon
0x27, 39	gorgeous ribbon
0x28, 40	royal ribbon
0x29, 41	gorgeous royal ribbon
0x2A, 42	footprint ribbon
0x2B, 43	record ribbon
0x2C, 44	history ribbon
0x2D, 45	legend ribbon
0x2E, 46	red ribbon
0x2F, 47	green ribbon
0x30, 48	blue ribbon
0x31, 49	festival ribbon
0x32, 50	carnival ribbon
0x33, 51	classic ribbon
0x34, 52	premier ribbon
0x35, 53	ribbon
0x36, 54	move1
0x37, 55	move2
0x38, 56	move3
0x39, 57	move4
0x3A, 58	move1 current pp
0x3B, 59	move2 current pp
0x3C, 60	move3 current pp
0x3D, 61	move4 current pp
0x3E, 62	move1 ppup count
0x3F, 63	move2 ppup count
0x40, 64	move3 ppup count
0x41, 65	move4 ppup count
0x42, 66	move1 max pp
0x43, 67	move2 max pp
0x44, 68	move3 max pp
0x45, 69	move4 max pp
0x46, 70	hp iv
0x47, 71	atk iv
0x48, 72	def iv
0x49, 73	spe iv
0x4A, 74	spa iv
0x4B, 75	spd iv
0x4C, 76	is egg
0x4D, 77	cool ribbon
0x4E, 78	cool ribbon super
0x4F, 79	cool ribbon hyper
0x50, 80	cool ribbon master
0x51, 81	beauty ribbon
0x52, 82	beauty ribbon super
0x53, 83	beauty ribbon hyper
0x54, 84	beauty ribbon master
0x55, 85	cute ribbon
0x56, 86	cute ribbon super
0x57, 87	cute ribbon hyper
0x58, 88	cute ribbon master
0x59, 89	smart ribbon
0x5A, 90	smart ribbon super
0x5B, 91	smart ribbon hyper
0x5C, 92	smart ribbon master
0x5D, 93	tough ribbon
0x5E, 94	tough ribbon super
0x5F, 95	tough ribbon hyper
0x60, 96	tough ribbon master
0x61, 97	champion ribbon
0x62, 98	winning ribbon
0x63, 99	victory ribbon
0x64, 100	artist ribbon
0x65, 101	effort ribbon
0x66, 102	marine ribbon
0x67, 103	land ribbon
0x68, 104	sky ribbon
0x69, 105	country ribbon
0x6A, 106	national ribbon
0x6B, 107	earth ribbon
0x6C, 108	world ribbon
0x6D, 109	
0x6E, 110	gender(0 male, 1 female)
0x6F, 111	form
0x70, 112	nature
0x71, 113	has dw abil
0x72, 114	
0x73, 115	name
0x74, 116	nickname
0x75, 117	is nicknamed
0x76, 118	
0x77, 119	game of origin
0x78, 120	
0x79, 121	
0x7A, 122	
0x7B, 123	
0x7C, 124	
0x7D, 125	
0x7E, 126	
0x7F, 127	
0x80, 128	
0x81, 129	
0x82, 130	
0x83, 131	
0x84, 132	
0x85, 133	
0x86, 134	
0x87, 135	
0x88, 136	
0x89, 137	
0x8A, 138	
0x8B, 139	
0x8C, 140	
0x8D, 141	OT name in
0x8E, 142	OT name out
0x8F, 143	year met (0-99)
0x90, 144	month met(1-12)
0x91, 145	day met(1-end of month)
0x92, 146	egg year met(0-99)
0x93, 147	egg month met(1-12)
0x94, 148	egg day met(1-end of month)
0x95, 149	location
0x96, 150	egg met location
0x97, 151	pokerus
0x98, 152	poke ball
0x99, 153	met at level
0x9A, 154	set if OT gender is female
0x9B, 155	
0x9C, 156	
0x9D, 157	
0x9E, 158	level
0x9F, 159	capsule seal index
0xA0, 160	current hp
0xA1, 161	max hp
0xA2, 162	attack
0xA3, 163	defense
0xA4, 164	speed
0xA5, 165	spa
0xA6, 166	spd
0xA7, 167	mail
0xA8, 168	
0xA9, 169	is slot filled
0xAA, 170	is egg(both sanity bits)
0xAB, 171	get species if filled slot is egg(ret 0 otherwise)
0xAC, 172	
0xAD, 173	is species NOT nido F/M
0xAE, 174	pkm type
0xAF, 175	pkm type
0xB0, 176	
0xB1, 177	
0xB2, 178	N's poke