Workaround for empty / incompatible EmuNANDs

This commit is contained in:
d0k3 2016-07-13 20:58:38 +02:00
parent 7988a26acc
commit 3eeb5fbca3
2 changed files with 6 additions and 3 deletions

View File

@ -338,7 +338,7 @@ u32 CheckNandType(u32 nand_src)
if (ReadNandSectors(NAND_BUFFER, 0, 1, 0xFF, nand_src) != 0)
return 0;
if (memcmp(NAND_BUFFER + 0x100, nand_magic_n3ds, 0x60) == 0) {
return NAND_TYPE_N3DS;
return (GetUnitPlatform() == PLATFORM_3DS) ? 0 : NAND_TYPE_N3DS;
} else if (memcmp(NAND_BUFFER + 0x100, nand_magic_o3ds, 0x60) == 0) {
return (GetUnitPlatform() == PLATFORM_3DS) ? NAND_TYPE_O3DS : NAND_TYPE_NO3DS;
}

View File

@ -80,8 +80,11 @@ bool FindVirtualFile(VirtualFile* vfile, const char* path, u32 size)
if (!virtual_src || (fname - path != 3))
return false;
// check NAND type
virtual_type = (virtual_src & VRT_ANYNAND) ? CheckNandType(virtual_src) : virtual_src;
// check virtual type
if (virtual_src & VRT_ANYNAND) {
virtual_type = CheckNandType(virtual_src); // workaround if this comes up with no result
if (!virtual_type) virtual_type = (GetUnitPlatform() == PLATFORM_3DS) ? NAND_TYPE_O3DS : NAND_TYPE_N3DS;
} else virtual_type = virtual_src;
// parse the template list, get the correct one
u32 n_templates = sizeof(virtualFileTemplates) / sizeof(VirtualFile);