From 93f67f9557109d85e191283b171f7f5e8028b7bf Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 24 Nov 2018 20:04:50 -0500 Subject: sub_812CAD8 New macro `PRESSED(x)` tests `gMain.newKeys & (x)`. The macro itself is inoptimal. However, its use is required to match this function. We suspect this macro may have been implemented globally, hence we put it in `global.h`. Propagating its use through the remainder of this project, as well as [Ruby](/pret/pokeruby) and [Emerald](/pret/pokeemerald), has been left as a to-do item. --- include/global.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include') diff --git a/include/global.h b/include/global.h index 050e200f9..3dc11bfbd 100644 --- a/include/global.h +++ b/include/global.h @@ -62,6 +62,13 @@ #define T2_READ_32(ptr) ((ptr)[0] + ((ptr)[1] << 8) + ((ptr)[2] << 16) + ((ptr)[3] << 24)) #define T2_READ_PTR(ptr) (void*) T2_READ_32(ptr) +// This macro is required to prevent the compiler from optimizing +// a dpad up/down check in sub_812CAD8 (fame_checker.c). +// We suspect it was used globally. +// GameFreak never ceases to amaze. +// TODO: Propagate use of this macro +#define PRESSED(button) ({gMain.newKeys & (button);}) + extern u8 gStringVar1[]; extern u8 gStringVar2[]; extern u8 gStringVar3[]; -- cgit v1.2.3