From 0eca7bf37cb917560577b94328f317e351969570 Mon Sep 17 00:00:00 2001 From: "crediar@rypp.net" Date: Sun, 24 Jun 2012 20:18:39 +0000 Subject: [PATCH] Patches: *Fixed a small bug that would keep searching for a place to hook even after an offset was found git-svn-id: svn://localhost/Users/andi/Downloads/code/trunk@7 be6c1b03-d731-4111-a574-e37d80d43941 --- Patches.c | 71 +++++++++++++++++++++++++++---------------------------- 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/Patches.c b/Patches.c index df9abce..a7eb918 100644 --- a/Patches.c +++ b/Patches.c @@ -408,11 +408,9 @@ void DoPatches( char *ptr, u32 size, u32 SectionOffset ) write32(0x00003194, 0x48000028); } - // Reset Found for( k=0; k < sizeof(FPatterns)/sizeof(FuncPattern); ++k ) - FPatterns[k].Found = 0; - + FPatterns[k].Found = 0; if( ConfigGetConfig(DML_CFG_NMM) ) DoCardPatches( ptr, size, SectionOffset ); @@ -633,39 +631,7 @@ void DoPatches( char *ptr, u32 size, u32 SectionOffset ) PatchCount |= 8; } - if( (PatchCount & 32) == 0 ) - { - if( (read32( (u32)ptr + i + 0 ) & 0xFFFF) == 0xCC00 && // Game - (read32( (u32)ptr + i + 4 ) & 0xFFFF) == 0x6000 && - (read32( (u32)ptr + i +12 ) & 0xFFFF) == 0x001C - ) - { - u32 Offset = (u32)ptr + i; - - dbgprintf("Patch:[cbForStateBusy] 0x%08X\n", Offset + SectionOffset ); - - write32( Offset, 0x3C80C000 ); - write32( Offset+4, 0x38842F30 ); - - PatchCount |= 32; - - } else if( (read32( (u32)ptr + i + 0 ) & 0xFFFF) == 0xCC00 && // Loader - (read32( (u32)ptr + i + 4 ) & 0xFFFF) == 0x6018 && - (read32( (u32)ptr + i +12 ) & 0xFFFF) == 0x001C - ) - { - u32 Offset = (u32)ptr + i; - - dbgprintf("Patch:[cbForStateBusy] 0x%08X\n", Offset + SectionOffset ); - - write32( Offset, 0x3C60C000 ); - write32( Offset+4, 0x80832F48 ); - - PatchCount |= 32; - - } - } - + if( (PatchCount & 16) == 0 ) if( ConfigGetConfig(DML_CFG_CHEATS) || ConfigGetConfig( DML_CFG_DEBUGGER ) ) { // OSSleepThread(Pattern 1) @@ -744,6 +710,39 @@ void DoPatches( char *ptr, u32 size, u32 SectionOffset ) } } + if( (PatchCount & 32) == 0 ) + { + if( (read32( (u32)ptr + i + 0 ) & 0xFFFF) == 0xCC00 && // Game + (read32( (u32)ptr + i + 4 ) & 0xFFFF) == 0x6000 && + (read32( (u32)ptr + i +12 ) & 0xFFFF) == 0x001C + ) + { + u32 Offset = (u32)ptr + i; + + dbgprintf("Patch:[cbForStateBusy] 0x%08X\n", Offset + SectionOffset ); + + write32( Offset, 0x3C80C000 ); + write32( Offset+4, 0x38842F30 ); + + PatchCount |= 32; + + } else if( (read32( (u32)ptr + i + 0 ) & 0xFFFF) == 0xCC00 && // Loader + (read32( (u32)ptr + i + 4 ) & 0xFFFF) == 0x6018 && + (read32( (u32)ptr + i +12 ) & 0xFFFF) == 0x001C + ) + { + u32 Offset = (u32)ptr + i; + + dbgprintf("Patch:[cbForStateBusy] 0x%08X\n", Offset + SectionOffset ); + + write32( Offset, 0x3C60C000 ); + write32( Offset+4, 0x80832F48 ); + + PatchCount |= 32; + + } + } + if( ConfigGetConfig(DML_CFG_CHEATS) ) { if( PatchCount == 63 )