patcher: Be less noisy

This commit is contained in:
Ash Logan 2022-10-24 22:27:52 +11:00
commit 1ddfd7b5c4
3 changed files with 12 additions and 13 deletions

View file

@ -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;
}

View file

@ -9,17 +9,16 @@
#include <cstdint>
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);
}
}

View file

@ -24,8 +24,6 @@ std::optional<std::vector<OSDynLoad_NotifyData>> TryGetRPLInfo() {
return std::nullopt;
}
DEBUG_FUNCTION_LINE("num_rpls: %d", num_rpls);
std::vector<OSDynLoad_NotifyData> rpls;
rpls.resize(num_rpls);