From 67ad6d425a0e546a2372aa400a8581a388209482 Mon Sep 17 00:00:00 2001 From: Pixel-Pop Date: Fri, 17 Jul 2020 14:07:45 -0700 Subject: [PATCH 1/2] Patch DLP client region check --- sysmodules/loader/source/patcher.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sysmodules/loader/source/patcher.c b/sysmodules/loader/source/patcher.c index f38e3a4..76e12c1 100644 --- a/sysmodules/loader/source/patcher.c +++ b/sysmodules/loader/source/patcher.c @@ -817,6 +817,13 @@ void patchCode(u64 progId, u16 progVer, u8 *code, u32 size, u32 textSize, u32 ro 0x00, 0x00, 0x00, 0x00 }; + static const u8 pattern2[] = { + 0xBB, 0xD1 + }, + patch2[] = { + 0xC0, 0x46 // mov r8, r8 + }; + //Patch DLP region check if(!patchMemory(code, textSize, pattern, @@ -824,6 +831,14 @@ void patchCode(u64 progId, u16 progVer, u8 *code, u32 size, u32 textSize, u32 ro patch, sizeof(patch), 1 )) goto error; + + // Patch DLP client region check + if (!patchMemory(code, textSize, + pattern2, + sizeof(pattern2), 0, + patch2, + sizeof(patch2), 1 + )) goto error; } else if((progId & ~0xF0000001ULL) == 0x0004013000001A02LL) //DSP, SAFE_FIRM DSP From a7ce156f5919d70a4c2876d24479932b9da617a9 Mon Sep 17 00:00:00 2001 From: Pixel-Pop Date: Sat, 18 Jul 2020 15:25:53 -0700 Subject: [PATCH 2/2] Update dlp client region free Allows all dlp versions to have region free by patching necessary instruction after locating it with pattern. --- sysmodules/loader/source/patcher.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/sysmodules/loader/source/patcher.c b/sysmodules/loader/source/patcher.c index 76e12c1..10c6b04 100644 --- a/sysmodules/loader/source/patcher.c +++ b/sysmodules/loader/source/patcher.c @@ -818,7 +818,10 @@ void patchCode(u64 progId, u16 progVer, u8 *code, u32 size, u32 textSize, u32 ro }; static const u8 pattern2[] = { - 0xBB, 0xD1 + 0x20, 0x82, 0xa8, 0x7e, 0x00, 0x28, 0x00, 0xd0, 0x01, 0x20, 0xa0, 0x77 + }, + pattern3[] = { + 0x42 }, patch2[] = { 0xC0, 0x46 // mov r8, r8 @@ -833,9 +836,11 @@ void patchCode(u64 progId, u16 progVer, u8 *code, u32 size, u32 textSize, u32 ro )) goto error; // Patch DLP client region check - if (!patchMemory(code, textSize, - pattern2, - sizeof(pattern2), 0, + u8 *found = memsearch(code, pattern2, textSize, sizeof(pattern2)); + + if (!patchMemory(found, textSize, + pattern3, + sizeof(pattern3), 1, patch2, sizeof(patch2), 1 )) goto error;