mirror of
https://github.com/d0k3/GodMode9.git
synced 2025-06-26 13:42:47 +00:00
Workaround for empty EmuNAND partitions
This commit is contained in:
parent
cc31926a69
commit
e4d4b05cc9
@ -444,6 +444,7 @@ u32 GetNandSizeSectors(u32 nand_src)
|
|||||||
u32 emunand_max_sectors = (partition_offset >= (emunand_base_sector + 1)) ? // +1 for safety
|
u32 emunand_max_sectors = (partition_offset >= (emunand_base_sector + 1)) ? // +1 for safety
|
||||||
partition_offset - (emunand_base_sector + 1) : 0;
|
partition_offset - (emunand_base_sector + 1) : 0;
|
||||||
u32 emunand_min_sectors = (emunand_base_sector % 0x2000 == 0) ? sysnand_sectors : min_sectors;
|
u32 emunand_min_sectors = (emunand_base_sector % 0x2000 == 0) ? sysnand_sectors : min_sectors;
|
||||||
|
if (!emunand_min_sectors) emunand_min_sectors = GetNandMinSizeSectors(NAND_SYSNAND);
|
||||||
return (emunand_min_sectors > emunand_max_sectors) ? 0 : emunand_min_sectors;
|
return (emunand_min_sectors > emunand_max_sectors) ? 0 : emunand_min_sectors;
|
||||||
} else if (nand_src == NAND_IMGNAND) { // for images
|
} else if (nand_src == NAND_IMGNAND) { // for images
|
||||||
u32 img_sectors = (GetMountState() & IMG_NAND) ? GetMountSize() / 0x200 : 0;
|
u32 img_sectors = (GetMountState() & IMG_NAND) ? GetMountSize() / 0x200 : 0;
|
||||||
|
@ -83,13 +83,6 @@ bool ReadVNandDir(VirtualFile* vfile, VirtualDir* vdir) { // uses a generic vdir
|
|||||||
vfile->offset += 0x200 - 0x42;
|
vfile->offset += 0x200 - 0x42;
|
||||||
vfile->size = 0x42;
|
vfile->size = 0x42;
|
||||||
}
|
}
|
||||||
if (vfile->flags & VFLAG_NAND_SIZE) {
|
|
||||||
if ((nand_src != VRT_SYSNAND) && (GetNandSizeSectors(NAND_SYSNAND) > GetNandSizeSectors(nand_src)))
|
|
||||||
continue; // EmuNAND / ImgNAND is too small
|
|
||||||
u64 nand_size = GetNandSizeSectors(NAND_SYSNAND) * 0x200;
|
|
||||||
if (nand_size <= vfile->offset) continue;
|
|
||||||
vfile->size = nand_size - vfile->offset;
|
|
||||||
}
|
|
||||||
if (vfile->flags & VFLAG_ESSENTIAL) {
|
if (vfile->flags & VFLAG_ESSENTIAL) {
|
||||||
const u8 magic[] = { ESSENTIAL_MAGIC };
|
const u8 magic[] = { ESSENTIAL_MAGIC };
|
||||||
u8 data[sizeof(magic)];
|
u8 data[sizeof(magic)];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user