PKM File Fields: Difference between revisions

From ProjectPokemon Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 26: Line 26:


u32 getPKMStat(void* pPkm, PkmField field, int data) <br>
u32 getPKMStat(void* pPkm, PkmField field, int data) <br>
(data is basically always 0 in the "get" function)
(data is basically always 0 in the "get" function- unless they're retrieving a string, in which case it's a string buffer pointer)


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

Revision as of 17:56, 12 June 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 PkmField {

FIELD_PID,
FIELD_PARTY_DECRYPT,
FIELD_BOX_DECRYPT,
FIELD_EGG_SPECIES,
FIELD_SUM,
FIELD_SPECIES,
FIELD_ITEM,
FIELD_ID,
FIELD_EXP,
FIELD_HAPPY,

-and so forth-

};

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:

u32 getPKMStat(void* pPkm, PkmField field, int data)
(data is basically always 0 in the "get" function- unless they're retrieving a string, in which case it's a string buffer pointer)

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 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	fateful encounter
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 egg received (0-99)
0x90, 144	month egg received(1-12)
0x91, 145	day egg received(1-end of month)
0x92, 146	year met/egg hatched(0-99)
0x93, 147	month met/egg hatched(1-12)
0x94, 148	day met/egg hatched(1-end of month)
0x95, 149	location met/egg received
0x96, 150	egg hatch 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	get IVs as u32, no is_egg or is_nicknamed included
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