From 6437a6cd49404b5e2e83bf940d8ac2284eb1e6bf Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 23 Sep 2017 10:21:57 -0400 Subject: Fixed shininess determination MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Shininess is determined with the ID of the OT, not the game the Pokémon is currently in. --- gba/source/main.c | 6 +----- gba/source/serialize.c | 12 +++++------- gba/source/serialize.h | 4 +--- 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) (trainerId[1] << 8) | (trainerId[0]); - u16 secretIdNum = - (trainerId[3] << 8) - | (trainerId[2]); - sendU32(trainerIdNum); waitForAck(); @@ -208,7 +204,7 @@ int main(void) struct PokemonIntermediate pki; - PokemonIntermediateInit(&pki, bpkm, trainerIdNum, secretIdNum); + PokemonIntermediateInit(&pki, bpkm); PokemonIntermediateStream(&pki); } } 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( void PokemonIntermediateInit( struct PokemonIntermediate* pki, - struct BoxPokemon* bpkm, - u16 trainerId, - u16 secretId) + struct BoxPokemon* bpkm) { DecryptBoxPokemon(bpkm); @@ -120,10 +118,10 @@ void PokemonIntermediateInit( } // Determine shininess from the personality value. - u16 shinyDeterminer = - (trainerId) - ^ (secretId) - ^ ((bpkm->personality >> 16) & 0x0000FFFF) + u32 shinyDeterminer = + ((bpkm->otId & 0xFFFF0000) >> 16) + ^ (bpkm->otId & 0x0000FFFF) + ^ ((bpkm->personality & 0xFFFF0000) >> 16) ^ (bpkm->personality & 0x0000FFFF); 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; void PokemonIntermediateInit( struct PokemonIntermediate* pki, - struct BoxPokemon* bpkm, - u16 trainerId, - u16 secretId); + struct BoxPokemon* bpkm); void PokemonIntermediateStream(struct PokemonIntermediate* pki); -- cgit 1.4.1