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();
} }
/****************************************** /******************************************

View File

@ -94,35 +94,35 @@ bool getCartInfo_NGP() {
switch (romSize) switch (romSize)
{ {
// 4 Mbits // 4 Mbits
// Toshiba // Toshiba
case 0xab98: case 0xab98:
cartSize = 524288; cartSize = 524288;
break; break;
// Toshiba ? // Toshiba ?
case 0x4c20: case 0x4c20:
cartSize = 524288; cartSize = 524288;
break; break;
// 8 Mbits // 8 Mbits
// Toshiba // Toshiba
case 0x2c98: case 0x2c98:
cartSize = 1048576; cartSize = 1048576;
break; break;
// Samsung // Samsung
case 0x2cec: case 0x2cec:
cartSize = 1048576; cartSize = 1048576;
break; break;
// 16 Mbits // 16 Mbits
// Toshiba // Toshiba
case 0x2f98: case 0x2f98:
cartSize = 2097152; cartSize = 2097152;
break; break;
// Samsung // Samsung
case 0x2fec: case 0x2fec:
cartSize = 2097152; cartSize = 2097152;
break; break;
} }
// reset to read mode // reset to read mode
@ -166,16 +166,16 @@ void showCartInfo_NGP() {
print_Msg(F("System: ")); print_Msg(F("System: "));
if (ngpSystemType == 0) if (ngpSystemType == 0)
println_Msg(F("NGPMonochrome")); println_Msg(F("NGPMonochrome"));
else if (ngpSystemType == 16) else if (ngpSystemType == 16)
println_Msg(F("NGPColor")); println_Msg(F("NGPColor"));
else else
println_Msg(F("Unknown")); println_Msg(F("Unknown"));
print_Msg(F("Rom Size: ")); print_Msg(F("Rom Size: "));
print_Msg((cartSize >> 17)); print_Msg((cartSize >> 17));
println_Msg(F(" Mbits")); println_Msg(F(" Mbits"));
println_Msg(F("")); println_Msg(F(""));
println_Msg(F("Press Button...")); println_Msg(F("Press Button..."));
display_Update(); display_Update();