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