From 53e2ef24f142ea5a163e73b9e02145e02b99c103 Mon Sep 17 00:00:00 2001 From: TuxSH Date: Fri, 9 Jun 2017 04:11:23 +0200 Subject: [PATCH] Refactor pattern for ir hook --- sysmodules/rosalina/source/input_redirection.c | 8 +++----- sysmodules/rosalina/source/input_redirection_hooks.s | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/sysmodules/rosalina/source/input_redirection.c b/sysmodules/rosalina/source/input_redirection.c index 0c4a5e0..2a4f648 100644 --- a/sysmodules/rosalina/source/input_redirection.c +++ b/sysmodules/rosalina/source/input_redirection.c @@ -104,7 +104,7 @@ void inputRedirectionThreadMain(void) break; else if(n < 12) continue; - + memcpy(hidDataPhys, buf, 12); if(n >= 20) { @@ -117,7 +117,7 @@ void inputRedirectionThreadMain(void) srvPublishToSubscriber(0x204, 0); else if((oldSpecialButtons & 1) && !(specialButtons & 1)) // HOME button released srvPublishToSubscriber(0x205, 0); - + if(!(oldSpecialButtons & 2) && (specialButtons & 2)) // POWER button pressed srvPublishToSubscriber(0x202, 0); @@ -255,8 +255,6 @@ Result InputRedirection_DoOrUndoPatches(void) static const u32 irOrigCppFlagCode[] = { 0xE3550000, // cmp r5, #0 0xE3A0B080, // mov r11, #0x80 - 0xE28D0060, // add r0, sp, #0xb0+var_50 - 0x0A00002C // beq loc_105688 }; static u32 *irHookLoc, *irWaitSyncLoc, *irCppFlagLoc; @@ -316,7 +314,7 @@ Result InputRedirection_DoOrUndoPatches(void) *irWaitSyncLoc = 0xE3A00000; // mov r0, #0 // This NOPs out a flag check in ir:user's CPP emulation - *(irCppFlagLoc+3) = 0xea00002c; + *irCppFlagLoc = 0xE3150000; // tst r5, #0 } } diff --git a/sysmodules/rosalina/source/input_redirection_hooks.s b/sysmodules/rosalina/source/input_redirection_hooks.s index 315499b..e54e9df 100644 --- a/sysmodules/rosalina/source/input_redirection_hooks.s +++ b/sysmodules/rosalina/source/input_redirection_hooks.s @@ -108,7 +108,7 @@ b skip_vars i2c_readdeviceraw_addr: .word 0 redirected_input_addr: - .word 0 + .word 0 skip_vars: stmfd sp!, {r4-r5, lr} @@ -141,4 +141,4 @@ streq r0, [r4] @ store it instead of the value read from i2c @ Return! mov r0, #0 @ For ir:user. ldmfd sp!, {r4-r5, pc} -.pool \ No newline at end of file +.pool