about summary refs log tree commit diff stats
path: root/gba/source
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2017-09-23 10:21:57 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2017-09-23 10:21:57 -0400
commit6437a6cd49404b5e2e83bf940d8ac2284eb1e6bf (patch)
tree99bc9420d2817f78e3ca7f91db12ab085d5b051c /gba/source
parenteeaa6c5fd4957b6719fcb9f76cef5f9931237891 (diff)
downloadgen3uploader-6437a6cd49404b5e2e83bf940d8ac2284eb1e6bf.tar.gz
gen3uploader-6437a6cd49404b5e2e83bf940d8ac2284eb1e6bf.tar.bz2
gen3uploader-6437a6cd49404b5e2e83bf940d8ac2284eb1e6bf.zip
Fixed shininess determination
Shininess is determined with the ID of the OT, not the game the Pokémon
is currently in.
Diffstat (limited to 'gba/source')
-rw-r--r--gba/source/main.c6
-rw-r--r--gba/source/serialize.c12
-rw-r--r--gba/source/serialize.h4
3 files changed, 7 insertions, 15 deletions
diff --git a/gba/source/main.c b/gba/source/main.c index 0934e91..e5521b2 100644 --- a/gba/source/main.c +++ b/gba/source/main.c
@@ -106,10 +106,6 @@ int main(void)
106 (trainerId[1] << 8) 106 (trainerId[1] << 8)
107 | (trainerId[0]); 107 | (trainerId[0]);
108 108
109 u16 secretIdNum =
110 (trainerId[3] << 8)
111 | (trainerId[2]);
112
113 sendU32(trainerIdNum); 109 sendU32(trainerIdNum);
114 waitForAck(); 110 waitForAck();
115 111
@@ -208,7 +204,7 @@ int main(void)
208 204
209 struct PokemonIntermediate pki; 205 struct PokemonIntermediate pki;
210 206
211 PokemonIntermediateInit(&pki, bpkm, trainerIdNum, secretIdNum); 207 PokemonIntermediateInit(&pki, bpkm);
212 PokemonIntermediateStream(&pki); 208 PokemonIntermediateStream(&pki);
213 } 209 }
214} 210}
diff --git a/gba/source/serialize.c b/gba/source/serialize.c index d08dfc2..8929689 100644 --- a/gba/source/serialize.c +++ b/gba/source/serialize.c
@@ -41,9 +41,7 @@ u32 CalculateStat(
41 41
42void PokemonIntermediateInit( 42void PokemonIntermediateInit(
43 struct PokemonIntermediate* pki, 43 struct PokemonIntermediate* pki,
44 struct BoxPokemon* bpkm, 44 struct BoxPokemon* bpkm)
45 u16 trainerId,
46 u16 secretId)
47{ 45{
48 DecryptBoxPokemon(bpkm); 46 DecryptBoxPokemon(bpkm);
49 47
@@ -120,10 +118,10 @@ void PokemonIntermediateInit(
120 } 118 }
121 119
122 // Determine shininess from the personality value. 120 // Determine shininess from the personality value.
123 u16 shinyDeterminer = 121 u32 shinyDeterminer =
124 (trainerId) 122 ((bpkm->otId & 0xFFFF0000) >> 16)
125 ^ (secretId) 123 ^ (bpkm->otId & 0x0000FFFF)
126 ^ ((bpkm->personality >> 16) & 0x0000FFFF) 124 ^ ((bpkm->personality & 0xFFFF0000) >> 16)
127 ^ (bpkm->personality & 0x0000FFFF); 125 ^ (bpkm->personality & 0x0000FFFF);
128 126
129 if (shinyDeterminer < 8) 127 if (shinyDeterminer < 8)
diff --git a/gba/source/serialize.h b/gba/source/serialize.h index 7fcae0f..a73d84b 100644 --- a/gba/source/serialize.h +++ b/gba/source/serialize.h
@@ -15,9 +15,7 @@ struct GameData;
15 15
16void PokemonIntermediateInit( 16void PokemonIntermediateInit(
17 struct PokemonIntermediate* pki, 17 struct PokemonIntermediate* pki,
18 struct BoxPokemon* bpkm, 18 struct BoxPokemon* bpkm);
19 u16 trainerId,
20 u16 secretId);
21 19
22void PokemonIntermediateStream(struct PokemonIntermediate* pki); 20void PokemonIntermediateStream(struct PokemonIntermediate* pki);
23 21