From a240481d5ffe7f9c7a62faf0617dff888d84d745 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 5 Feb 2021 12:08:25 -0500 Subject: Document secret_base.c --- include/global.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/global.h') diff --git a/include/global.h b/include/global.h index 4ccd2be50..ca3cf4452 100644 --- a/include/global.h +++ b/include/global.h @@ -500,7 +500,7 @@ struct SecretBaseParty struct SecretBase { /*0x1A9C*/ u8 secretBaseId; - /*0x1A9D*/ u8 sbr_field_1_0:4; + /*0x1A9D*/ bool8 toRegister:4; /*0x1A9D*/ u8 gender:1; /*0x1A9D*/ u8 battledOwnerToday:1; /*0x1A9D*/ u8 registryStatus:2; @@ -509,7 +509,7 @@ struct SecretBase /*0x1AA9*/ u8 language; /*0x1AAA*/ u16 numSecretBasesReceived; /*0x1AAC*/ u8 numTimesEntered; - /*0x1AAD*/ u8 sbr_field_11; + /*0x1AAD*/ u8 unused; /*0x1AAE*/ u8 decorations[DECOR_MAX_SECRET_BASE]; /*0x1ABE*/ u8 decorationPositions[DECOR_MAX_SECRET_BASE]; /*0x1AD0*/ struct SecretBaseParty party; -- cgit v1.2.3 From 0851c34bac0f38699e3442d8b79c4d7fe52ca71c Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 5 Feb 2021 15:25:12 -0500 Subject: Add berry tree id constants --- include/global.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/global.h') diff --git a/include/global.h b/include/global.h index 4ccd2be50..9587eb1f3 100644 --- a/include/global.h +++ b/include/global.h @@ -9,6 +9,7 @@ #include "constants/flags.h" #include "constants/vars.h" #include "constants/species.h" +#include "constants/berry.h" // Prevent cross-jump optimization. #define BLOCK_CROSS_JUMP asm(""); -- cgit v1.2.3 From b89c3e901e1de2f3513d74fa548373d82d3f26d0 Mon Sep 17 00:00:00 2001 From: Deokishisu <6993375+Deokishisu@users.noreply.github.com> Date: Mon, 15 Feb 2021 11:40:16 -0500 Subject: Fix giftRibbons Field in SaveBlock1 & Relabel Gift Ribbons in pokemon.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The giftRibbons field has been split out into proper subfields. The new ExternalEvent structs deal with interconnectivity between external games/peripherals and Emerald, such as PokéCoupon storage and the flag for receiving Wishmaker Jirachi. The giftRibbon fields in `PokemonSubstruct3` have also been renamed to their appropriate ribbons, and commented with distribution info if applicable. The previous `fatefulEncounter` field was actually filler, and relabeled as such, while the obedient bit was renamed `fatefulEncounter`. All relevant constants and functions dealing with the Pokémon data structure were renamed with these changes in mind. --- include/global.h | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'include/global.h') diff --git a/include/global.h b/include/global.h index 9587eb1f3..8eef06e38 100644 --- a/include/global.h +++ b/include/global.h @@ -898,6 +898,41 @@ struct MysteryEventStruct /*0x344 0x3570*/ u32 unk_344[2][5]; }; // 0x36C 0x3598 +// For external event data storage. The majority of these may have never been used. +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. +} __attribute__((packed)); /*size = 0x14*/ + +// For external event flags. The majority of these may have never been used. +struct ExternalEventFlags +{ + u8 unknownFlag1; + u8 receivedWishmakerJirachi; // may also be used for Ageto Celebi? + u8 unknownFlag3; + u8 unknownFlag4; + u8 unknownFlag5; + u8 unknownFlag6; + u8 unknownFlag7; + u8 unknownFlag8; + u8 unknownFlag9; + u8 unknownFlag10; + u8 unknownFlag11; + u8 unknownFlag12; + u8 unknownFlag13; + u8 unknownFlag14; + u8 unknownFlag15; + u8 unknownFlag16; + u8 unknownFlag17; + u8 unknownFlag18; + u8 unknownFlag19; + u8 unknownFlag20; + +};/*size = 0x14*/ + struct SaveBlock1 { /*0x00*/ struct Coords16 pos; @@ -971,7 +1006,9 @@ struct SaveBlock1 /*0x2e90*/ struct ContestWinner contestWinners[NUM_CONTEST_WINNERS]; // see CONTEST_WINNER_* /*0x3030*/ struct DayCare daycare; /*0x3150*/ struct LinkBattleRecords linkBattleRecords; - /*0x31A8*/ u8 giftRibbons[52]; + /*0x31A8*/ u8 giftRibbons[11]; + /*0x31B3*/ struct ExternalEventData externalEventData; + /*0x31C7*/ struct ExternalEventFlags externalEventFlags; /*0x31DC*/ struct Roamer roamer; /*0x31F8*/ struct EnigmaBerry enigmaBerry; /*0x322C*/ struct MEventBuffers unk_322C; -- cgit v1.2.3 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(-) (limited to 'include/global.h') 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(-) (limited to 'include/global.h') 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(-) (limited to 'include/global.h') 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(-) (limited to 'include/global.h') 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 From e059c4fdfa0fe36aceac4b283176825ad759fe5d Mon Sep 17 00:00:00 2001 From: GriffinR Date: Wed, 17 Feb 2021 14:11:45 -0500 Subject: Use new gift ribbons size, label unused ribbons --- include/global.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include/global.h') diff --git a/include/global.h b/include/global.h index 38850d6fa..44df26a9b 100644 --- a/include/global.h +++ b/include/global.h @@ -905,7 +905,7 @@ 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; // Master Ball from Jp Colosseum Bonus Disc; for reaching 30,000 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; // PP Max from JP Colosseum Bonus Disc; for reaching 2500 totalEarnedPokeCoupons u32 receivedAgetoCelebi:1; // from JP Colosseum Bonus Disc @@ -919,7 +919,7 @@ struct ExternalEventData 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 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 1499 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. @@ -1017,7 +1017,7 @@ struct SaveBlock1 /*0x2e90*/ struct ContestWinner contestWinners[NUM_CONTEST_WINNERS]; // see CONTEST_WINNER_* /*0x3030*/ struct DayCare daycare; /*0x3150*/ struct LinkBattleRecords linkBattleRecords; - /*0x31A8*/ u8 giftRibbons[11]; + /*0x31A8*/ u8 giftRibbons[GIFT_RIBBONS_COUNT]; /*0x31B3*/ struct ExternalEventData externalEventData; /*0x31C7*/ struct ExternalEventFlags externalEventFlags; /*0x31DC*/ struct Roamer roamer; -- cgit v1.2.3 From c6141fea831a30a0d2de24b3c02375a01014ec97 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Mon, 22 Feb 2021 12:12:35 -0500 Subject: Document easy chat --- include/global.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/global.h') diff --git a/include/global.h b/include/global.h index 44df26a9b..3d3ea0229 100644 --- a/include/global.h +++ b/include/global.h @@ -893,7 +893,7 @@ struct MysteryEventStruct /*0x000 0x322C*/ struct WonderNewsSaveStruct wonderNews; /*0x1c0 0x33EC*/ struct WonderCardSaveStruct wonderCard; /*0x310 0x353C*/ struct MEventBuffer_3430 buffer_310; - /*0x338 0x3564*/ u16 unk_338[4]; + /*0x338 0x3564*/ u16 questionnaireWords[NUM_QUESTIONNAIRE_WORDS]; /*0x340 0x356C*/ struct MysteryEventStruct unk_340; /*0x344 0x3570*/ u32 unk_344[2][5]; }; // 0x36C 0x3598 -- cgit v1.2.3 From 117b90a2610438df4c3f8b72d2fe9147f34dc2a4 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 25 Feb 2021 04:37:25 -0500 Subject: Document pokemon jump --- include/global.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'include/global.h') diff --git a/include/global.h b/include/global.h index 44df26a9b..ec625d3bf 100644 --- a/include/global.h +++ b/include/global.h @@ -175,13 +175,13 @@ struct Pokedex /*0x44*/ u8 seen[DEX_FLAGS_NO]; }; -struct PokemonJumpResults +struct PokemonJumpRecords { u16 jumpsInRow; - u16 field2; + u16 unused1; // Set to 0, never read u16 excellentsInRow; - u16 field6; - u32 field8; + u16 gamesWithMaxPlayers; + u32 unused2; // Set to 0, never read u32 bestJumpScore; }; @@ -478,7 +478,7 @@ struct SaveBlock2 /*0xB0*/ struct PlayersApprentice playerApprentice; /*0xDC*/ struct Apprentice apprentices[APPRENTICE_COUNT]; /*0x1EC*/ struct BerryCrush berryCrush; - /*0x1FC*/ struct PokemonJumpResults pokeJump; + /*0x1FC*/ struct PokemonJumpRecords pokeJump; /*0x20C*/ struct BerryPickingResults berryPick; /*0x21C*/ struct RankingHall1P hallRecords1P[HALL_FACILITIES_COUNT][2][3]; // From record mixing. /*0x57C*/ struct RankingHall2P hallRecords2P[2][3]; // From record mixing. -- cgit v1.2.3 From 22e2c0a47ca876313604f0dd031abb324477186f Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 16 Mar 2021 05:40:42 -0400 Subject: Document Berry Crush --- include/global.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/global.h') diff --git a/include/global.h b/include/global.h index 1992ff819..7daed8621 100644 --- a/include/global.h +++ b/include/global.h @@ -209,7 +209,7 @@ struct PyramidBag struct BerryCrush { - u16 berryCrushResults[4]; + u16 pressingSpeeds[4]; // For the record with each possible group size, 2-5 players u32 berryPowderAmount; u32 unk; }; -- cgit v1.2.3 From dfc6ee0e9e20658a80e4080da16c2f6423b85457 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 19 Mar 2021 18:17:43 -0400 Subject: Add SAFE_DIV --- include/global.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include/global.h') diff --git a/include/global.h b/include/global.h index 1992ff819..112d2cbc4 100644 --- a/include/global.h +++ b/include/global.h @@ -74,6 +74,14 @@ #define abs(x) (((x) < 0) ? -(x) : (x)) #endif +// Used in cases where division by 0 can occur in the retail version. +// Avoids invalid opcodes on some emulators, and the otherwise UB. +#ifdef UBFIX +#define SAFE_DIV(a, b) ((b) ? (a) / (b) : 0) +#else +#define SAFE_DIV(a, b) ((a) / (b)) +#endif + // Extracts the upper 16 bits of a 32-bit number #define HIHALF(n) (((n) & 0xFFFF0000) >> 16) -- cgit v1.2.3 From 86856098a35b58eabb74db1d41cb9a2853c6746f Mon Sep 17 00:00:00 2001 From: GriffinR Date: Wed, 31 Mar 2021 15:53:01 -0400 Subject: Document Dewford Trend --- include/global.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'include/global.h') diff --git a/include/global.h b/include/global.h index 7806c0b59..497fb40b1 100644 --- a/include/global.h +++ b/include/global.h @@ -587,12 +587,13 @@ struct RamScript struct RamScriptData data; }; -struct EasyChatPair +// See dewford_trend.c +struct DewfordTrend { - u16 unk0_0:7; - u16 unk0_7:7; - u16 unk1_6:1; - u16 unk2; + u16 trendiness:7; + u16 maxTrendiness:7; + u16 gainingTrendiness:1; + u16 rand; u16 words[2]; }; /*size = 0x8*/ @@ -1021,7 +1022,7 @@ struct SaveBlock1 /*0x2BE0*/ struct MailStruct mail[MAIL_COUNT]; /*0x2E20*/ u8 additionalPhrases[8]; // bitfield for 33 additional phrases in easy chat system /*0x2E28*/ OldMan oldMan; - /*0x2e64*/ struct EasyChatPair easyChatPairs[5]; //Dewford trend [0] and some other stuff + /*0x2e64*/ struct DewfordTrend dewfordTrends[SAVED_TRENDS_COUNT]; /*0x2e90*/ struct ContestWinner contestWinners[NUM_CONTEST_WINNERS]; // see CONTEST_WINNER_* /*0x3030*/ struct DayCare daycare; /*0x3150*/ struct LinkBattleRecords linkBattleRecords; -- cgit v1.2.3 From 4a1cfbead245b3cac609b498dfca6b6d238f7f7a Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 6 Apr 2021 16:55:33 -0400 Subject: Document remaining overworld --- include/global.h | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'include/global.h') diff --git a/include/global.h b/include/global.h index 497fb40b1..18e2bfea7 100644 --- a/include/global.h +++ b/include/global.h @@ -1055,14 +1055,4 @@ struct MapPosition s8 height; }; -struct TradeRoomPlayer -{ - u8 playerId; - u8 isLocalPlayer; - u8 c; - u8 facing; - struct MapPosition pos; - u16 field_C; -}; - #endif // GUARD_GLOBAL_H -- cgit v1.2.3 From 33ea2a10613df0d6ef25b146b175f8b3712896c3 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 13 Apr 2021 02:50:50 -0400 Subject: Remove unnecessary scope for TEST_BUTTON --- include/global.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/global.h') diff --git a/include/global.h b/include/global.h index 18e2bfea7..19605ca57 100644 --- a/include/global.h +++ b/include/global.h @@ -107,7 +107,7 @@ #define T2_READ_PTR(ptr) (void*) T2_READ_32(ptr) // Macros for checking the joypad -#define TEST_BUTTON(field, button) ({(field) & (button);}) +#define TEST_BUTTON(field, button) ((field) & (button)) #define JOY_NEW(button) TEST_BUTTON(gMain.newKeys, button) #define JOY_HELD(button) TEST_BUTTON(gMain.heldKeys, button) #define JOY_HELD_RAW(button) TEST_BUTTON(gMain.heldKeysRaw, button) -- cgit v1.2.3 From aad090e154d4cb1397468f3b19071ddad688a7bc Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sun, 25 Apr 2021 17:22:45 -0400 Subject: Document TV --- include/global.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'include/global.h') diff --git a/include/global.h b/include/global.h index 19605ca57..e4c11f9ef 100644 --- a/include/global.h +++ b/include/global.h @@ -727,7 +727,7 @@ struct ContestWinner u8 contestRank; }; -struct DayCareMail +struct DaycareMail { struct MailStruct message; u8 OT_name[PLAYER_NAME_LENGTH + 1]; @@ -739,7 +739,7 @@ struct DayCareMail struct DaycareMon { struct BoxPokemon mon; - struct DayCareMail mail; + struct DaycareMail mail; u32 steps; }; @@ -750,9 +750,9 @@ struct DayCare u8 stepCounter; }; -struct RecordMixingDayCareMail +struct RecordMixingDaycareMail { - struct DayCareMail mail[DAYCARE_MON_COUNT]; + struct DaycareMail mail[DAYCARE_MON_COUNT]; u32 numDaycareMons; bool16 holdsItem[DAYCARE_MON_COUNT]; }; -- cgit v1.2.3