diff options
Diffstat (limited to 'gba/source/gamedata.h')
-rw-r--r-- | gba/source/gamedata.h | 191 |
1 files changed, 187 insertions, 4 deletions
diff --git a/gba/source/gamedata.h b/gba/source/gamedata.h index 4d0a2a9..247626a 100644 --- a/gba/source/gamedata.h +++ b/gba/source/gamedata.h | |||
@@ -21,9 +21,192 @@ | |||
21 | 21 | ||
22 | #define LANG_JAPAN ((*(u8*)(0x80000AF)) == 'J') | 22 | #define LANG_JAPAN ((*(u8*)(0x80000AF)) == 'J') |
23 | 23 | ||
24 | bool initSaveData( | 24 | typedef const u32 (*ExperienceTables)[101]; |
25 | pSaveBlock1* SaveBlock1, | 25 | |
26 | pSaveBlock2* SaveBlock2, | 26 | struct GameData { |
27 | pSaveBlock3* SaveBlock3); | 27 | pSaveBlock1 SaveBlock1; |
28 | pSaveBlock2 SaveBlock2; | ||
29 | pSaveBlock3 SaveBlock3; | ||
30 | struct BaseStats* baseStats; | ||
31 | ExperienceTables expTables; | ||
32 | const u16* natOrder; | ||
33 | }; | ||
34 | |||
35 | bool initSaveData(struct GameData* gameData); | ||
36 | |||
37 | /** | ||
38 | * Decrypts the substructures of a Pokémon structure, so they can be viewed or | ||
39 | * modified easily. | ||
40 | * | ||
41 | * Remember to call EncryptPokemon() afterwards. | ||
42 | * | ||
43 | * @param pkm The Pokémon to decrypt the substructures of. | ||
44 | */ | ||
45 | void DecryptPokemon(struct Pokemon* pkm); | ||
46 | |||
47 | /** | ||
48 | * Decrypts the substructures of a core Pokémon structure, so they can be viewed | ||
49 | * or modified easily. | ||
50 | * | ||
51 | * Used by DecryptPokemon(). | ||
52 | * | ||
53 | * Remember to call EncryptPokemon() afterwards. | ||
54 | * | ||
55 | * @param pkm The BoxPokemon to decrypt the substructures of. | ||
56 | */ | ||
57 | void DecryptBoxPokemon(struct BoxPokemon* pkm); | ||
58 | |||
59 | /** | ||
60 | * Encrypts the substructures of a Pokémon structure, and fixes the checksum. | ||
61 | * | ||
62 | * Must be used after DecryptPokemon() has been called, otherwise the Pokémon | ||
63 | * you decrypted and forgot to re-encrypt will become a Bad Egg. | ||
64 | * | ||
65 | * @param pkm The Pokémon to encrypt the substructures and fix | ||
66 | * the checksum of. | ||
67 | */ | ||
68 | void EncryptPokemon(struct Pokemon* pkm); | ||
69 | |||
70 | /** | ||
71 | * Encrypts the substructures of a core Pokémon structure, and fixes the | ||
72 | * checksum. | ||
73 | * | ||
74 | * Must be used after DecryptBoxPokemon() has been called, otherwise the Pokémon | ||
75 | * you decrypted and forgot to re-encrypt will become a Bad Egg. | ||
76 | * | ||
77 | * @param pkm The BoxPokemon to encrypt the substructures and fix the checksum | ||
78 | * of. | ||
79 | */ | ||
80 | void EncryptBoxPokemon(struct BoxPokemon* pkm); | ||
81 | |||
82 | /** | ||
83 | * Gets a substructure of a Pokémon structure. | ||
84 | * | ||
85 | * Call DecryptPokemon() first or the substructure data will be encrypted. | ||
86 | * | ||
87 | * @param pkm The Pokemon to get a substructure of. | ||
88 | * @param substructId The substructure to get. | ||
89 | * | ||
90 | * @return The substructure. | ||
91 | */ | ||
92 | union PokemonSubstruct* GetPokemonSubstruct(struct Pokemon* pkm,u8 substructId); | ||
93 | |||
94 | /** | ||
95 | * Gets a substructure of a core Pokémon structure. | ||
96 | * | ||
97 | * Call DecryptBoxPokemon() first or the substructure data will be encrypted. | ||
98 | * | ||
99 | * @param pkm The Pokemon to get a substructure of. | ||
100 | * @param substructId The substructure to get. | ||
101 | * | ||
102 | * @return The substructure. | ||
103 | */ | ||
104 | union PokemonSubstruct* GetBoxPokemonSubstruct( | ||
105 | struct BoxPokemon* pkm, | ||
106 | u8 substructId); | ||
107 | |||
108 | /** | ||
109 | * Gets the checksum of a core Pokémon structure. | ||
110 | * | ||
111 | * @param pkm The BoxPokemon to calculate the checksum of. | ||
112 | * | ||
113 | * @return The checksum. | ||
114 | */ | ||
115 | u16 CalculateBoxPokemonChecksum(struct BoxPokemon* pkm); | ||
116 | |||
117 | /** | ||
118 | * Fixes the checksum of a core Pokémon structure. | ||
119 | * | ||
120 | * @param pkm The BoxPokemon to fix the checksum of. | ||
121 | */ | ||
122 | void FixBoxPokemonChecksum(struct BoxPokemon* pkm); | ||
123 | |||
124 | /** | ||
125 | * Gets the zeroth substructure ("Growth") of a Pokémon structure. | ||
126 | * | ||
127 | * Call DecryptPokemon() first or the substructure data will be encrypted. | ||
128 | * | ||
129 | * @param pkm The Pokémon to get a substructure of. | ||
130 | * | ||
131 | * @return The substructure. | ||
132 | */ | ||
133 | struct PokemonSubstruct0* GetPokemonSubstruct0(struct Pokemon* pkm); | ||
134 | |||
135 | /** | ||
136 | * Gets the zeroth substructure ("Growth") of a core Pokémon structure. | ||
137 | * | ||
138 | * Call DecryptBoxPokemon() first or the substructure data will be encrypted. | ||
139 | * | ||
140 | * @param pkm The BoxPokemon to get the substructure of. | ||
141 | * | ||
142 | * @return The substructure. | ||
143 | */ | ||
144 | struct PokemonSubstruct0* GetBoxPokemonSubstruct0(struct BoxPokemon* pkm); | ||
145 | |||
146 | /** | ||
147 | * Gets the first substructure ("Attacks") of a Pokémon structure. | ||
148 | * | ||
149 | * Call DecryptPokemon() first or the substructure data will be encrypted. | ||
150 | * | ||
151 | * @param pkm The Pokémon to get a substructure of. | ||
152 | * | ||
153 | * @return The substructure. | ||
154 | */ | ||
155 | struct PokemonSubstruct1* GetPokemonSubstruct1(struct Pokemon* pkm); | ||
156 | |||
157 | /** | ||
158 | * Gets the first substructure ("Attacks") of a core Pokémon structure. | ||
159 | * | ||
160 | * Call DecryptBoxPokemon() first or the substructure data will be encrypted. | ||
161 | * | ||
162 | * @param pkm The BoxPokemon to get the substructure of. | ||
163 | * | ||
164 | * @return The substructure. | ||
165 | */ | ||
166 | struct PokemonSubstruct1* GetBoxPokemonSubstruct1(struct BoxPokemon* pkm); | ||
167 | |||
168 | /** | ||
169 | * Gets the second substructure ("EVs & Condition") of a Pokémon structure. | ||
170 | * | ||
171 | * Call DecryptPokemon() first or the substructure data will be encrypted. | ||
172 | * | ||
173 | * @param pkm The Pokémon to get a substructure of. | ||
174 | * | ||
175 | * @return The substructure. | ||
176 | */ | ||
177 | struct PokemonSubstruct2* GetPokemonSubstruct2(struct Pokemon* pkm); | ||
178 | |||
179 | /** | ||
180 | * Gets the second substructure ("EVs & Condition") of a core Pokémon structure. | ||
181 | * | ||
182 | * Call DecryptBoxPokemon() first or the substructure data will be encrypted. | ||
183 | * | ||
184 | * @param pkm The BoxPokemon to get the substructure of. | ||
185 | * | ||
186 | * @return The substructure. | ||
187 | */ | ||
188 | struct PokemonSubstruct2* GetBoxPokemonSubstruct2(struct BoxPokemon* pkm); | ||
189 | |||
190 | /** | ||
191 | * Gets the third substructure ("Miscellaneous") of a Pokémon structure. | ||
192 | * | ||
193 | * Call DecryptPokemon() first or the substructure data will be encrypted. | ||
194 | * | ||
195 | * @param pkm The Pokémon to get a substructure of. | ||
196 | * | ||
197 | * @return The substructure. | ||
198 | */ | ||
199 | struct PokemonSubstruct3* GetPokemonSubstruct3(struct Pokemon* pkm); | ||
200 | |||
201 | /** | ||
202 | * Gets the third substructure ("Miscellaneous") of a core Pokémon structure. | ||
203 | * | ||
204 | * Call DecryptBoxPokemon() first or the substructure data will be encrypted. | ||
205 | * | ||
206 | * @param pkm The BoxPokemon to get the substructure of. | ||
207 | * | ||
208 | * @return The substructure. | ||
209 | */ | ||
210 | struct PokemonSubstruct3* GetBoxPokemonSubstruct3(struct BoxPokemon* pkm); | ||
28 | 211 | ||
29 | #endif | 212 | #endif |