Change N64 CRC Error message

This commit is contained in:
sanni 2021-08-01 23:33:59 +02:00
parent a5f273289a
commit 07ec1f121a
2 changed files with 69 additions and 56 deletions

View File

@ -76,10 +76,11 @@ static const char N64CartMenuItem5[] PROGMEM = "Reset";
static const char* const menuOptionsN64Cart[] PROGMEM = {N64CartMenuItem1, N64CartMenuItem2, N64CartMenuItem3, N64CartMenuItem4, N64CartMenuItem5}; static const char* const menuOptionsN64Cart[] PROGMEM = {N64CartMenuItem1, N64CartMenuItem2, N64CartMenuItem3, N64CartMenuItem4, N64CartMenuItem5};
// N64 CRC32 error menu items // N64 CRC32 error menu items
static const char N64CRCMenuItem1[] PROGMEM = "Redump"; static const char N64CRCMenuItem1[] PROGMEM = "No";
static const char N64CRCMenuItem2[] PROGMEM = "Ignore"; static const char N64CRCMenuItem2[] PROGMEM = "Yes and keep old";
static const char N64CRCMenuItem3[] PROGMEM = "Reset"; static const char N64CRCMenuItem3[] PROGMEM = "Yes and delete old";
static const char* const menuOptionsN64CRC[] PROGMEM = {N64CRCMenuItem1, N64CRCMenuItem2, N64CRCMenuItem3}; static const char N64CRCMenuItem4[] PROGMEM = "Reset";
static const char* const menuOptionsN64CRC[] PROGMEM = {N64CRCMenuItem1, N64CRCMenuItem2, N64CRCMenuItem3, N64CRCMenuItem4};
// Rom menu // Rom menu
static const char N64RomItem1[] PROGMEM = "4MB"; static const char N64RomItem1[] PROGMEM = "4MB";
@ -2830,6 +2831,7 @@ void readRom_N64() {
strcpy(fileName, romName); strcpy(fileName, romName);
strcat(fileName, ".Z64"); strcat(fileName, ".Z64");
redumpnewfolder:
// create a new folder // create a new folder
EEPROM_readAnything(0, foldern); EEPROM_readAnything(0, foldern);
sprintf(folder, "N64/ROM/%s/%d", romName, foldern); sprintf(folder, "N64/ROM/%s/%d", romName, foldern);
@ -2846,7 +2848,7 @@ void readRom_N64() {
foldern = foldern + 1; foldern = foldern + 1;
EEPROM_writeAnything(0, foldern); EEPROM_writeAnything(0, foldern);
readn64rom: redumpsamefolder:
// Open file on sd card // Open file on sd card
if (!myFile.open(fileName, O_RDWR | O_CREAT)) { if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
print_Error(F("SD Error"), true); print_Error(F("SD Error"), true);
@ -2952,25 +2954,49 @@ readn64rom:
if (searchCRC(crcStr)) { if (searchCRC(crcStr)) {
// Dump was a known good rom // Dump was a known good rom
println_Msg(F("Checksum matches")); println_Msg(F("Checksum matches"));
print_Msg(F("Done ("));
print_Msg(timeElapsed); // include elapsed time
println_Msg(F("s)"));
println_Msg(F(""));
println_Msg(F("Press Button..."));
display_Update();
wait();
} }
else { else {
// Dump was bad or unknown // Dump was bad or unknown
errorLvl = 1;
rgb.setColor(255, 0, 0); rgb.setColor(255, 0, 0);
println_Msg(F("Checksum not found"));
// let bad crc show a short while println_Msg(F("in N64.txt"));
delay(3000); println_Msg(F(""));
println_Msg(F("Press Button..."));
display_Update();
wait();
// N64 CRC32 error Menu // N64 CRC32 error Menu
unsigned char CRCMenu; unsigned char CRCMenu;
// Copy menuOptions out of progmem // Copy menuOptions out of progmem
convertPgm(menuOptionsN64CRC, 3); convertPgm(menuOptionsN64CRC, 4);
CRCMenu = question_box(F("CRC ERROR "), menuOptions, 3, 0); CRCMenu = question_box(F("Redump cartridge?"), menuOptions, 4, 0);
// wait for user choice to come back from the question box menu // wait for user choice to come back from the question box menu
switch (CRCMenu) switch (CRCMenu)
{ {
case 0: case 0:
// Return to N64 menu
display_Clear();
break;
case 1:
// Dump again into new folder
display_Clear();
rgb.setColor(0, 0, 0);
goto redumpnewfolder;
break;
case 2:
// Dump again into same folder
// Change to last directory // Change to last directory
sd.chdir(folder); sd.chdir(folder);
// Delete old file // Delete old file
@ -2985,28 +3011,15 @@ readn64rom:
println_Msg(F("Reading Rom...")); println_Msg(F("Reading Rom..."));
display_Update(); display_Update();
rgb.setColor(0, 0, 0); rgb.setColor(0, 0, 0);
goto readn64rom; goto redumpsamefolder;
break; break;
case 1: case 3:
// Return to N64 menu
break;
case 2:
// Reset // Reset
resetArduino(); resetArduino();
break; break;
} }
} }
display_Update();
print_Msg(F("Done ("));
print_Msg(timeElapsed); // include elapsed time
println_Msg(F("s)"));
println_Msg(F(""));
println_Msg(F("Press Button..."));
display_Update();
wait();
} }
/****************************************** /******************************************