From b0e2d5b6c2b3223e4d4860ee260023cad53dbb22 Mon Sep 17 00:00:00 2001 From: sanni Date: Wed, 14 Sep 2016 00:46:43 +0200 Subject: [PATCH] V19A: Minor bugfixes --- Cart_Reader/Cart_Reader.ino | 10 ++--- Cart_Reader/N64.ino | 24 +++++------ Cart_Reader/SNES.ino | 82 ++++++++++++++++++++++--------------- 3 files changed, 67 insertions(+), 49 deletions(-) diff --git a/Cart_Reader/Cart_Reader.ino b/Cart_Reader/Cart_Reader.ino index 5cf4fcd..ee0497a 100644 --- a/Cart_Reader/Cart_Reader.ino +++ b/Cart_Reader/Cart_Reader.ino @@ -2,8 +2,8 @@ Cartridge Reader for Arduino Mega2560 Author: sanni - Date: 2016-09-12 - Version: V19 + Date: 2016-09-14 + Version: V19A SD lib: https://github.com/greiman/SdFat LCD lib: https://github.com/adafruit/Adafruit_SSD1306 @@ -33,7 +33,7 @@ lukeskaff - Nintendo DS GBA slot timing **********************************************************************************/ -char ver[5] = "V19"; +char ver[5] = "V19A"; /****************************************** Define Output @@ -47,7 +47,7 @@ char ver[5] = "V19"; Define Input ******************************************/ // If you have two buttons on your cart reader you can remove the // -//#define enable_Button2 +#define enable_Button2 /****************************************** Pinout @@ -921,7 +921,7 @@ unsigned char questionBox_OLED(const char* question, char answers[7][20], int nu display.setCursor(0, 0); // change the rgb led to the start menu color - rgbLed(blue_color); + rgbLed(default_choice); // print menu display.println(question); diff --git a/Cart_Reader/N64.ino b/Cart_Reader/N64.ino index 059b8b8..6c6aff1 100644 --- a/Cart_Reader/N64.ino +++ b/Cart_Reader/N64.ino @@ -64,8 +64,8 @@ const char N64CartMenuItem4[] PROGMEM = "Reset"; const char* const menuOptionsN64Cart[] PROGMEM = {N64CartMenuItem1, N64CartMenuItem2, N64CartMenuItem3, N64CartMenuItem4}; // N64 CRC32 error menu items -const char N64CRCMenuItem1[] PROGMEM = "Redump"; -const char N64CRCMenuItem2[] PROGMEM = "Recalc CRC"; +const char N64CRCMenuItem1[] PROGMEM = "Recalc CRC"; +const char N64CRCMenuItem2[] PROGMEM = "Redump"; const char N64CRCMenuItem3[] PROGMEM = "Ignore"; const char N64CRCMenuItem4[] PROGMEM = "Reset"; const char* const menuOptionsN64CRC[] PROGMEM = {N64CRCMenuItem1, N64CRCMenuItem2, N64CRCMenuItem3, N64CRCMenuItem4}; @@ -2015,12 +2015,21 @@ calcn64crc: strcpy(tempStr3, "CRC ERROR "); strcat(tempStr3, crcStr); - CRCMenu = question_box(tempStr3, menuOptions, 4, 0); + CRCMenu = question_box(tempStr3, menuOptions, 4, 1); // wait for user choice to come back from the question box menu switch (CRCMenu) { case 0: + // Change to last directory + sd.chdir(folder); + display_Clear(); + // Calculate CRC again + rgb.setColor(0, 0, 0); + goto calcn64crc; + break; + + case 1: // Change to last directory sd.chdir(folder); // Delete old file @@ -2038,15 +2047,6 @@ calcn64crc: goto readn64rom; break; - case 1: - // Change to last directory - sd.chdir(folder); - display_Clear(); - // Calculate CRC again - rgb.setColor(0, 0, 0); - goto calcn64crc; - break; - case 2: // Return to N64 menu break; diff --git a/Cart_Reader/SNES.ino b/Cart_Reader/SNES.ino index b784c14..4c60200 100644 --- a/Cart_Reader/SNES.ino +++ b/Cart_Reader/SNES.ino @@ -62,49 +62,67 @@ void snesMenu() { break; case 1: - display_Clear(); - // Change working dir to root - sd.chdir("/"); - readSRAM(); + if (sramSize > 0) { + display_Clear(); + // Change working dir to root + sd.chdir("/"); + readSRAM(); + } + else { + display_Clear(); + print_Error(F("Does not have SRAM"), false); + } break; case 2: - display_Clear(); - // Change working dir to root - sd.chdir("/"); - writeSRAM(1); - unsigned long wrErrors; - wrErrors = verifySRAM(); - if (wrErrors == 0) { - println_Msg(F("Verified OK")); - display_Update(); + if (sramSize > 0) { + display_Clear(); + // Change working dir to root + sd.chdir("/"); + writeSRAM(1); + unsigned long wrErrors; + wrErrors = verifySRAM(); + if (wrErrors == 0) { + println_Msg(F("Verified OK")); + display_Update(); + } + else { + print_Msg(F("Error: ")); + print_Msg(wrErrors); + println_Msg(F(" bytes ")); + print_Error(F("did not verify."), false); + } } else { - print_Msg(F("Error: ")); - print_Msg(wrErrors); - println_Msg(F(" bytes ")); - print_Error(F("did not verify."), false); + display_Clear(); + print_Error(F("Does not have SRAM"), false); } break; case 3: - display_Clear(); - // Change working dir to root - sd.chdir("/"); - readSRAM(); - eraseSRAM(0x00); - eraseSRAM(0xFF); - writeSRAM(0); - wrErrors = verifySRAM(); - if (wrErrors == 0) { - println_Msg(F("Verified OK")); - display_Update(); + if (sramSize > 0) { + display_Clear(); + // Change working dir to root + sd.chdir("/"); + readSRAM(); + eraseSRAM(0x00); + eraseSRAM(0xFF); + writeSRAM(0); + unsigned long wrErrors = verifySRAM(); + if (wrErrors == 0) { + println_Msg(F("Verified OK")); + display_Update(); + } + else { + print_Msg(F("Error: ")); + print_Msg(wrErrors); + println_Msg(F(" bytes ")); + print_Error(F("did not verify."), false); + } } else { - print_Msg(F("Error: ")); - print_Msg(wrErrors); - println_Msg(F(" bytes ")); - print_Error(F("did not verify."), false); + display_Clear(); + print_Error(F("Does not have SRAM"), false); } break;