Pokémon data structure (Generation IV): Difference between revisions

→‎Alternate forms: This all can fit in one table just fine... And a single/continuous column of values is a little better than splitting them over multiple columns
(→‎Alternate forms: This all can fit in one table just fine... And a single/continuous column of values is a little better than splitting them over multiple columns)
(14 intermediate revisions by 11 users not shown)
Line 1: Line 1:
Boxed Pokémon in the games {{v2|Diamond and Pearl|s}} are stored in a 136-byte structure. All unencrypted values are stored in little-endian format. The game encrypts the data when it is stored into [[Save data structure in the DS|save data]]. In-party Pokémon have additional values appended to them to hold calculated stats. The information below describes the boxed Pokémon data format.
Boxed Pokémon in the games {{v2|Diamond and Pearl|s}} are stored in a 136-byte structure. All unencrypted values are stored in little-endian format. The game encrypts the data when it is stored into [[Save data structure in the DS|save data]]. In-party Pokémon have additional values appended to them to hold calculated stats. The information below describes the boxed Pokémon data format.


== Checksum ==
== Checksum ==
Line 12: Line 12:
# Truncate the sum to sixteen bits.
# Truncate the sum to sixteen bits.


== Block Shuffling ==
== Block shuffling ==


The 128 bytes of Pokémon data are split into four 32-byte blocks for shuffling. The blocks are shuffled according to a shift value derived from the [[personality value]]. Given the personality value ''pv'', the expression yielding the shift value is:
The 128 bytes of Pokémon data are split into four 32-byte blocks for shuffling. The blocks are shuffled according to a shift value derived from the [[personality value]]. Given the personality value ''pv'', the expression yielding the shift value is:
: ''((pv >> 0xD) & 0x1F) % 24''
: ''((pv & 0x3E000) >> 0xD) % 24''
The right shifting (pv >> 0xD) is equivalent to a division for 8192.
The right shifting (>> 0xD) is equivalent to a division of 8192.


To shuffle the blocks, take the four blocks of unencrypted data to be ''A'', ''B'', ''C'', and ''D''. The blocks shall be rearranged in the encrypted data according to this table:
To shuffle the blocks, take the four blocks of unencrypted data, ''A'', ''B'', ''C'', and ''D''. The blocks shall be rearranged in the encrypted data according to the Block Order column of the following table. (To unshuffle, use the Inverse column.)


