From d81b972a9ce99c7d15a98faab3a35a0ebc8e2629 Mon Sep 17 00:00:00 2001 From: Visual Ehrmanntraut <30368284+VisualEhrmanntraut@users.noreply.github.com> Date: Sat, 21 Sep 2024 19:12:48 +0300 Subject: [PATCH] feat: Enable all PSP event logs on Big Sur and later --- NootedRed/HWLibs.cpp | 5 +++++ NootedRed/HWLibs.hpp | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/NootedRed/HWLibs.cpp b/NootedRed/HWLibs.cpp index 10b76bf..cf17e9f 100644 --- a/NootedRed/HWLibs.cpp +++ b/NootedRed/HWLibs.cpp @@ -317,6 +317,11 @@ bool X5000HWLibs::processKext(KernelPatcher &patcher, size_t id, mach_vm_address const LookupPatchPlus patch = {&kextRadeonX5000HWLibs, kAtiPowerPlayServicesConstructorOriginal, kAtiPowerPlayServicesConstructorPatched, 1}; PANIC_COND(!patch.apply(patcher, slide, size), "HWLibs", "Failed to apply MCIL debugLevel patch"); + if (NRed::callback->attributes.isBigSurAndLater()) { + const LookupPatchPlus patch = {&kextRadeonX5000HWLibs, kAmdLogPspOriginal, kAmdLogPspOriginalMask, + kAmdLogPspPatched, 1}; + PANIC_COND(!patch.apply(patcher, slide, size), "HWLibs", "Failed to apply amd_log_psp patch"); + } } return true; diff --git a/NootedRed/HWLibs.hpp b/NootedRed/HWLibs.hpp index 45fe773..07d1c8c 100644 --- a/NootedRed/HWLibs.hpp +++ b/NootedRed/HWLibs.hpp @@ -301,3 +301,14 @@ static const UInt8 kSDMAInitFunctionPointerListPatchedMask[] = {0xFF, 0xFF, 0xFF // Enable all MCIL debug prints (debugLevel = 0xFFFFFFFF, mostly for PP_Log). static const UInt8 kAtiPowerPlayServicesConstructorOriginal[] = {0x8B, 0x40, 0x60, 0x48, 0x8D}; static const UInt8 kAtiPowerPlayServicesConstructorPatched[] = {0x83, 0xC8, 0xFF, 0x48, 0x8D}; + +// Enable printing of all PSP event logs +static const UInt8 kAmdLogPspOriginal[] = {0x83, 0x00, 0x02, 0x0F, 0x85, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x83, 0x00, 0x02, 0x72, 0x00, 0x41, 0x00, 0x00, 0x09, 0x02, 0x18, 0x00, 0x74, 0x00, 0x41, 0x00, + 0x00, 0x01, 0x06, 0x10, 0x00, 0x0f, 0x85, 0x00, 0x00, 0x00, 0x00}; +static const UInt8 kAmdLogPspOriginalMask[] = {0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, + 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00}; +static const UInt8 kAmdLogPspPatched[] = {0x66, 0x90, 0x66, 0x90, 0x66, 0x90, 0x66, 0x90, 0x66, 0x90, 0x66, 0x90, 0x66, + 0x90, 0x66, 0x90, 0x66, 0x90, 0x66, 0x90, 0x66, 0x90, 0x66, 0x90, 0x66, 0x90, 0x66, 0x90, 0x66, 0x90, 0x66, 0x90, + 0x66, 0x90, 0x66, 0x90, 0x66, 0x90, 0x66, 0x90, 0x66, 0x90, 0x90};