From bc6874c278b7f426c152195b4d917c21f8729418 Mon Sep 17 00:00:00 2001 From: anod <182859762@qq.com> Date: Mon, 3 Apr 2023 14:36:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=B8=AA=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E6=9D=A5=E5=88=A4=E6=96=AD=E6=98=AF=E4=B8=8D=E6=98=AF?= =?UTF-8?q?irq=E7=9A=84=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/arm11/cheat.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/source/arm11/cheat.c b/source/arm11/cheat.c index 355b3b2..8a872f8 100644 --- a/source/arm11/cheat.c +++ b/source/arm11/cheat.c @@ -252,10 +252,15 @@ static int end_of_rom( CodeLocation addr, u32 size ) static int rom_search_hookpoint( CodeLocation addr, int addrlen, CodeLocation hookpoint[MAX_HOOKPOINT] ) { - int hookpoint_idx = 0; + CodeLocation mark[MAX_HOOKPOINT]; + memset( mark, 0, sizeof(mark) ); + int hookpoint_idx = 0, mark_idx = 0; for( int i=0; i < addrlen; ++i ) { CodeLocation pc = addr + i; + if( *pc == 0x03007ffc && mark_idx < MAX_HOOKPOINT ) + mark[mark_idx++] = pc; + if( MASK_PC0(0XFFFF0FFF) == 0XE3A00301 && MASK_PC1(0XFFF00FFF) == 0XE2800C02 && MASK_PC2(0XFFF00FFF) == 0XE5D00008 && @@ -301,6 +306,30 @@ static int rom_search_hookpoint( CodeLocation addr, int addrlen, CodeLocation ho if( hookpoint_idx >= MAX_HOOKPOINT ) break; } + // test for core hookpoint + CodeLocation core_hpt = NULL; + for( int i=0; i < hookpoint_idx; ++i ) + { + CodeLocation p = hookpoint[i]; + if( p - addr > (1<<11) ) break; + + for( int j = 0; j < mark_idx; ++j ) + { + CodeLocation q = mark[j]; + u32 d = p