{| border="1" style="border: 1px solid #999; border-collapse: collapse;"
{| border="1" style="border: 1px solid #999; border-collapse: collapse; text-align:center"
|- style="background: #ccc;" align="center"
|- style="background: #ccc;"
! Shift Value (decimal)
! Shift Value (decimal)
! Block Order
! Block Order
|- style="background: #eee;" align="center"
! Inverse
|- style="background: #eee;"
| 00
| 00
| ABCD
| ABCD
|- style="background: #ddd;" align="center"
| ABCD
|- style="background: #ddd;"
| 01
| 01
| ABDC
| ABDC
|- style="background: #eee;" align="center"
| ABDC
|- style="background: #eee;"
| 02
| 02
| ACBD
| ACBD
|- style="background: #ddd;" align="center"
| ACBD
|- style="background: #ddd;"
| 03
| 03
| ACDB
| ACDB
|- style="background: #eee;" align="center"
| ADBC
|- style="background: #eee;"
| 04
| 04
| ADBC
| ADBC
|- style="background: #ddd;" align="center"
| ACDB
|- style="background: #ddd;"
| 05
| 05
| ADCB
| ADCB
|- style="background: #eee;" align="center"
| ADCB
|- style="background: #eee;"
| 06
| 06
| BACD
| BACD
|- style="background: #ddd;" align="center"
| BACD
|- style="background: #ddd;"
| 07
| 07
| BADC
| BADC
|- style="background: #eee;" align="center"
| BADC
|- style="background: #eee;"
| 08
| 08
| BCAD
| BCAD
|- style="background: #ddd;" align="center"
| CABD
|- style="background: #ddd;"
| 09
| 09
| BCDA
| BCDA
|- style="background: #eee;" align="center"
| DABC
|- style="background: #eee;"
| 10
| 10
| BDAC
| BDAC
|- style="background: #ddd;" align="center"
| CADB
|- style="background: #ddd;"
| 11
| 11
| BDCA
| BDCA
|- style="background: #eee;" align="center"
| DACB
|- style="background: #eee;"
| 12
| 12
| CABD
| CABD
|- style="background: #ddd;" align="center"
| BCAD
|- style="background: #ddd;"
| 13
| 13
| CADB
| CADB
|- style="background: #eee;" align="center"
| BDAC
|- style="background: #eee;"
| 14
| 14
| CBAD
| CBAD
|- style="background: #ddd;" align="center"
| CBAD
|- style="background: #ddd;"
| 15
| 15
| CBDA
| CBDA
|- style="background: #eee;" align="center"
| DBAC
|- style="background: #eee;"
| 16
| 16
| CDAB
| CDAB
|- style="background: #ddd;" align="center"
| CDAB
|- style="background: #ddd;"
| 17
| 17
| CDBA
| CDBA
|- style="background: #eee;" align="center"
| DCAB
|- style="background: #eee;"
| 18
| 18
| DABC
| DABC
|- style="background: #ddd;" align="center"
| BCDA
|- style="background: #ddd;"
| 19
| 19
| DACB
| DACB
|- style="background: #eee;" align="center"
| BDCA
|- style="background: #eee;"
| 20
| 20
| DBAC
| DBAC
|- style="background: #ddd;" align="center"
| CBDA
|- style="background: #ddd;"
| 21
| 21
| DBCA
| DBCA
|- style="background: #eee;" align="center"
| DBCA
|- style="background: #eee;"
| 22
| 22
| DCAB
| DCAB
|- style="background: #ddd;" align="center"
| CDBA
|- style="background: #ddd;"
| 23
| 23
| DCBA
| DCBA
| DCBA
|}
|}
Line 100: Line 125:
== Encryption ==
== Encryption ==


The encryption uses the pseudorandom number generator (PRNG), a linear congruential generator. Elements of the PRNG can be described with the recursive function:
The encryption uses the [[Pseudorandom number generation in Pokémon|pseudorandom number generator (PRNG)]], a linear congruential generator. Elements of the PRNG can be described with the recursive function:
: ''X[n+1] = (0x41C64E6D * X[n] + 0x6073)''
: ''X[n+1] = (0x41C64E6D * X[n] + 0x6073)''


To decrypt the data, given a function ''rand()'' which returns the upper 16 bits of consecutive results of the above given function:
To decrypt the data, given a function ''rand()'' which returns the upper 16 bits of consecutive results of the above given function:
# Seed the PRNG with the checksum (let ''X[n]'' be the checksum),
# Seed the PRNG with the checksum (let ''X[n]'' be the checksum).
# Sequentially, for each 2-byte word ''Y'' from 0x08 to 0x87, apply the transformation: ''unencryptedByte = Y xor rand()''
# Sequentially, for each 2-byte word ''Y'' from 0x08 to 0x87, apply the transformation: ''unencryptedByte = Y xor rand()''
# Un-shuffle the blocks using the block shuffling algorithm above.
# Unshuffle the blocks using the block shuffling algorithm above.


To encrypt the data:
To encrypt the data:
Line 114: Line 139:


