about summary refs log tree commit diff stats
path: root/source/main.c
diff options
context:
space:
mode:
authorFIX94 <fix94.1@gmail.com>2016-04-10 16:14:38 +0200
committerFIX94 <fix94.1@gmail.com>2016-04-10 16:14:38 +0200
commit089ba86faf70be52e25eef5bbfbeb54439ea67f6 (patch)
tree851b0142a0a55139d9ba529938555b75b8f1d620 /source/main.c
parent378d297c658754980a03df1dbd7ff141ee59ae81 (diff)
downloadgen3uploader-089ba86faf70be52e25eef5bbfbeb54439ea67f6.tar.gz
gen3uploader-089ba86faf70be52e25eef5bbfbeb54439ea67f6.tar.bz2
gen3uploader-089ba86faf70be52e25eef5bbfbeb54439ea67f6.zip
added gba bios dumping
Diffstat (limited to 'source/main.c')
-rw-r--r--source/main.c41
1 files changed, 39 insertions, 2 deletions
diff --git a/source/main.c b/source/main.c index 6c34b92..f57aa6f 100644 --- a/source/main.c +++ b/source/main.c
@@ -23,8 +23,9 @@ void printmain()
23{ 23{
24 printf("\x1b[2J"); 24 printf("\x1b[2J");
25 printf("\x1b[37m"); 25 printf("\x1b[37m");
26 printf("GBA Link Cable Dumper v1.3 by FIX94\n"); 26 printf("GBA Link Cable Dumper v1.4 by FIX94\n");
27 printf("Save Support based on SendSave by Chishm\n"); 27 printf("Save Support based on SendSave by Chishm\n");
28 printf("GBA BIOS Dumper by Dark Fader\n \n");
28} 29}
29 30
30u8 *resbuf,*cmdbuf; 31u8 *resbuf,*cmdbuf;
@@ -312,7 +313,8 @@ int main(int argc, char *argv[])
312 while(1) 313 while(1)
313 { 314 {
314 printmain(); 315 printmain();
315 printf("Press A once you have a GBA Game inserted.\n \n"); 316 printf("Press A once you have a GBA Game inserted.\n");
317 printf("Press Y to backup the GBA BIOS.\n \n");
316 PAD_ScanPads(); 318 PAD_ScanPads();
317 VIDEO_WaitVSync(); 319 VIDEO_WaitVSync();
318 u32 btns = PAD_ButtonsDown(0); 320 u32 btns = PAD_ButtonsDown(0);
@@ -512,6 +514,41 @@ int main(int argc, char *argv[])
512 } 514 }
513 } 515 }
514 } 516 }
517 else if(btns&PAD_BUTTON_Y)
518 {
519 char biosname[64];
520 sprintf(biosname,"/dumps/gba_bios.bin");
521 FILE *f = fopen(biosname,"rb");
522 if(f)
523 {
524 fclose(f);
525 warnError("ERROR: BIOS already backed up!\n");
526 }
527 else
528 {
529 //create base file with size
530 printf("Preparing file...\n");
531 createFile(biosname,0x4000);
532 f = fopen(biosname,"wb");
533 if(!f)
534 fatalError("ERROR: Could not create file! Exit...");
535 //send over bios dump command
536 sendsafe_wait(4);
537 //the gba might still be in a loop itself
538 VIDEO_WaitVSync(); VIDEO_WaitVSync();
539 VIDEO_WaitVSync(); VIDEO_WaitVSync();
540 VIDEO_WaitVSync(); VIDEO_WaitVSync();
541 //lets go!
542 printf("Dumping...\n");
543 for(i = 0; i < 0x4000; i+=4)
544 *(vu32*)(testdump+i) = recvsafe();
545 fwrite(testdump,0x4000,1,f);
546 printf("Closing file\n");
547 fclose(f);
548 printf("BIOS dumped!\n");
549 sleep(5);
550 }
551 }
515 } 552 }
516 } 553 }
517 } 554 }