From 1ddfd7b5c47fdfea564b3722201038ce3f5213b6 Mon Sep 17 00:00:00 2001 From: Ash Logan Date: Mon, 24 Oct 2022 22:27:52 +1100 Subject: [PATCH] patcher: Be less noisy --- src/patcher/patcher.cpp | 8 +++++--- src/patcher/patches/youtube.cpp | 15 +++++++-------- src/patcher/rplinfo.cpp | 2 -- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/patcher/patcher.cpp b/src/patcher/patcher.cpp index ebafada..0fdf14d 100644 --- a/src/patcher/patcher.cpp +++ b/src/patcher/patcher.cpp @@ -22,8 +22,10 @@ bool replace_string(uint32_t start, uint32_t size, const char* original_val, siz bool PatchInstruction(void* instr, uint32_t original, uint32_t replacement) { uint32_t current = *(uint32_t*)instr; - DEBUG_FUNCTION_LINE("current instr %08x", current); - if (current != original) return current == replacement; + if (current != original) { + DEBUG_FUNCTION_LINE("Was given wrong instruction %08x, found %08x!", original, current); + return current == replacement; + } KernelCopyData(OSEffectiveToPhysical((uint32_t)instr), OSEffectiveToPhysical((uint32_t)&replacement), sizeof(replacement)); //Only works on AROMA! WUPS 0.1's KernelCopyData is uncached, needs DCInvalidate here instead @@ -31,7 +33,7 @@ bool PatchInstruction(void* instr, uint32_t original, uint32_t replacement) { ICInvalidateRange(instr, 4); current = *(uint32_t*)instr; - DEBUG_FUNCTION_LINE("patched instr %08x", current); + DEBUG_FUNCTION_LINE("patched instruction %08x -> %08x", original, current); return true; } diff --git a/src/patcher/patches/youtube.cpp b/src/patcher/patches/youtube.cpp index 57b1e88..da98a2d 100644 --- a/src/patcher/patches/youtube.cpp +++ b/src/patcher/patches/youtube.cpp @@ -9,17 +9,16 @@ #include void Patch_youtube(uint32_t titleVer, uint64_t titleId, const rplinfo& rpls) { - DEBUG_FUNCTION_LINE("YouTube %016llx v%d", titleId, titleVer); if (titleId == 0x0005000010105700 && titleVer == 193) { - auto res = FindRPL(rpls, "lb_shell.rpx"); - if (!res) return; + auto rpx = FindRPL(rpls, "lb_shell.rpx"); + if (!rpx) return; - DEBUG_FUNCTION_LINE("patching..."); + DEBUG_FUNCTION_LINE("Detected YouTube ALL v%d - patching...", titleVer); // OpenSSL ssl_verify_cert_chain - PatchInstruction((void*)(res->textAddr + 0x8dfdbc), 0x40820020, 0x60000000); - PatchInstruction((void*)(res->textAddr + 0x8dfdd4), 0x38600000, 0x38600001); + PatchInstruction((void*)(rpx->textAddr + 0x8dfdbc), 0x40820020, 0x60000000); + PatchInstruction((void*)(rpx->textAddr + 0x8dfdd4), 0x38600000, 0x38600001); // OpenSSL X509_verify_cert (called by cert_verify_proc_openssl.cc) - PatchInstruction((void*)(res->textAddr + 0x9208e8), 0x9421ffb8, 0x38600001); - PatchInstruction((void*)(res->textAddr + 0x9208ec), 0xbe410010, 0x4e800020); + PatchInstruction((void*)(rpx->textAddr + 0x9208e8), 0x9421ffb8, 0x38600001); + PatchInstruction((void*)(rpx->textAddr + 0x9208ec), 0xbe410010, 0x4e800020); } } diff --git a/src/patcher/rplinfo.cpp b/src/patcher/rplinfo.cpp index cc273ea..66fe665 100644 --- a/src/patcher/rplinfo.cpp +++ b/src/patcher/rplinfo.cpp @@ -24,8 +24,6 @@ std::optional> TryGetRPLInfo() { return std::nullopt; } - DEBUG_FUNCTION_LINE("num_rpls: %d", num_rpls); - std::vector rpls; rpls.resize(num_rpls);