Fix EmuNAND size detection

The full size NAND.bin will now turn up in EmuNAND virtual files, too!
This commit is contained in:
d0k3 2016-03-28 13:09:36 +02:00
parent c07686da7a
commit 10b79cfadb
2 changed files with 3 additions and 2 deletions

View File

@ -684,5 +684,5 @@ uint64_t GetPartitionOffsetSector(const char* path)
int pdrv = PathToNumFS(path);
if (pdrv < 0) return -1;
return (uint64_t) fs[pdrv].fatbase;
return (uint64_t) fs[pdrv].volbase;
}

View File

@ -195,7 +195,8 @@ u64 GetNandSizeSectors(bool size_emunand)
u32 emunand_max_sectors = GetPartitionOffsetSector("0:") - (emunand_base_sector + 1); // +1 for safety
u32 emunand_min_sectors = (emunand_base_sector % 0x200000 == 0) ? getMMCDevice(0)->total_size :
(GetUnitPlatform() == PLATFORM_N3DS) ? 0x26C000 : 0x1D7800;
return (emunand_min_sectors > emunand_max_sectors) ? 0 : emunand_min_sectors;
if (emunand_max_sectors >= getMMCDevice(0)->total_size) return getMMCDevice(0)->total_size;
else return (emunand_min_sectors > emunand_max_sectors) ? 0 : emunand_min_sectors;
} else return getMMCDevice(0)->total_size; // for SysNAND
}