From 08dfb0aa80668b80c4a31bd064f5f2d729e5b7f6 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Fri, 18 Aug 2017 13:49:00 -0400 Subject: 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. --- include/pokemon.h | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 include/pokemon.h (limited to 'include/pokemon.h') 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 @@ +#ifndef POKEMON_H_AD844D6F +#define POKEMON_H_AD844D6F + +#define POKEMON_NAME_LENGTH 10 +#define OT_NAME_LENGTH 7 +#define TILE_SIZE_4BPP 32 + +struct PokemonIntermediate { + u32 otId; + u32 experience; + + // the stats are calculated from the base stats, IVs, EVs, and Nature, before + // transmitting the pokemon's data, in order to keep the IVs and EVs secret. + u32 hp; + u32 attack; + u32 defense; + u32 speed; + u32 spAttack; + u32 spDefense; + + u16 species; + u16 heldItem; + u16 moves[4]; + + u8 ppBonuses; + u8 otGender:1; + u8 metLevel:7; + u8 metLocation; + u8 nickname[POKEMON_NAME_LENGTH]; + u8 otName[OT_NAME_LENGTH]; + u8 pokeball; + u8 altAbility; // waste of space but nothing to pack it with + + // the following values are generated from the personality value. + u8 nature:6; + u8 gender:1; + u8 shiny:1; + u8 unownLetter; + + // the level is calculated from the species and experience. this is mostly + // included for convenience. + u8 level; + + // instead of being represented as a number from 0 to 255, the conditions are + // transmitted as numbers from 0 to 10, so as to keep the exact condition + // values secret, since only an approximation of the condition value is ever + // visible in the game proper. the same goes for the sheen. + u8 cool; + u8 beauty; + u8 cute; + u8 smart; + u8 tough; + u8 sheen; + + // this field can have the following values: + // 0 - pokemon does not have pokerus + // 1 - pokemon has pokerus + // 2 - pokemon had pokerus at one point + u8 pokerus; +}; + +#endif /* end of include guard: POKEMON_H_AD844D6F */ -- cgit 1.4.1