about summary refs log tree commit diff stats
path: root/source/main.c
diff options
context:
space:
mode:
authorFIX94 <fix94.1@gmail.com>2016-07-21 23:54:13 +0200
committerFIX94 <fix94.1@gmail.com>2016-07-21 23:54:13 +0200
commit004575f7cec14946c1936aceca6efee38b7f8a74 (patch)
treee9e62982feec63d93980088299498daf0d70ee40 /source/main.c
parentc8cb99e4acc2308afb484c8d032997271a116343 (diff)
downloadgen3uploader-004575f7cec14946c1936aceca6efee38b7f8a74.tar.gz
gen3uploader-004575f7cec14946c1936aceca6efee38b7f8a74.tar.bz2
gen3uploader-004575f7cec14946c1936aceca6efee38b7f8a74.zip
-added the ability to clear the save on the gba cartridge directly
Diffstat (limited to 'source/main.c')
-rw-r--r--source/main.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/source/main.c b/source/main.c index 53879de..7fd5683 100644 --- a/source/main.c +++ b/source/main.c
@@ -27,7 +27,7 @@ void printmain()
27{ 27{
28 printf("\x1b[2J"); 28 printf("\x1b[2J");
29 printf("\x1b[37m"); 29 printf("\x1b[37m");
30 printf("GBA Link Cable Dumper v1.5 by FIX94\n"); 30 printf("GBA Link Cable Dumper v1.6 by FIX94\n");
31 printf("Save Support based on SendSave by Chishm\n"); 31 printf("Save Support based on SendSave by Chishm\n");
32 printf("GBA BIOS Dumper by Dark Fader\n \n"); 32 printf("GBA BIOS Dumper by Dark Fader\n \n");
33} 33}
@@ -354,7 +354,8 @@ int main(int argc, char *argv[])
354 if(savesize > 0) 354 if(savesize > 0)
355 { 355 {
356 printf("Press Y to backup this save file.\n"); 356 printf("Press Y to backup this save file.\n");
357 printf("Press X to restore this save file.\n\n"); 357 printf("Press X to restore this save file.\n");
358 printf("Press Z to clear the save file on the GBA Cartridge.\n\n");
358 } 359 }
359 else 360 else
360 printf("\n"); 361 printf("\n");
@@ -385,6 +386,11 @@ int main(int argc, char *argv[])
385 command = 3; 386 command = 3;
386 break; 387 break;
387 } 388 }
389 else if(btns&PAD_TRIGGER_Z)
390 {
391 command = 4;
392 break;
393 }
388 } 394 }
389 } 395 }
390 if(command == 1) 396 if(command == 1)
@@ -490,19 +496,22 @@ int main(int argc, char *argv[])
490 printf("Save backed up!\n"); 496 printf("Save backed up!\n");
491 sleep(5); 497 sleep(5);
492 } 498 }
493 else if(command == 3) 499 else if(command == 3 || command == 4)
494 { 500 {
495 printf("Sending save\n");
496 VIDEO_WaitVSync();
497 u32 readval = 0; 501 u32 readval = 0;
498 while(readval != savesize) 502 while(readval != savesize)
499 readval = __builtin_bswap32(recv()); 503 readval = __builtin_bswap32(recv());
500 for(i = 0; i < savesize; i+=4) 504 if(command == 3)
501 send(__builtin_bswap32(*(vu32*)(testdump+i))); 505 {
506 printf("Sending save\n");
507 VIDEO_WaitVSync();
508 for(i = 0; i < savesize; i+=4)
509 send(__builtin_bswap32(*(vu32*)(testdump+i)));
510 }
502 printf("Waiting for GBA\n"); 511 printf("Waiting for GBA\n");
503 while(recv() != 0) 512 while(recv() != 0)
504 VIDEO_WaitVSync(); 513 VIDEO_WaitVSync();
505 printf("Save restored!\n"); 514 printf(command == 3 ? "Save restored!\n" : "Save cleared!\n");
506 send(0); 515 send(0);
507 sleep(5); 516 sleep(5);
508 } 517 }
@@ -526,7 +535,7 @@ int main(int argc, char *argv[])
526 if(!f) 535 if(!f)
527 fatalError("ERROR: Could not create file! Exit..."); 536 fatalError("ERROR: Could not create file! Exit...");
528 //send over bios dump command 537 //send over bios dump command
529 send(4); 538 send(5);
530 //the gba might still be in a loop itself 539 //the gba might still be in a loop itself
531 sleep(1); 540 sleep(1);
532 //lets go! 541 //lets go!