about summary refs log tree commit diff stats
path: root/gba/source
diff options
context:
space:
mode:
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