diff options
author | slipstream/RoL <l33twax@yahoo.com> | 2017-02-26 14:27:20 +0000 |
---|---|---|
committer | slipstream/RoL <l33twax@yahoo.com> | 2017-02-26 14:27:20 +0000 |
commit | e37cc7de9583b00166e96a6632ba25edefff43ca (patch) | |
tree | 592e49249f8e171a29cf3c140081ef054975eb59 /gba/source/libpayload.h | |
parent | fac6ea00fd51e5be1d99db44746ed046378a6c65 (diff) | |
download | gen3uploader-e37cc7de9583b00166e96a6632ba25edefff43ca.tar.gz gen3uploader-e37cc7de9583b00166e96a6632ba25edefff43ca.tar.bz2 gen3uploader-e37cc7de9583b00166e96a6632ba25edefff43ca.zip |
Major changes
- Added saveblock structures. - Changed example payload, now it warps to Hall of Fame. - Added helper library for Pokémon manipulation, checksum calculation, etc. - Removed libSave, it's not needed.
Diffstat (limited to 'gba/source/libpayload.h')
-rw-r--r-- | gba/source/libpayload.h | 160 |
1 files changed, 160 insertions, 0 deletions
diff --git a/gba/source/libpayload.h b/gba/source/libpayload.h new file mode 100644 index 0000000..4be6fb3 --- /dev/null +++ b/gba/source/libpayload.h | |||
@@ -0,0 +1,160 @@ | |||
1 | /* | ||
2 | * Example Gen3-multiboot payload by slipstream/RoL 2017. | ||
3 | * | ||
4 | * This software may be modified and distributed under the terms | ||
5 | * of the MIT license. See the LICENSE file for details. | ||
6 | * | ||
7 | * libpayload.h: header for payload helper functions | ||
8 | */ | ||
9 | |||
10 | /** | ||
11 | * Decrypts the substructures of a Pokémon structure, so they can be viewed or modified easily. | ||
12 | * Remember to call EncryptPokemon() afterwards. | ||
13 | * @param struct Pokemon* pkm The Pokémon to decrypt the substructures of. | ||
14 | */ | ||
15 | void DecryptPokemon(struct Pokemon* pkm); | ||
16 | |||
17 | /** | ||
18 | * Decrypts the substructures of a core Pokémon structure, so they can be viewed or modified easily. | ||
19 | * Used by DecryptPokemon(). | ||
20 | * Remember to call EncryptPokemon() afterwards. | ||
21 | * @param struct BoxPokemon* pkm The BoxPokemon to decrypt the substructures of. | ||
22 | */ | ||
23 | void DecryptBoxPokemon(struct BoxPokemon* pkm); | ||
24 | |||
25 | /** | ||
26 | * Encrypts the substructures of a Pokémon structure, and fixes the checksum. | ||
27 | * Must be used after DecryptPokemon() has been called, otherwise the Pokémon you decrypted and forgot to re-encrypt will become a Bad Egg. | ||
28 | * @param struct Pokemon* pkm The Pokémon to encrypt the substructures and fix the checksum of. | ||
29 | */ | ||
30 | void EncryptPokemon(struct Pokemon* pkm); | ||
31 | |||
32 | /** | ||
33 | * Encrypts the substructures of a core Pokémon structure, and fixes the checksum. | ||
34 | * Must be used after DecryptBoxPokemon() has been called, otherwise the Pokémon you decrypted and forgot to re-encrypt will become a Bad Egg. | ||
35 | * @param struct BoxPokemon* pkm The BoxPokemon to encrypt the substructures and fix the checksum of. | ||
36 | */ | ||
37 | void EncryptBoxPokemon(struct BoxPokemon* pkm); | ||
38 | |||
39 | /** | ||
40 | * Gets a substructure of a Pokémon structure. | ||
41 | * Call DecryptPokemon() first or the substructure data will be encrypted. | ||
42 | * @param struct Pokemon* pkm The Pokemon to get a substructure of. | ||
43 | * @param u8 substructId The substructure to get. | ||
44 | * @return union PokemonSubstruct* The substructure. | ||
45 | */ | ||
46 | union PokemonSubstruct* GetPokemonSubstruct(struct Pokemon* pkm,u8 substructId); | ||
47 | |||
48 | /** | ||
49 | * Gets a substructure of a core Pokémon structure. | ||
50 | * Call DecryptBoxPokemon() first or the substructure data will be encrypted. | ||
51 | * @param struct Pokemon* pkm The Pokemon to get a substructure of. | ||
52 | * @param u8 substructId The substructure to get. | ||
53 | * @return union PokemonSubstruct* The substructure. | ||
54 | */ | ||
55 | union PokemonSubstruct* GetBoxPokemonSubstruct(struct BoxPokemon* pkm,u8 substructId); | ||
56 | |||
57 | /** | ||
58 | * Gets the checksum of a core Pokémon structure. | ||
59 | * @param struct BoxPokemon* pkm The BoxPokemon to calculate the checksum of. | ||
60 | * @return u16 The checksum. | ||
61 | */ | ||
62 | u16 CalculateBoxPokemonChecksum(struct BoxPokemon* pkm); | ||
63 | |||
64 | /** | ||
65 | * Fixes the checksum of a core Pokémon structure. | ||
66 | * @param struct BoxPokemon* pkm The BoxPokemon to fix the checksum of. | ||
67 | */ | ||
68 | void FixBoxPokemonChecksum(struct BoxPokemon* pkm); | ||
69 | |||
70 | /** | ||
71 | * Gets the zeroth substructure ("Growth") of a Pokémon structure. | ||
72 | * Call DecryptPokemon() first or the substructure data will be encrypted. | ||
73 | * @param struct Pokemon* pkm The Pokémon to get a substructure of. | ||
74 | * @return struct PokemonSubstruct0* The substructure. | ||
75 | */ | ||
76 | struct PokemonSubstruct0* GetPokemonSubstruct0(struct Pokemon* pkm); | ||
77 | |||
78 | /** | ||
79 | * Gets the zeroth substructure ("Growth") of a core Pokémon structure. | ||
80 | * Call DecryptBoxPokemon() first or the substructure data will be encrypted. | ||
81 | * @param struct BoxPokemon* pkm The BoxPokemon to get the substructure of. | ||
82 | * @return struct PokemonSubstruct0* The substructure. | ||
83 | */ | ||
84 | struct PokemonSubstruct0* GetBoxPokemonSubstruct0(struct BoxPokemon* pkm); | ||
85 | |||
86 | /** | ||
87 | * Gets the first substructure ("Attacks") of a Pokémon structure. | ||
88 | * Call DecryptPokemon() first or the substructure data will be encrypted. | ||
89 | * @param struct Pokemon* pkm The Pokémon to get a substructure of. | ||
90 | * @return struct PokemonSubstruct0* The substructure. | ||
91 | */ | ||
92 | struct PokemonSubstruct1* GetPokemonSubstruct1(struct Pokemon* pkm); | ||
93 | |||
94 | /** | ||
95 | * Gets the first substructure ("Attacks") of a core Pokémon structure. | ||
96 | * Call DecryptBoxPokemon() first or the substructure data will be encrypted. | ||
97 | * @param struct BoxPokemon* pkm The BoxPokemon to get the substructure of. | ||
98 | * @return struct PokemonSubstruct1* The substructure. | ||
99 | */ | ||
100 | struct PokemonSubstruct1* GetBoxPokemonSubstruct1(struct BoxPokemon* pkm); | ||
101 | |||
102 | /** | ||
103 | * Gets the second substructure ("EVs & Condition") of a Pokémon structure. | ||
104 | * Call DecryptPokemon() first or the substructure data will be encrypted. | ||
105 | * @param struct Pokemon* pkm The Pokémon to get a substructure of. | ||
106 | * @return struct PokemonSubstruct0* The substructure. | ||
107 | */ | ||
108 | struct PokemonSubstruct2* GetPokemonSubstruct2(struct Pokemon* pkm); | ||
109 | |||
110 | /** | ||
111 | * Gets the second substructure ("EVs & Condition") of a core Pokémon structure. | ||
112 | * Call DecryptBoxPokemon() first or the substructure data will be encrypted. | ||
113 | * @param struct BoxPokemon* pkm The BoxPokemon to get the substructure of. | ||
114 | * @return struct PokemonSubstruct2* The substructure. | ||
115 | */ | ||
116 | struct PokemonSubstruct2* GetBoxPokemonSubstruct2(struct BoxPokemon* pkm); | ||
117 | |||
118 | /** | ||
119 | * Gets the third substructure ("Miscellaneous") of a Pokémon structure. | ||
120 | * Call DecryptPokemon() first or the substructure data will be encrypted. | ||
121 | * @param struct Pokemon* pkm The Pokémon to get a substructure of. | ||
122 | * @return struct PokemonSubstruct0* The substructure. | ||
123 | */ | ||
124 | struct PokemonSubstruct3* GetPokemonSubstruct3(struct Pokemon* pkm); | ||
125 | |||
126 | /** | ||
127 | * Gets the third substructure ("Miscellaneous") of a core Pokémon structure. | ||
128 | * Call DecryptBoxPokemon() first or the substructure data will be encrypted. | ||
129 | * @param struct BoxPokemon* pkm The BoxPokemon to get the substructure of. | ||
130 | * @return struct PokemonSubstruct3* The substructure. | ||
131 | */ | ||
132 | struct PokemonSubstruct3* GetBoxPokemonSubstruct3(struct BoxPokemon* pkm); | ||
133 | |||
134 | /** | ||
135 | * Calculates the checksum for an R/S-specific Enigma Berry structure in SaveBlock1. | ||
136 | * @param struct EnigmaBerry* enigmaBerry The R/S-specific Enigma Berry to calculate the checksum for. | ||
137 | * @return u32 The checksum. | ||
138 | */ | ||
139 | u32 CalculateEnigmaBerryChecksumRS(struct EnigmaBerry* enigmaBerry); | ||
140 | |||
141 | /** | ||
142 | * Calculates the checksum for an FR/LG/Emerald-specific Enigma Berry structure in SaveBlock1. | ||
143 | * @param struct EnigmaBerryFRLGE* enigmaBerry The FR/LG/Emerald-specific Enigma Berry to calculate the checksum for. | ||
144 | * @return u32 The checksum. | ||
145 | */ | ||
146 | u32 CalculateEnigmaBerryChecksumFRLGE(struct EnigmaBerryFRLGE* enigmaBerry); | ||
147 | |||
148 | /** | ||
149 | * Calculates the checksum for an unspecified Enigma Berry structure in SaveBlock1. (detected by current game) | ||
150 | * @param void* enigmaBerry The Enigma Berry structure to calculate the checksum for. | ||
151 | * @return u32 The checksum. | ||
152 | */ | ||
153 | u32 CalculateEnigmaBerryChecksum(void* enigmaBerry); | ||
154 | |||
155 | /** | ||
156 | * Calculates the checksum for a RAM script structure in SaveBlock1. | ||
157 | * @param struct RamScript* ramScript The RAM script structure to calculate the checksum for. | ||
158 | * @return u32 The checksum. | ||
159 | */ | ||
160 | u32 CalculateRamScriptChecksum(struct RamScript* ramScript); \ No newline at end of file | ||