From cd89d17b1206f5d5b0c731f30a6c0185078cdd3b Mon Sep 17 00:00:00 2001 From: Deokishisu <6993375+Deokishisu@users.noreply.github.com> Date: Tue, 16 Feb 2021 09:41:07 -0500 Subject: Document More External Events Did research to determine how the Japanese Colosseum Bonus Disc modifies the ExternalEventData fields. The Ageto Celebi flag, as well as the flag for the three PokeCoupon title rewards, have been documented and included into the struct. The PokeCoupon fields are actually 3-byte fields, so they have been turned into bitfields, since u24 isn't possible. Also discovered that Channel and US Colosseum Bonus Disc Jirachi use the same flag, so renamed that flag and commented to explain. Also made general comments explaining how the ExternalEventData and ExternalEventFlags are applicable to Emerald specifically. --- include/global.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/include/global.h b/include/global.h index 5b1a7b44b..f81192ce7 100644 --- a/include/global.h +++ b/include/global.h @@ -899,19 +899,27 @@ struct MysteryEventStruct }; // 0x36C 0x3598 // For external event data storage. The majority of these may have never been used. +// In Emerald, the only known used fields are the PokeCoupon ones, but hacking the distribution discs allows Emerald to receive events and set the others struct ExternalEventData { u8 unknownExternalDataFields1[7]; // if actually used, may be broken up into different fields. - u32 currentPokeCoupons; // PokéCoupons stored by Pokémon Colosseum and XD from Mt. Battle runs. Earned PokéCoupons are also added to totalEarnedPokeCoupons. - u32 totalEarnedPokeCoupons; // Used by the JP Colosseum bonus disc. Determines PokéCoupon rank to distribute rewards. Unread in International games. - u8 unknownExternalDataFields2[5]; // if actually used, may be broken up into different fields. + u32 unknownExternalDataFields2:8; + u32 currentPokeCoupons:24; // PokéCoupons stored by Pokémon Colosseum and XD from Mt. Battle runs. Earned PokéCoupons are also added to totalEarnedPokeCoupons. Colosseum/XD caps this at 9,999,999, but will read up to 16,777,215. + u32 gotGoldPokeCouponTitleReward:1; // PP Max from JP Colosseum Bonus Disc; for reaching 2500 totalEarnedPokeCoupons + u32 gotSilverPokeCouponTitleReward:1; // Light Ball Pikachu from JP Colosseum Bonus Disc; for reaching 5000 totalEarnedPokeCoupons + u32 gotBronzePokeCouponTitleReward:1; // Master Ball from Jp Colosseum Bonus Disc; for reaching 30,000 totalEarnedPokeCoupons + u32 receivedAgetoCelebi:1; // from JP Colosseum Bonus Disc + u32 unknownExternalDataFields3:4; + u32 totalEarnedPokeCoupons:24; // Used by the JP Colosseum bonus disc. Determines PokéCoupon rank to distribute rewards. Unread in International games. Colosseum/XD caps this at 9,999,999. + u8 unknownExternalDataFields4[5]; // if actually used, may be broken up into different fields. } __attribute__((packed)); /*size = 0x14*/ // For external event flags. The majority of these may have never been used. +// In Emerald, Jirachi cannot normally be received, but hacking the distribution discs allows Emerald to receive Jirachi and set the flag struct ExternalEventFlags { u8 unknownFlag1; - u8 receivedWishmakerJirachi; // may also be used for Ageto Celebi? + u8 receivedGCNJirachi; // Both the US Colosseum Bonus Disc and PAL/AUS Pokémon Channel use this field. One cannot receive a WISHMKR Jirachi and CHANNEL Jirachi with the same savefile. u8 unknownFlag3; u8 unknownFlag4; u8 unknownFlag5; -- cgit v1.2.3 From fb60e036ce97d436285eb1401c356df52a73dad2 Mon Sep 17 00:00:00 2001 From: Deokishisu <6993375+Deokishisu@users.noreply.github.com> Date: Tue, 16 Feb 2021 15:37:58 -0500 Subject: Document Box: Ruby & Sapphire Fields MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Labeled another field in the ExternalEventData struct used by Pokémon Box: Ruby & Sapphire. Special thanks to Citrus Bolt#4642. --- include/global.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/global.h b/include/global.h index f81192ce7..72ac97cc1 100644 --- a/include/global.h +++ b/include/global.h @@ -899,7 +899,7 @@ struct MysteryEventStruct }; // 0x36C 0x3598 // For external event data storage. The majority of these may have never been used. -// In Emerald, the only known used fields are the PokeCoupon ones, but hacking the distribution discs allows Emerald to receive events and set the others +// In Emerald, the only known used fields are the PokeCoupon and BoxRS ones, but hacking the distribution discs allows Emerald to receive events and set the others struct ExternalEventData { u8 unknownExternalDataFields1[7]; // if actually used, may be broken up into different fields. @@ -912,7 +912,10 @@ struct ExternalEventData u32 unknownExternalDataFields3:4; u32 totalEarnedPokeCoupons:24; // Used by the JP Colosseum bonus disc. Determines PokéCoupon rank to distribute rewards. Unread in International games. Colosseum/XD caps this at 9,999,999. u8 unknownExternalDataFields4[5]; // if actually used, may be broken up into different fields. -} __attribute__((packed)); /*size = 0x14*/ + u8 usedBoxRS:1; // Set by Pokémon Box: Ruby & Sapphire; denotes whether this save has connected to it and triggered the free False Swipe Swablu Egg giveaway. + u8 boxRSEggsUnlocked:2; // Set by Pokémon Box: Ruby & Sapphire; denotes the number of Eggs unlocked from deposits; 1 for ExtremeSpeed Zigzagoon (at 100 deposited), 2 for Pay Day Skitty (at 500 deposited), 3 for Surf Pichu (at 1500 deposited) + u8 padding:5; +} __attribute__((packed)); /*size = 0x15*/ // For external event flags. The majority of these may have never been used. // In Emerald, Jirachi cannot normally be received, but hacking the distribution discs allows Emerald to receive Jirachi and set the flag -- cgit v1.2.3 From 7f55bf875c881e04765a316cfcc91c4545f0e32e Mon Sep 17 00:00:00 2001 From: Deokishisu <6993375+Deokishisu@users.noreply.github.com> Date: Tue, 16 Feb 2021 16:01:18 -0500 Subject: Move BoxRS Data Down to ExternalEventFlags As suggested, moved the BoxRS data fields into ExternalEventFlags and packed that struct. --- include/global.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/global.h b/include/global.h index 72ac97cc1..d882785d6 100644 --- a/include/global.h +++ b/include/global.h @@ -912,15 +912,15 @@ struct ExternalEventData u32 unknownExternalDataFields3:4; u32 totalEarnedPokeCoupons:24; // Used by the JP Colosseum bonus disc. Determines PokéCoupon rank to distribute rewards. Unread in International games. Colosseum/XD caps this at 9,999,999. u8 unknownExternalDataFields4[5]; // if actually used, may be broken up into different fields. - u8 usedBoxRS:1; // Set by Pokémon Box: Ruby & Sapphire; denotes whether this save has connected to it and triggered the free False Swipe Swablu Egg giveaway. - u8 boxRSEggsUnlocked:2; // Set by Pokémon Box: Ruby & Sapphire; denotes the number of Eggs unlocked from deposits; 1 for ExtremeSpeed Zigzagoon (at 100 deposited), 2 for Pay Day Skitty (at 500 deposited), 3 for Surf Pichu (at 1500 deposited) - u8 padding:5; -} __attribute__((packed)); /*size = 0x15*/ +} __attribute__((packed)); /*size = 0x14*/ // For external event flags. The majority of these may have never been used. // In Emerald, Jirachi cannot normally be received, but hacking the distribution discs allows Emerald to receive Jirachi and set the flag struct ExternalEventFlags { + u8 usedBoxRS:1; // Set by Pokémon Box: Ruby & Sapphire; denotes whether this save has connected to it and triggered the free False Swipe Swablu Egg giveaway. + u8 boxRSEggsUnlocked:2; // Set by Pokémon Box: Ruby & Sapphire; denotes the number of Eggs unlocked from deposits; 1 for ExtremeSpeed Zigzagoon (at 100 deposited), 2 for Pay Day Skitty (at 500 deposited), 3 for Surf Pichu (at 1500 deposited) + u8 padding:5; u8 unknownFlag1; u8 receivedGCNJirachi; // Both the US Colosseum Bonus Disc and PAL/AUS Pokémon Channel use this field. One cannot receive a WISHMKR Jirachi and CHANNEL Jirachi with the same savefile. u8 unknownFlag3; @@ -942,7 +942,7 @@ struct ExternalEventFlags u8 unknownFlag19; u8 unknownFlag20; -};/*size = 0x14*/ +} __attribute__((packed));/*size = 0x15*/ struct SaveBlock1 { -- cgit v1.2.3 From 1dda9939ab86844176bf8b00fd78c4afbea21fae Mon Sep 17 00:00:00 2001 From: Deokishisu <6993375+Deokishisu@users.noreply.github.com> Date: Tue, 16 Feb 2021 16:08:58 -0500 Subject: Fix Swapped Comments on PokeCoupon Tiers --- include/global.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/global.h b/include/global.h index d882785d6..38850d6fa 100644 --- a/include/global.h +++ b/include/global.h @@ -905,9 +905,9 @@ struct ExternalEventData u8 unknownExternalDataFields1[7]; // if actually used, may be broken up into different fields. u32 unknownExternalDataFields2:8; u32 currentPokeCoupons:24; // PokéCoupons stored by Pokémon Colosseum and XD from Mt. Battle runs. Earned PokéCoupons are also added to totalEarnedPokeCoupons. Colosseum/XD caps this at 9,999,999, but will read up to 16,777,215. - u32 gotGoldPokeCouponTitleReward:1; // PP Max from JP Colosseum Bonus Disc; for reaching 2500 totalEarnedPokeCoupons + u32 gotGoldPokeCouponTitleReward:1; // Master Ball from Jp Colosseum Bonus Disc; for reaching 30,000 totalEarnedPokeCoupons u32 gotSilverPokeCouponTitleReward:1; // Light Ball Pikachu from JP Colosseum Bonus Disc; for reaching 5000 totalEarnedPokeCoupons - u32 gotBronzePokeCouponTitleReward:1; // Master Ball from Jp Colosseum Bonus Disc; for reaching 30,000 totalEarnedPokeCoupons + u32 gotBronzePokeCouponTitleReward:1; // PP Max from JP Colosseum Bonus Disc; for reaching 2500 totalEarnedPokeCoupons u32 receivedAgetoCelebi:1; // from JP Colosseum Bonus Disc u32 unknownExternalDataFields3:4; u32 totalEarnedPokeCoupons:24; // Used by the JP Colosseum bonus disc. Determines PokéCoupon rank to distribute rewards. Unread in International games. Colosseum/XD caps this at 9,999,999. -- cgit v1.2.3