loader: revert to use the NS patch due to a Nintendo bug: https://www.3dbrew.org/wiki/NCCH/Extended_Header#Flag1

This commit is contained in:
Aurora Wright 2020-05-29 23:31:05 +02:00
parent 1899bf377b
commit 3a0418e279
2 changed files with 22 additions and 10 deletions

View File

@ -184,16 +184,6 @@ static Result GetProgramInfo(ExHeader_Info *exheaderInfo, u64 programHandle)
u64 originaltitleId = exheaderInfo->aci.local_caps.title_id;
if(CONFIG(PATCHGAMES) && loadTitleExheaderInfo(exheaderInfo->aci.local_caps.title_id, exheaderInfo))
exheaderInfo->aci.local_caps.title_id = originaltitleId;
if(isN3DS)
{
u32 cpuSetting = MULTICONFIG(NEWCPU);
if(cpuSetting & 0x1)
exheaderInfo->aci.local_caps.core_info.use_cpu_clockrate_804MHz = true;
if(cpuSetting & 0x2)
exheaderInfo->aci.local_caps.core_info.enable_l2c = true;
}
}
return res;

View File

@ -698,6 +698,28 @@ void patchCode(u64 progId, u16 progVer, u8 *code, u32 size, u32 textSize, u32 ro
if(ret == 0 || (ret == 1 && progVer > 0xB)) goto error;
}
if(isN3DS)
{
u32 cpuSetting = MULTICONFIG(NEWCPU);
if(cpuSetting != 0)
{
static const u8 pattern[] = {
0x0C, 0x00, 0x94, 0x15
};
u32 *off = (u32 *)memsearch(code, pattern, textSize, sizeof(pattern));
if(off == NULL) goto error;
//Patch N3DS CPU Clock and L2 cache setting
*(off - 4) = *(off - 3);
*(off - 3) = *(off - 1);
memmove(off - 1, off, 16);
*(off + 3) = 0xE3800000 | cpuSetting;
}
}
if(progVer > 0x12)
{
static const u8 pattern[] = {