From e0d9d733745dfd1a9313ac650c315b28df8fbbe3 Mon Sep 17 00:00:00 2001 From: anod <182859762@qq.com> Date: Wed, 8 Mar 2023 12:21:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86key=5Fonoff=E6=94=B9=E4=B8=BA=E8=BE=B9?= =?UTF-8?q?=E7=BC=98=E6=A3=80=E6=B5=8B=E8=80=8C=E9=9D=9E=E7=94=B5=E5=B9=B3?= =?UTF-8?q?=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/arm11/cheat.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/source/arm11/cheat.c b/source/arm11/cheat.c index 6958d42..6504c94 100644 --- a/source/arm11/cheat.c +++ b/source/arm11/cheat.c @@ -145,25 +145,31 @@ const instruction_t IRQ_WRAPPER_INSTR[] = { const instruction_t KEY_ONOFF_INSTR[] = { 0xe3a00301, // mov r0, #67108864 ; 0x4000000 0xe5900130, // ldr r0, [r0, #304] ; 0x130 - 0xe1df12b4, // ldrh r1, [pc, #36] ; 0x34 - 0xe1df22b2, // ldrh r2, [pc, #34] ; 0x36 + 0xe1df13bc, // ldrh r1, [pc, #60] ; 0x4c + 0xe1df23ba, // ldrh r2, [pc, #58] ; 0x4e 0xe0000002, // and r0, r0, r2 - 0xe59f201c, // ldr r2, [pc, #28] ; 0x38 + 0xe59f2034, // ldr r2, [pc, #52] ; 0x50 0xe5d23000, // ldrb r3, [r2] 0xe1500001, // cmp r0, r1 - 0x02233001, // eoreq r3, r3, #1 ; 0x1 - 0x05c23000, // streqb r3, [r2] + 0x0a000005, // beq 0x3c + 0xe2131010, // ands r1, r3, #16 ; 0x10 + 0x1203300f, // andne r3, r3, #15 ; 0xf + 0x15c23000, // strneb r3, [r2] 0xe3530000, // cmp r3, #0 ; 0x0 - 0x1a000002, // bne 0x3c + 0x1a000006, // bne 0x54 0xe12fff1e, // bx lr + 0xe2131010, // ands r1, r3, #16 ; 0x10 + 0x02233011, // eoreq r3, r3, #17 ; 0x11 + 0x05c23000, // streqb r3, [r2] + 0xeafffff8, // b 0x30 0x03ff0000, // mask-data and key-data 0 // addr to store on/off flag }; #define KOO_INSTR_SIZE sizeof(KEY_ONOFF_INSTR) #define KOO_INSTR_LEN (KOO_INSTR_SIZE/sizeof(instruction_t)) -#define KOO_INSTR_KEYDATA 13 -#define KOO_INSTR_MEMADDR 14 +#define KOO_INSTR_KEYDATA 19 +#define KOO_INSTR_MEMADDR 20 const instruction_t KEY_ENABLE_INSTR[] = { 0xe3a00301, // mov r0, #67108864 ; 0x4000000 @@ -247,12 +253,12 @@ static int rom_search_hookpoint( CodeLocation addr, int addrlen, CodeLocation ho hookpoint[hookpoint_idx++] = pc; else - if( MASK_PC0(0xffff0fff) == 0xe3a00640 && - MASK_PC1(0xfff00fff) == 0xe5b00200 && - MASK_PC2(0xfff00000) == 0xe1d00000 && - MASK_PC5(0xffff0000) != 0xe59f0000 && - MASK_PC6(0xffff0000) != 0xe59f0000 && - MASK_PC7(0xffff0000) != 0xe59f0000 ) + if( MASK_PC0(0XFFFF0FFF) == 0XE3A00640 && + MASK_PC1(0XFFF00FFF) == 0XE5B00200 && + MASK_PC2(0XFFF00000) == 0XE1D00000 && + MASK_PC5(0XFFFF0000) != 0XE59F0000 && + MASK_PC6(0XFFFF0000) != 0XE59F0000 && + MASK_PC7(0XFFFF0000) != 0XE59F0000 ) hookpoint[hookpoint_idx++] = pc; else