about summary refs log tree commit diff stats
path: root/include/pokemon.h
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2017-08-18 13:49:00 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2017-08-18 13:49:00 -0400
commit08dfb0aa80668b80c4a31bd064f5f2d729e5b7f6 (patch)
treeb46baa9353c0919efaed4349d2207958fa0bfaf5 /include/pokemon.h
parenta19507262602fa31f9f14a9e4f4e03e375bca111 (diff)
downloadgen3uploader-08dfb0aa80668b80c4a31bd064f5f2d729e5b7f6.tar.gz
gen3uploader-08dfb0aa80668b80c4a31bd064f5f2d729e5b7f6.tar.bz2
gen3uploader-08dfb0aa80668b80c4a31bd064f5f2d729e5b7f6.zip
Started working on serializing pokemon data
The GBA program now sends serialized data about the first pokemon in the
player's party over to the Wii. This data doesn't yet include all of the
information that we will eventually want. It does, however, not transfer
any private data, specifically IVs, EVs, and the personality value. It
does this by deriving the public information (stats, nature, gender,
shiny) before sending the pokemon over. Because of this, lookup tables
for things such as base stats were needed, and given that these are
large tables, it was easier to use the tables already existent in the
game's ROM. Thus, the addresses of the three lookup tables that are now
used are necessary for each ROM that this tool supports.

I derived the addresses for version 1 of English Pokemon LeafGreen by dumping
my own copy and searching through it with a text editor. Thus, at the current
time, that cartridge is the only one that is supported. I will supplement this
soon with addresses for the other four gen 3 carts that I have, but that will
still not provide a very large amount of coverage. I have not yet decided how
to address this issue.

There is one current bug with the serialized data: the Wii doesn't seem
to see the original trainer ID. Will fix.
Diffstat (limited to 'include/pokemon.h')
-rw-r--r--include/pokemon.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/include/pokemon.h b/include/pokemon.h new file mode 100644 index 0000000..93766ba --- /dev/null +++ b/include/pokemon.h
@@ -0,0 +1,62 @@
1#ifndef POKEMON_H_AD844D6F
2#define POKEMON_H_AD844D6F
3
4#define POKEMON_NAME_LENGTH 10
5#define OT_NAME_LENGTH 7
6#define TILE_SIZE_4BPP 32
7
8struct PokemonIntermediate {
9 u32 otId;
10 u32 experience;
11
12 // the stats are calculated from the base stats, IVs, EVs, and Nature, before
13 // transmitting the pokemon's data, in order to keep the IVs and EVs secret.
14 u32 hp;
15 u32 attack;
16 u32 defense;
17 u32 speed;
18 u32 spAttack;
19 u32 spDefense;
20
21 u16 species;
22 u16 heldItem;
23 u16 moves[4];
24
25 u8 ppBonuses;
26 u8 otGender:1;
27 u8 metLevel:7;
28 u8 metLocation;
29 u8 nickname[POKEMON_NAME_LENGTH];
30 u8 otName[OT_NAME_LENGTH];
31 u8 pokeball;
32 u8 altAbility; // waste of space but nothing to pack it with
33
34 // the following values are generated from the personality value.
35 u8 nature:6;
36 u8 gender:1;
37 u8 shiny:1;
38 u8 unownLetter;
39
40 // the level is calculated from the species and experience. this is mostly
41 // included for convenience.
42 u8 level;
43
44 // instead of being represented as a number from 0 to 255, the conditions are
45 // transmitted as numbers from 0 to 10, so as to keep the exact condition
46 // values secret, since only an approximation of the condition value is ever
47 // visible in the game proper. the same goes for the sheen.
48 u8 cool;
49 u8 beauty;
50 u8 cute;
51 u8 smart;
52 u8 tough;
53 u8 sheen;
54
55 // this field can have the following values:
56 // 0 - pokemon does not have pokerus
57 // 1 - pokemon has pokerus
58 // 2 - pokemon had pokerus at one point
59 u8 pokerus;
60};
61
62#endif /* end of include guard: POKEMON_H_AD844D6F */