From 2bbcf63bd91568148d7326daf8719b3f0d02faab Mon Sep 17 00:00:00 2001 From: "Such Meme, Many Skill" Date: Thu, 23 Apr 2020 13:40:29 +0200 Subject: [PATCH] Fix restore% on e(mu)mmc partition restores --- source/tegraexplorer/emmc/emmcrestorepart.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/tegraexplorer/emmc/emmcrestorepart.c b/source/tegraexplorer/emmc/emmcrestorepart.c index 272a8f4..8a52fdc 100644 --- a/source/tegraexplorer/emmc/emmcrestorepart.c +++ b/source/tegraexplorer/emmc/emmcrestorepart.c @@ -23,7 +23,7 @@ int emmcRestorePart(char *path, sdmmc_storage_t *mmcstorage, emmc_part_t *part){ FILINFO fno; u8 *buf; u32 lba_curr = part->lba_start; - u32 bytesWritten = 0; + u64 bytesWritten = 0; u32 totalSectorsDest = part->lba_end - part->lba_start + 1; u64 totalSizeDest = (u64)((u64)totalSectorsDest << 9); u64 totalSize; @@ -93,9 +93,9 @@ int emmcRestorePart(char *path, sdmmc_storage_t *mmcstorage, emmc_part_t *part){ lba_curr += num; totalSectors -= num; - bytesWritten += num * NX_EMMC_BLOCKSIZE; + bytesWritten += (u64)(num * NX_EMMC_BLOCKSIZE); - pct = (u64)((u64)(bytesWritten) * 100u) / (u64)(fno.fsize); + pct = (u64)(bytesWritten * (u64)100) / (u64)(fno.fsize); gfx_printf("Progress: %d%%\r", pct); }