diff --git a/source/nand/nand.c b/source/nand/nand.c index 04bbc02..d9776e3 100644 --- a/source/nand/nand.c +++ b/source/nand/nand.c @@ -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; } diff --git a/source/nand/virtual.c b/source/nand/virtual.c index 615b9db..07e5303 100644 --- a/source/nand/virtual.c +++ b/source/nand/virtual.c @@ -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);