Add patch entry for Miiverse/eShop whitelist, so that no patches are required for Miiverse clones to work

This commit is contained in:
Arian Kordi 2025-12-17 20:29:09 -05:00
parent 1c24dd2a6f
commit dda2bab504

View File

@ -268,6 +268,12 @@ static_assert(sizeof(bayo2_audioQueueFixSignature) == sizeof(bayo2_audioQueueFix
uint8 cars3_avro_schema_incref[] = { 0x2C,0x03,0x00,0x00,0x94,0x21,0xFF,0xE8,0x41,0x82,0x00,0x40,0x39,0x03,0x00,0x08,0x39,0x41,0x00,0x08,0x91,0x01,0x00,0x08,0x7D,0x80,0x50,0x28,0x2C,0x0C,0xFF,0xFF,0x41,0x82,0x00,0x28,0x39,0x21,0x00,0x0C,0x38,0x0C,0x00,0x01,0x38,0xE0,0x00,0x01,0x91,0x01,0x00,0x0C,0x7C,0x00,0x49,0x2D };
uint8 miiverse_eshop_url_match_whitelist_func[] = {
0x89,0x45,0x00,0x00, // lbz r10, 0x0(r5)
0x2c,0x0a,0x00,0x2e, // cmpwi r10, 0x2e
0x40,0x82,0x00,0x08, // bne LAB_020ff3a8
0x4b,0xff,0xff,0x5c // b FUN_020ff300
};
sint32 hleIndex_h000000001 = -1;
sint32 hleIndex_h000000002 = -1;
@ -461,6 +467,21 @@ void GamePatch_scan()
memory_writeU32(hleAddr + 0x64, 0x60000000);
}
// Patch out function in Miiverse/eShop wave.rpx that matches
// a domain against another to validate its whitelist.
// This allows those applets to load any domain.
hleAddr = hle_locate(miiverse_eshop_url_match_whitelist_func, nullptr, sizeof(miiverse_eshop_url_match_whitelist_func));
if (hleAddr)
{
cemuLog_log(LogType::Force, "Patching Miiverse/eShop whitelist check at: 0x{:08x}", hleAddr);
// Always return 1. (Note that the matched pattern is not at the beginning but still works)
memory_writeU32(hleAddr, 0x38600001);
memory_writeU32(hleAddr + 0x4, 0x4e800020);
// Note that the same applies to Account Settings, but
// its version of this function is radically different.
// Search: 88 0c ff ff 2c 00 00 2e (lbz r0,-0x1(r12); cmpwi r0,0x2e)
}
uint32 hleInstallEnd = GetTickCount();
cemuLog_log(LogType::Force, "HLE scan time: {}ms", hleInstallEnd-hleInstallStart);
}