From 24458c953c75a1fb9a6d7e643d03cd50fa76d6b0 Mon Sep 17 00:00:00 2001 From: anod <182859762@qq.com> Date: Tue, 7 Mar 2023 14:33:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E7=BC=96=E8=AF=91=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/arm11/cheat.h | 2 +- source/arm11/cheat.c | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/arm11/cheat.h b/include/arm11/cheat.h index 29f27fe..6cdab85 100644 --- a/include/arm11/cheat.h +++ b/include/arm11/cheat.h @@ -20,7 +20,7 @@ typedef int cheat_error_t; #define CHEAT_MODE_KEYONOFF 3 #define CHEAT_MODE_SIZE 3 -#define MAKE_ENTID(hole, key) ((key+1)<<16|(hole+1)) +#define MAKE_ENTID(hole, key) (((key)+1)<<16|((hole)+1)) #define ENT_USING(entid) ((entid) > 0xffff) cheat_error_t init_current_cheat( u32 id, u16 len ); diff --git a/source/arm11/cheat.c b/source/arm11/cheat.c index 97867aa..f191b71 100644 --- a/source/arm11/cheat.c +++ b/source/arm11/cheat.c @@ -5,9 +5,11 @@ #include #include +typedef instruction_t* CodeLocation; +#define CodeAtLocation(p) (*(p)) -#define MAKE_ENT(hole,key) ((key<<16) | hole) -#define ROM_LOC (0x20000000u) +#define MAKE_ENT(hole,key) (((key)<<16) | (hole)) +#define ROM_LOC ((CodeLocation)0x20000000u) #define GBA_KEYCODE(k) (0x3ff & (~(k))) #define SIZE_32M (32*1024*1024) @@ -98,9 +100,6 @@ cheat_error_t fini_current_cheat() return CCHT_OK; } -typedef instruction_t* CodeLocation; -#define CodeAtLocation(p) (*(p)) - // ******************************************* // code for patch rom with cheat instruction // *******************************************