From 99a2b2be5185b5d7080185ca585b415a7115714a Mon Sep 17 00:00:00 2001 From: Dan Ware Date: Sun, 31 May 2020 22:13:31 +0100 Subject: [PATCH] Fixed a regression bug which involved an overwritten Hekate file --- source/incognito/io/io.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/source/incognito/io/io.c b/source/incognito/io/io.c index 889a044..0d7cf3d 100644 --- a/source/incognito/io/io.c +++ b/source/incognito/io/io.c @@ -149,11 +149,20 @@ bool prodinfo_write( if(!_emmc_xts(9, 8, 1, tweak, regen_tweak, tweak_exp, prev_cluster, buff, buff, count * 0x200)){ return false; } - if (nx_emmc_part_write(&storage, prodinfo_part, sector, count, buff)) + if (nx_emummc_part_write(&storage, prodinfo_part, sector, count, buff)) { prev_sector = sector + count - 1; return true; } return false; -} \ No newline at end of file +} + +// replacement for nx_emmc_part_write in storage/nx_emmc, which uses sdmmc_storage_write +int nx_emummc_part_write(sdmmc_storage_t *storage, emmc_part_t *part, u32 sector_off, u32 num_sectors, void *buf) +{ + // The last LBA is inclusive. + if (part->lba_start + sector_off > part->lba_end) + return 0; + return emummc_storage_write(storage, part->lba_start + sector_off, num_sectors, buf); +}