Do not continuously print progress text

This commit is contained in:
RocketRobz 2020-12-03 00:07:42 -07:00
parent 076ddaa0b7
commit dcf6dca5bb

View File

@ -88,9 +88,10 @@ int dumpNAND(nocash_footer_t *footer){
FILE *f = fopen("nand.bin", "wb"); FILE *f = fopen("nand.bin", "wb");
if(!f) death("Could not open nand file"); if(!f) death("Could not open nand file");
iprintf("Dumping... \n"); iprintf("Dumping...\n");
iprintf("Hold A & B to cancel\n"); iprintf("Hold A & B to cancel\n");
iprintf("Progress: 0%% \r"); iprintf("\x1b[16;0H");
iprintf("Progress: 0%%\n");
swiSHA1Init(&ctx); swiSHA1Init(&ctx);
for(int i=0;i<rwTotal;i+=CHUNKSIZE){ //read from nand, dump to sd for(int i=0;i<rwTotal;i+=CHUNKSIZE){ //read from nand, dump to sd
@ -109,7 +110,8 @@ int dumpNAND(nocash_footer_t *footer){
fail=1; fail=1;
break; break;
} }
iprintf("Progress: %lu%% \r", (i+CHUNKSIZE)/(rwTotal/100)); iprintf("\x1b[16;0H");
iprintf("Progress: %lu%%\n", (i+CHUNKSIZE)/(rwTotal/100));
scanKeys(); scanKeys();
int keys = keysHeld(); int keys = keysHeld();
if(keys & KEY_A && keys & KEY_B){ if(keys & KEY_A && keys & KEY_B){
@ -174,7 +176,8 @@ int restoreNAND(nocash_footer_t *footer){
iprintf("Restoring... \n"); iprintf("Restoring... \n");
iprintf("Do not turn off the power.\n"); iprintf("Do not turn off the power.\n");
iprintf("Progress: 0%% Sectors written: 0\r"); iprintf("\x1b[16;0H");
iprintf("Progress: 0%%\nSectors written: 0\n");
int i2=0; int i2=0;
for(int i=0;i<rwTotal;i+=0x200){ //read nand dump from sd, compare sectors, and write to nand for(int i=0;i<rwTotal;i+=0x200){ //read nand dump from sd, compare sectors, and write to nand
@ -199,7 +202,8 @@ int restoreNAND(nocash_footer_t *footer){
} }
sectorsWritten++; sectorsWritten++;
} }
iprintf("Progress: %lu%% Sectors written: %i\r", (i+0x200)/(rwTotal/100), sectorsWritten); iprintf("\x1b[16;0H");
iprintf("Progress: %lu%%\nSectors written: %i\n", (i+0x200)/(rwTotal/100), sectorsWritten);
i2++; i2++;
} }