== Unencrypted bytes ==
== Unencrypted bytes ==
{| border="1" style="border: 1px solid #999; border-collapse: collapse;"
{| border="1" style="border: 1px solid #999; border-collapse: collapse; text-align:center"
|- style="background: #ccc;" align="center"
|- style="background: #ccc;"
! Offset
! Offset
! Contents
! Contents
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x00-0x03
| 0x00-0x03
| [[Personality value]]
| [[Personality value]]
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x04-0x05
| 0x04-0x05
| ''Unknown''
| ''Unused variable''
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x06-0x07
| 0x06-0x07
| Checksum
| Checksum
Line 132: Line 157:
=== Block A ===
=== Block A ===


{| border="1" style="border: 1px solid #999; border-collapse: collapse;"
{| border="1" style="border: 1px solid #999; border-collapse: collapse; text-align:center"
|- style="background: #ccc;" align="center"
|- style="background: #ccc;"
! Offset
! Offset
! Contents
! Contents
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x08-0x09  
| 0x08-0x09
| Species ID
| Species ID
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x0A-0x0B  
| 0x0A-0x0B
| Held Item
| Held Item
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x0C-0x0D
| 0x0C-0x0D
| OT ID
| OT ID
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x0E-0x0F  
| 0x0E-0x0F
| OT Secret ID
| OT Secret ID
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x10-0x13
| 0x10-0x13
| [[Experience|Experience points]]
| [[Experience|Experience points]]
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x14
| 0x14
| Friendship/Egg Steps to Hatch
| Friendship/Egg Steps to Hatch
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x15
| 0x15
| [[Ability]]
| [[Ability]]
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x16
| 0x16
| Markings
| Markings
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x17
| 0x17
| Country of Origin
| Language of origin
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x18-0x1D
| 0x18
| [[Effort values]]
| HP EVs
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x1E-0x23
| 0x19
| Contest stats
| Attack EVs
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x1A
| Defense EVs
|- style="background: #eee;"
| 0x1B
| Speed EVs
|- style="background: #ddd;"
| 0x1C
| Sp. Atk EVs
|- style="background: #eee;"
| 0x1D
| Sp. Def. EVs
|- style="background: #ddd;"
| 0x1E
| Cool Contest stat
|- style="background: #eee;"
| 0x1F
| Beauty Contest stat
|- style="background: #ddd;"
| 0x20
| Cute Contest stat
|- style="background: #eee;"
| 0x21
| Smart Contest stat
|- style="background: #ddd;"
| 0x22
| Tough Contest stat
|- style="background: #eee;"
| 0x23
| Sheen
|- style="background: #ddd;"
| 0x24-0x27
| 0x24-0x27
| Ribbons
| Sinnoh Ribbons Set 1
|}
|}


=== Block B ===
=== Block B ===
{| border="1" style="border: 1px solid #999; border-collapse: collapse;"
{| border="1" style="border: 1px solid #999; border-collapse: collapse; text-align:center"
|- style="background: #ccc;" align="center"
|- style="background: #ccc;"
! Offset
! Offset
! Contents
! Contents
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x28-0x2F  
| 0x28-0x2F
| Moveset
| Moveset
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x30-0x33  
| 0x30-0x33
| Move PP
| Move PP
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x34-0x37
| 0x34-0x37
| Move PP Ups
| Move PP Ups
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x38-0x3B
| 0x38-0x3B
| Bits 0-29 - [[Individual values]]<br>Bit 30 - IsNicknamed Flag<br>Bit 31 - IsEgg Flag  
| Bits 0-29 - [[Individual values]]<br/>HP ( [0-31] << 0 )<br>Attack ( [0-31] << 5 )<br>Defense ( [0-31] << 10 )<br>Speed ( [0-31] << 15 )<br>Sp. Atk. ( [0-31] << 20 )<br>Sp. Def. ( [0-31] << 25 )<br>Bit 30 - IsEgg Flag<br>Bit 31 - IsNicknamed Flag
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x3C-0x3F
| 0x3C-0x3F
| Ribbons 2
| Hoenn Ribbon Set
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x40-0x41
| 0x40
| Bit 0 - Fateful Encountered Flag<br>Bit 1 - Female<br>Bit 2 - Genderless<br>Bit 3-15 - Alternate Forms (Form Index << 3)
| Bit 0 - [[Fateful encounter]] Flag<br>Bit 1 - Female<br>Bit 2 - Genderless<br>Bit 3-7 - Alternate Forms (Form Index << 3)
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x41
| Shiny Leaves (HGSS)<br>Bit 5 - Leaf Crown<br>Bits 0–4 - Leaves A–E (bit 0 is leftmost)
|- style="background: #ddd;"
| 0x42-0x43
| 0x42-0x43
| ''Unknown''
| ''Unused''
|- style="background: #ddd;" align="center"
|- style="background: #eee;"
| 0x44-0x45
| 0x44-0x45
| Platinum Egg Location
| Platinum Egg Location
|- style="background: #eee;" align="center"
|- style="background: #ddd;"
| 0x46-0x47
| 0x46-0x47
| Platinum Met at Location
| Platinum Met at Location
Line 209: Line 267:


=== Block C ===
=== Block C ===
{| border="1" style="border: 1px solid #999; border-collapse: collapse;"
{| border="1" style="border: 1px solid #999; border-collapse: collapse; text-align:center"
|- style="background: #ccc;" align="center"
|- style="background: #ccc;"
! Offset
! Offset
! Contents
! Contents
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x48-0x5D
| 0x48-0x5D
| Nickname
| Nickname
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x5E-0x5F
| 0x5E
| Hometown
| ''Unused''
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x5F
| Game of origin
|- style="background: #ddd;"
| 0x60-0x63
| 0x60-0x63
| Contests
| Sinnoh Ribbons Set 2
|- style="background: #ddd;" align="center"
|- style="background: #eee;"
| 0x64-0x67
| 0x64-0x67
| ''Unknown''
| ''Unused''
|}
|}


=== Block D ===
=== Block D ===
{| border="1" style="border: 1px solid #999; border-collapse: collapse;"
{| border="1" style="border: 1px solid #999; border-collapse: collapse; text-align:center"
|- style="background: #ccc;" align="center"
|- style="background: #ccc;"
! Offset
! Offset
! Contents
! Contents
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x68-0x77  
| 0x68-0x77
| OT Name
| OT Name
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x78-0x7A  
| 0x78-0x7A
| Date Egg Received
| Date Egg Received
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x7B-0x7D
| 0x7B-0x7D
| Date Met
| Date Met
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x7E-0x7F
| 0x7E-0x7F
| Diamond/Pearl Egg Location
| Diamond/Pearl Egg Location
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x80-0x81
| 0x80-0x81
| Diamond/Pearl Met At Location
| Diamond/Pearl Met At Location
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x82
| 0x82
| [[Pokérus]]
| [[Pokérus]]
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x83
| 0x83
| Poké Ball
| Poké Ball
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x84
| 0x84
| Bit 0-6 - Met At Level<br>Bit 7 - Female OT Gender
| Bit 0-6 - Met At Level<br>Bit 7 - Female OT Gender
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x85
| 0x85
| Encounter Type
| Encounter Type
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x86
| 0x86
| HG/SS Poké Ball
| HG/SS Poké Ball
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x87
| 0x87
| [[Performance]] (unused in DPPt)
|}
== Battle stats ==
The battle stats are encrypted in the same manner, however the seed is not the checksum, it is the PID, and the bytes are not shuffled.
=== Encrypted bytes ===
{| border="1" style="border: 1px solid #999; border-collapse: collapse; text-align:center"
|- style="background: #ccc;"
! Offset
! Contents
|- style="background: #eee;"
| 0x88
| Bits 0-2 - Asleep (0-7 rounds)<br>Bit 3 - Poisoned<br>Bit 4 - Burned<br>Bit 5 - Frozen<br>Bit 6 - Paralyzed<br>Bit 7 - Toxic
|- style="background: #ddd;"
| 0x89
| ''Unknown'' - Flags - Max Value 0xF0
|- style="background: #eee;"
| 0x8A-0x8B
| ''Unknown''
| ''Unknown''
|- style="background: #ddd;"
| 0x8C
| Level
|- style="background: #eee;"
| 0x8D
| Capsule Index (Seals)
|- style="background: #ddd;"
| 0x8E-0x8F
| Current HP
|- style="background: #eee;"
| 0x90-0x91
| Max HP
|- style="background: #ddd;"
| 0x92-0x93
| Attack
|- style="background: #eee;"
| 0x94-0x95
| Defense
|- style="background: #ddd;"
| 0x96-0x97
| Speed
|- style="background: #eee;"
| 0x98-0x99
| Special Attack
|- style="background: #ddd;"
| 0x9A-0x9B
| Special Defense
|- style="background: #eee;"
| 0x9C-0xD3
| ''Unknown'' - Contains Trash Data
|- style="background: #ddd;"
| 0xD4-0xEB
| Seal Coordinates
|}
== Language of origin ==
{| border="1" style="border: 1px solid #999; border-collapse: collapse; text-align:center"
! Value
! Language
|- style="background: #eee;"
| 0x1
| 日本語 (Japanese)
|- style="background: #ddd;"
| 0x2
| English
|- style="background: #eee;"
| 0x3
| Français (French)
|- style="background: #ddd;"
| 0x4
| Italiano (Italian)
|- style="background: #eee;"
| 0x5
| Deutsch (German)
|- style="background: #ddd;"
| 0x7
| Español (Spainish)
|- style="background: #eee;"
| 0x8
| 한국어 (Korean)
|}
== Markings ==
{| border="1" style="border: 1px solid #999; border-collapse: collapse; text-align:center"
! Bit
! Marking
|- style="background: #eee;"
| 0x01
| Circle
|- style="background: #ddd;"
| 0x02
| Triangle
|- style="background: #eee;"
| 0x04
| Square
|- style="background: #ddd;"
| 0x08
| Heart
|- style="background: #eee;"
| 0x10
| Star
|- style="background: #ddd;"
| 0x20
| Diamond
|}
== Alternate forms ==
[[List of Pokémon with form differences|Alternate forms]] are stored at offset 0x40 of the Pokemon structure. Each form follows the pattern of ''index << 3'' where index starts at zero for the main form.
Rotom's alternate forms, Giratina's Origin Forme, and Shaymin's Sky Forme will only be displayed in Pokemon Platinum. Rotom may be traded between Diamond, Pearl, and Platinum without losing the alternate form.
{| border="1" style="border: 1px solid #999; border-collapse: collapse; text-align: center"
! Byte || Unown || Deoxys || Burmy/Wormadam || Shellos/Gastrodon || Rotom || Giratina || Shaymin || Arceus
|- style="background: #eee"
| 0x00 || A || Normal || Plant || West || Normal || Altered || Land || Normal
|- style="background: #ddd"
| 0x08 || B || Attack || Sandy || East || Heat || Origin || Sky || Fist
|- style="background: #eee"
| 0x10 || C || Defense || Trash || || Wash || || || Sky
|- style="background: #ddd"
| 0x18 || D || Speed || || || Frost || || || Toxic
|- style="background: #eee"
| 0x20 || E || || || || Fan || || || Earth
|- style="background: #ddd"
| 0x28 || F || || || || Mow || || || Stone
|- style="background: #eee"
| 0x30 || G || || || || || || || Insect
|- style="background: #ddd"
| 0x38 || H || || || || || || || Spooky
|- style="background: #eee"
| 0x40 || I || || || || || || || Iron
|- style="background: #ddd"
| 0x48 || J || || || || || || || Flame
|- style="background: #eee"
| 0x50 || K || || || || || || || Splash
|- style="background: #ddd"
| 0x58 || L || || || || || || || Meadow
|- style="background: #eee"
| 0x60 || M || || || || || || || Zap
|- style="background: #ddd"
| 0x68 || N || || || || || || || Mind
|- style="background: #eee"
| 0x70 || O || || || || || || || Icicle
|- style="background: #ddd"
| 0x78 || P || || || || || || || Draco
|- style="background: #eee"
| 0x80 || Q || || || || || || || Dread
|- style="background: #ddd"
| 0x88 || R || || || || || || || ???
|- style="background: #eee"
| 0x90 || S || || || || || || ||
|- style="background: #ddd"
| 0x98 || T || || || || || || ||
|- style="background: #eee"
| 0xA0 || U || || || || || || ||
|- style="background: #ddd"
| 0xA8 || V || || || || || || ||
|- style="background: #eee"
| 0xB0 || W || || || || || || ||
|- style="background: #ddd"
| 0xB8 || X || || || || || || ||
|- style="background: #eee"
| 0xC0 || Y || || || || || || ||
|- style="background: #ddd"
| 0xC8 || Z || || || || || || ||
|- style="background: #eee"
| 0xD0 || ! || || || || || || ||
|- style="background: #ddd"
| 0xD8 || ? || || || || || || ||
|}
== Encounter types ==
{| border="1" style="border: 1px solid #999; border-collapse: collapse; text-align:center"
! Value
! Encounter
|- style="background: #eee;"
| 0x0
| Pal Park, Egg, Hatched, Special Event
|- style="background: #ddd;"
| 0x2
| Tall Grass
|- style="background: #eee;"
| 0x4
| Dialga/Palkia In-Game Event
|- style="background: #ddd;"
| 0x5
| Cave, Hall of Origin
|- style="background: #eee;"
| 0x7
| Surfing, Fishing
|- style="background: #ddd;"
| 0x9
| Building
|- style="background: #eee;"
| 0xA
| Great Marsh (Safari Zone)
|- style="background: #ddd;"
| 0xC
| Starter, Fossil, Gift (Eevee)
|}
|}


== Ribbons ==
== Ribbons ==
DP stores the ribbon data as bitfields in 16-bit words. Given below are the bytewise representations of the ribbon bitfields:
DPPt stores the ribbon data as bitfields in 16-bit words. Given below are the bytewise representations of the ribbon bitfields:


{| border="1" style="border: 1px solid #999; border-collapse: collapse;"
=== Sinnoh Ribbon Set 1 ===
{| border="1" style="border: 1px solid #999; border-collapse: collapse; text-align:center"
! Bit
! Bit
! Ribbon
! Ribbon
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x25 & 0x01
| 0x24 & 0x01
| Sinnoh Champ Ribbon
| Sinnoh Champ Ribbon
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x25 & 0x02
| 0x24 & 0x02
| Ability Ribbon
| Ability Ribbon
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x25 & 0x04
| 0x24 & 0x04
| Great Ability Ribbon
| Great Ability Ribbon
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x25 & 0x08
| 0x24 & 0x08
| Double Ability Ribbon
| Double Ability Ribbon
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x25 & 0x10
| 0x24 & 0x10
| Multi Ability Ribbon
| Multi Ability Ribbon
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x25 & 0x20
| 0x24 & 0x20
| Pair Ability Ribbon
| Pair Ability Ribbon
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x25 & 0x40
| 0x24 & 0x40
| World Ability Ribbon
| World Ability Ribbon
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x25 & 0x80
| 0x24 & 0x80
| Alert Ribbon
| Alert Ribbon
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x24 & 0x01
| 0x25 & 0x01
| Shock Ribbon
| Shock Ribbon
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x24 & 0x02
| 0x25 & 0x02
| Downcast Ribbon
| Downcast Ribbon
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x24 & 0x04
| 0x25 & 0x04
| Careless Ribbon
| Careless Ribbon
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x24 & 0x08
| 0x25 & 0x08
| Relax Ribbon
| Relax Ribbon
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x24 & 0x10
| 0x25 & 0x10
| Snooze Ribbon
| Snooze Ribbon
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x24 & 0x20
| 0x25 & 0x20
| Smile Ribbon
| Smile Ribbon
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x24 & 0x40
| 0x25 & 0x40
| Gorgeous Ribbon
| Gorgeous Ribbon
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x24 & 0x80
| 0x25 & 0x80
| Royal Ribbon
| Royal Ribbon
|}
|- style="background: #eee;"
 
| 0x26 & 0x01
 
{| border="1" style="border: 1px solid #999; border-collapse: collapse;"
! Bit
! Ribbon
|- style="background: #eee;" align="center"
| 0x27 & 0x01
| Gorgeous Royal Ribbon
| Gorgeous Royal Ribbon
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x27 & 0x02
| 0x26 & 0x02
| Footprint Ribbon
| Footprint Ribbon
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x27 & 0x04
| 0x26 & 0x04
| Record Ribbon
| Record Ribbon
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x27 & 0x08
| 0x26 & 0x08
| History Ribbon
| History Ribbon
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x27 & 0x10
| 0x26 & 0x10
| Legend Ribbon
| Legend Ribbon
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x27 & 0x20
| 0x26 & 0x20
| Red Ribbon
| Red Ribbon
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x27 & 0x40
| 0x26 & 0x40
| Green Ribbon
| Green Ribbon
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x27 & 0x80
| 0x26 & 0x80
| Blue Ribbon
| Blue Ribbon
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x26 & 0x01
| 0x27 & 0x01
| Festival Ribbon
| Festival Ribbon
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x26 & 0x02
| 0x27 & 0x02
| Carnival Ribbon
| Carnival Ribbon
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x26 & 0x04
| 0x27 & 0x04
| Classic Ribbon
| Classic Ribbon
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x26 & 0x08
| 0x27 & 0x08
| Premier Ribbon
| Premier Ribbon
|}
|}


=== Sinnoh Ribbon Set 2 ===
{| border="1" style="border: 1px solid #999; border-collapse: collapse; text-align:center"
! Bit
! Ribbon
|- style="background: #eee;"
| 0x60 & 0x01
| Cool Ribbon
|- style="background: #ddd;"
| 0x60 & 0x02
| Cool Ribbon Great
|- style="background: #eee;"
| 0x60 & 0x04
| Cool Ribbon Ultra
|- style="background: #ddd;"
| 0x60 & 0x08
| Cool Ribbon Master
|- style="background: #eee;"
| 0x60 & 0x10
| Beauty Ribbon
|- style="background: #ddd;"
| 0x60 & 0x20
| Beauty Ribbon Great
|- style="background: #eee;"
| 0x60 & 0x40
| Beauty Ribbon Ultra
|- style="background: #ddd;"
| 0x60 & 0x80
| Beauty Ribbon Master
|- style="background: #eee;"
| 0x61 & 0x01
| Cute Ribbon
|- style="background: #ddd;"
| 0x61 & 0x02
| Cute Ribbon Great
|- style="background: #eee;"
| 0x61 & 0x04
| Cute Ribbon Ultra
|- style="background: #ddd;"
| 0x61 & 0x08
| Cute Ribbon Master
|- style="background: #eee;"
| 0x61 & 0x10
| Smart Ribbon
|- style="background: #ddd;"
| 0x61 & 0x20
| Smart Ribbon Great
|- style="background: #eee;"
| 0x61 & 0x40
| Smart Ribbon Ultra
|- style="background: #ddd;"
| 0x61 & 0x80
| Smart Ribbon Master
|- style="background: #eee;"
| 0x62 & 0x01
| Tough Ribbon
|- style="background: #ddd;"
| 0x62 & 0x02
| Tough Ribbon Great
|- style="background: #eee;"
| 0x62 & 0x04
| Tough Ribbon Ultra
|- style="background: #ddd;"
| 0x62 & 0x08
| Tough Ribbon Master
|}


{| border="1" style="border: 1px solid #999; border-collapse: collapse;"
=== Hoenn Ribbon Set ===
 
{| border="1" style="border: 1px solid #999; border-collapse: collapse; text-align:center"
! Bit
! Bit
! Ribbon
! Ribbon
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x3D & 0x01
| 0x3C & 0x01
| Cool Ribbon
| Cool Ribbon
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x3D & 0x02
| 0x3C & 0x02
| Cool Ribbon Super
| Cool Ribbon Super
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x3D & 0x04
| 0x3C & 0x04
| Cool Ribbon Hyper
| Cool Ribbon Hyper
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x3D & 0x08
| 0x3C & 0x08
| Cool Ribbon Master
| Cool Ribbon Master
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x3D & 0x10
| 0x3C & 0x10
| Beauty Ribbon
| Beauty Ribbon
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x3D & 0x20
| 0x3C & 0x20
| Beauty Ribbon Super
| Beauty Ribbon Super
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x3D & 0x40
| 0x3C & 0x40
| Beauty Ribbon Hyper
| Beauty Ribbon Hyper
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x3D & 0x80
| 0x3C & 0x80
| Beauty Ribbon Master
| Beauty Ribbon Master
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x3C & 0x01
| 0x3D & 0x01
| Cute Ribbon
| Cute Ribbon
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x3C & 0x02
| 0x3D & 0x02
| Cute Ribbon Super
| Cute Ribbon Super
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x3C & 0x04
| 0x3D & 0x04
| Cute Ribbon Hyper
| Cute Ribbon Hyper
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x3C & 0x08
| 0x3D & 0x08
| Cute Ribbon Master
| Cute Ribbon Master
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x3C & 0x10
| 0x3D & 0x10
| Smart Ribbon
| Smart Ribbon
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x3C & 0x20
| 0x3D & 0x20
| Smart Ribbon Super
| Smart Ribbon Super
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x3C & 0x40
| 0x3D & 0x40
| Smart Ribbon Hyper
| Smart Ribbon Hyper
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x3C & 0x80
| 0x3D & 0x80
| Smart Ribbon Master
| Smart Ribbon Master
|}
|- style="background: #eee;"
 
| 0x3E & 0x01
 
{| border="1" style="border: 1px solid #999; border-collapse: collapse;"
! Bit
! Ribbon
|- style="background: #eee;" align="center"
| 0x3F & 0x01
| Tough Ribbon
| Tough Ribbon
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x3F & 0x02
| 0x3E & 0x02
| Tough Ribbon Super
| Tough Ribbon Super
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x3F & 0x04
| 0x3E & 0x04
| Tough Ribbon Hyper
| Tough Ribbon Hyper
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x3F & 0x08
| 0x3E & 0x08
| Tough Ribbon Master
| Tough Ribbon Master
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x3F & 0x10
| 0x3E & 0x10
| Champion Ribbon
| Champion Ribbon
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x3F & 0x20
| 0x3E & 0x20
| Winning Ribbon
| Winning Ribbon
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x3F & 0x40
| 0x3E & 0x40
| Victory Ribbon
| Victory Ribbon
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x3F & 0x80
| 0x3E & 0x80
| Artist Ribbon
| Artist Ribbon
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x3E & 0x01
| 0x3F & 0x01
| Effort Ribbon
| Effort Ribbon
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x3E & 0x02
| 0x3F & 0x02
| Marine Ribbon
| Marine Ribbon
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x3E & 0x04
| 0x3F & 0x04
| Land Ribbon
| Land Ribbon
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x3E & 0x08
| 0x3F & 0x08
| Sky Ribbon
| Sky Ribbon
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x3E & 0x10
| 0x3F & 0x10
| Country Ribbon
| Country Ribbon
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x3E & 0x20
| 0x3F & 0x20
| National Ribbon
| National Ribbon
|- style="background: #eee;" align="center"
|- style="background: #eee;"
| 0x3E & 0x40
| 0x3F & 0x40
| Earth Ribbon
| Earth Ribbon
|- style="background: #ddd;" align="center"
|- style="background: #ddd;"
| 0x3E & 0x80
| 0x3F & 0x80
| World Ribbon
| World Ribbon
|}
|}


== Location ==
== Location ==
The party Pokémon are stored in the [[Save data structure in the DS|save file]] beginning at offset 0x00098 for the first block pair, and 0x40098 for the second block pair. Each party Pokémon is 236 bytes in size.
The party Pokémon are stored in the [[Save data structure in the DS|save file]] beginning at offset 0x00098 for the first block pair, and 0x40098 for the second block pair. Each party Pokémon is 236 bytes in size.


The PC storage Pokémon are stored in the save file from Box 1 to Box 18. They start at 0x0C104 in the first block pair, and at 0x4C104 in the second block pair. Each PC stored Pokémon is 136 bytes in size.
The PC storage Pokémon are stored in the save file from Box 1 to Box 18. They start at 0x0C104 in the first block pair, and at 0x4C104 in the second block pair. Each PC stored Pokémon is 136 bytes in size.


For a csv file of every box and box slot offset, [http://www.filefactory.com/file/a00a32g/n/BOXES_csv click here].
{{data structure}}<br>
 
{{data structure}}
{{Project Games notice|data structure}}
{{Project Games notice|data structure}}
[[es:Valores Hexadecimales Ocultos]]