From 004575f7cec14946c1936aceca6efee38b7f8a74 Mon Sep 17 00:00:00 2001 From: FIX94 Date: Thu, 21 Jul 2016 23:54:13 +0200 Subject: -added the ability to clear the save on the gba cartridge directly --- gba/source/main.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'gba/source/main.c') diff --git a/gba/source/main.c b/gba/source/main.c index f309db2..ee94c35 100644 --- a/gba/source/main.c +++ b/gba/source/main.c @@ -56,7 +56,7 @@ int main(void) { // ansi escape sequence to set print co-ordinates // /x1b[line;columnH u32 i; - iprintf("\x1b[9;2HGBA Link Cable Dumper v1.5\n"); + iprintf("\x1b[9;2HGBA Link Cable Dumper v1.6\n"); iprintf("\x1b[10;4HPlease look at the TV\n"); // disable this, needs power SNDSTAT = 0; @@ -156,15 +156,24 @@ int main(void) { REG_HS_CTRL |= JOY_RW; } } - else if(choseval == 3) + else if(choseval == 3 || choseval == 4) { REG_JOYTR = savesize; - //receive the save - for(i = 0; i < savesize; i+=4) + if(choseval == 3) { - while((REG_HS_CTRL&JOY_WRITE) == 0) ; - REG_HS_CTRL |= JOY_RW; - *(vu32*)(save_data+i) = REG_JOYRE; + //receive the save + for(i = 0; i < savesize; i+=4) + { + while((REG_HS_CTRL&JOY_WRITE) == 0) ; + REG_HS_CTRL |= JOY_RW; + *(vu32*)(save_data+i) = REG_JOYRE; + } + } + else + { + //clear the save + for(i = 0; i < savesize; i+=4) + *(vu32*)(save_data+i) = 0; } //disable interrupts u32 prevIrqMask = REG_IME; @@ -203,7 +212,7 @@ int main(void) { { REG_HS_CTRL |= JOY_RW; u32 choseval = REG_JOYRE; - if(choseval == 4) + if(choseval == 5) { //disable interrupts u32 prevIrqMask = REG_IME; -- cgit 1.4.1