diff --git a/Cart_Reader/COLV.ino b/Cart_Reader/COLV.ino index 3937e51..9f16d84 100644 --- a/Cart_Reader/COLV.ino +++ b/Cart_Reader/COLV.ino @@ -51,8 +51,8 @@ byte newcolsize; static const char colMenuItem1[] PROGMEM = "Select Cart"; static const char colMenuItem2[] PROGMEM = "Read ROM"; static const char colMenuItem3[] PROGMEM = "Set Size"; -static const char colMenuItem4[] PROGMEM = "Reset"; -static const char* const menuOptionsCOL[] PROGMEM = { colMenuItem1, colMenuItem2, colMenuItem3, colMenuItem4 }; +//static const char colMenuItem4[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const menuOptionsCOL[] PROGMEM = { colMenuItem1, colMenuItem2, colMenuItem3, string_reset2 }; void setup_COL() { // Set Address Pins to Output @@ -175,14 +175,14 @@ void readROM_COL() { sd.chdir(folder); display_Clear(); - print_Msg(F("Saving to ")); + print_STR(saving_to_STR, 0); print_Msg(folder); println_Msg(F("/...")); display_Update(); // open file on sdcard if (!myFile.open(fileName, O_RDWR | O_CREAT)) - print_Error(F("Can't create file on SD"), true); + print_Error(create_file_STR, true); // write new folder number back to EEPROM foldern++; @@ -216,7 +216,8 @@ void readROM_COL() { compareCRC("colv.txt", 0, 1, 0); println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); } @@ -239,11 +240,11 @@ void setROMSize_COL() { println_Msg(COL[i]); println_Msg(F("")); #if defined(enable_OLED) - println_Msg(F("Press left to Change")); - println_Msg(F("and right to Select")); + print_STR(press_to_change_STR, 1); + print_STR(right_to_select_STR, 1); #elif defined(enable_LCD) - println_Msg(F("Rotate to Change")); - println_Msg(F("Press to Select")); + print_STR(rotate_to_change_STR, 1); + print_STR(press_to_select_STR, 1); #endif display_Update(); @@ -261,11 +262,11 @@ void setROMSize_COL() { println_Msg(COL[i]); println_Msg(F("")); #if defined(enable_OLED) - println_Msg(F("Press left to Change")); - println_Msg(F("and right to Select")); + print_STR(press_to_change_STR, 1); + print_STR(right_to_select_STR, 1); #elif defined(enable_LCD) - println_Msg(F("Rotate to Change")); - println_Msg(F("Press to Select")); + print_STR(rotate_to_change_STR, 1); + print_STR(press_to_select_STR, 1); #endif display_Update(); } @@ -281,11 +282,11 @@ void setROMSize_COL() { println_Msg(COL[i]); println_Msg(F("")); #if defined(enable_OLED) - println_Msg(F("Press left to Change")); - println_Msg(F("and right to Select")); + print_STR(press_to_change_STR, 1); + print_STR(right_to_select_STR, 1); #elif defined(enable_LCD) - println_Msg(F("Rotate to Change")); - println_Msg(F("Press to Select")); + print_STR(rotate_to_change_STR, 1); + print_STR(press_to_select_STR, 1); #endif display_Update(); } @@ -349,7 +350,8 @@ void checkStatus_COL() { print_Msg(COL[colsize]); println_Msg(F("K")); println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); #else @@ -460,11 +462,11 @@ void setCart_COL() { println_Msg(F("KB")); println_Msg(F("")); #if defined(enable_OLED) - println_Msg(F("Press left to Change")); - println_Msg(F("and right to Select")); + print_STR(press_to_change_STR, 1); + print_STR(right_to_select_STR, 1); #elif defined(enable_LCD) - println_Msg(F("Rotate to Change")); - println_Msg(F("Press to Select")); + print_STR(rotate_to_change_STR, 1); + print_STR(press_to_select_STR, 1); #elif defined(SERIAL_MONITOR) println_Msg(F("U/D to Change")); println_Msg(F("Space to Select")); diff --git a/Cart_Reader/Cart_Reader.ino b/Cart_Reader/Cart_Reader.ino index 7bf8f56..72b05d0 100644 --- a/Cart_Reader/Cart_Reader.ino +++ b/Cart_Reader/Cart_Reader.ino @@ -56,7 +56,7 @@ **********************************************************************************/ -char ver[5] = "10.3"; +char ver[5] = "10.4"; //****************************************** // !!! CHOOSE HARDWARE VERSION !!! @@ -263,6 +263,57 @@ bool i2c_found; #include "FreqCount.h" #endif +/****************************************** + Common Strings + *****************************************/ +#define press_button_STR 0 +#define sd_error_STR 1 +#define reset_STR 2 +#define did_not_verify_STR 3 +#define _bytes_STR 4 +#define error_STR 5 +#define create_file_STR 6 +#define open_file_STR 7 +#define file_too_big_STR 8 +#define done_STR 9 +#define saving_to_STR 10 +#define verifying_STR 11 +#define flashing_file_STR 12 +#define press_to_change_STR 13 +#define right_to_select_STR 14 +#define rotate_to_change_STR 15 +#define press_to_select_STR 16 + +// This arrays holds the most often uses strings +static const char string_press_button0[] PROGMEM = "Press Button..."; +static const char string_sd_error1[] PROGMEM = "SD Error"; +static const char string_reset2[] PROGMEM = "Reset"; +static const char string_did_not_verify3[] PROGMEM = "did not verify"; +static const char string_bytes4[] PROGMEM = " bytes "; +static const char string_error5[] PROGMEM = "Error: "; +static const char string_create_file6[] PROGMEM = "Can't create file"; +static const char string_open_file7[] PROGMEM = "Can't open file"; +static const char string_file_too_big8[] PROGMEM = "File too big"; +static const char string_done9[] PROGMEM = "Done"; +static const char string_saving_to10[] PROGMEM = "Saving to "; +static const char string_verifying11[] PROGMEM = "Verifying..."; +static const char string_flashing_file12[] PROGMEM = "Flashing file "; +static const char string_press_to_change13[] PROGMEM = "Press left to Change"; +static const char string_right_to_select14[] PROGMEM = "and right to Select"; +static const char string_rotate_to_change15[] PROGMEM = "Rotate to Change"; +static const char string_press_to_select16[] PROGMEM = "Press to Select"; + +static const char* const string_table[] PROGMEM = { string_press_button0, string_sd_error1, string_reset2, string_did_not_verify3, string_bytes4, string_error5, string_create_file6, string_open_file7, string_file_too_big8, string_done9, string_saving_to10, string_verifying11, string_flashing_file12, string_press_to_change13, string_right_to_select14, string_rotate_to_change15, string_press_to_select16 }; + +void print_STR(byte string_number, boolean newline) { + char string_buffer[22]; + strcpy_P(string_buffer, (char*)pgm_read_word(&(string_table[string_number]))); + if (newline) + println_Msg(string_buffer); + else + print_Msg(string_buffer); +} + /****************************************** Defines *****************************************/ @@ -629,7 +680,7 @@ boolean compareCRC(char* database, char* crcString, boolean renamerom, int offse // Write iNES header sd.chdir(folder); if (!myFile.open(fileName, O_RDWR)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } for (byte z = 0; z < 16; z++) { myFile.write(iNES_HEADER[z]); @@ -973,15 +1024,15 @@ static const char modeItem4[] PROGMEM = "Nintendo 64(3V EEP)"; #endif static const char modeItem5[] PROGMEM = "Game Boy"; static const char modeItem6[] PROGMEM = "About"; -static const char modeItem7[] PROGMEM = "Reset"; -static const char* const modeOptions[] PROGMEM = { modeItem1, modeItem2, modeItem3, modeItem4, modeItem5, modeItem6, modeItem7 }; +// static const char modeItem7[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const modeOptions[] PROGMEM = { modeItem1, modeItem2, modeItem3, modeItem4, modeItem5, modeItem6, string_reset2 }; // Add-ons submenu static const char addonsItem1[] PROGMEM = "Consoles"; static const char addonsItem2[] PROGMEM = "Handhelds"; static const char addonsItem3[] PROGMEM = "Flashrom Programmer"; -static const char addonsItem4[] PROGMEM = "Reset"; -static const char* const addonsOptions[] PROGMEM = { addonsItem1, addonsItem2, addonsItem3, addonsItem4 }; +//static const char addonsItem4[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const addonsOptions[] PROGMEM = { addonsItem1, addonsItem2, addonsItem3, string_reset2 }; // Consoles submenu static const char consolesItem1[] PROGMEM = "NES/Famicom"; @@ -989,8 +1040,8 @@ static const char consolesItem2[] PROGMEM = "PC Engine/TG16"; static const char consolesItem3[] PROGMEM = "SMS/GG/MIII/SG-1000"; static const char consolesItem4[] PROGMEM = "Intellivision"; static const char consolesItem5[] PROGMEM = "Colecovision"; -static const char consolesItem6[] PROGMEM = "Reset"; -static const char* const consolesOptions[] PROGMEM = { consolesItem1, consolesItem2, consolesItem3, consolesItem4, consolesItem5, consolesItem6 }; +//static const char consolesItem6[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const consolesOptions[] PROGMEM = { consolesItem1, consolesItem2, consolesItem3, consolesItem4, consolesItem5, string_reset2 }; // Handhelds submenu static const char handheldsItem1[] PROGMEM = "Virtual Boy"; @@ -998,8 +1049,8 @@ static const char handheldsItem2[] PROGMEM = "WonderSwan"; static const char handheldsItem3[] PROGMEM = "NeoGeo Pocket"; static const char handheldsItem4[] PROGMEM = "Watara Supervision"; static const char handheldsItem5[] PROGMEM = "Pocket Challenge W"; -static const char handheldsItem6[] PROGMEM = "Reset"; -static const char* const handheldsOptions[] PROGMEM = { handheldsItem1, handheldsItem2, handheldsItem3, handheldsItem4, handheldsItem5, handheldsItem6 }; +//static const char handheldsItem6[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const handheldsOptions[] PROGMEM = { handheldsItem1, handheldsItem2, handheldsItem3, handheldsItem4, handheldsItem5, string_reset2 }; // All included slots void mainMenu() { @@ -1227,7 +1278,8 @@ void aboutScreen() { println_Msg(F("")); println_Msg(F("")); println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); while (1) { @@ -1539,14 +1591,14 @@ void savetofile() { delay(2000); if (!myFile.open("/snes_clk.txt", O_WRITE | O_CREAT | O_TRUNC)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } // Write calibration factor to file myFile.print(cal_factor); // Close the file: myFile.close(); - println_Msg(F("Done")); + print_STR(done_STR, 1); display_Update(); delay(1000); resetArduino(); @@ -1726,12 +1778,12 @@ void setup() { // Init SD card if (!sd.begin(SS)) { display_Clear(); - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } #ifdef global_log if (!myLog.open("OSCR_LOG.txt", O_RDWR | O_CREAT | O_APPEND)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } println_Msg(F("")); #if defined(HW1) @@ -1849,6 +1901,32 @@ void print_Error(const __FlashStringHelper* errorMessage, boolean forceReset) { } } +void print_Error(byte errorMessage, boolean forceReset) { + errorLvl = 1; + setColor_RGB(255, 0, 0); + print_STR(errorMessage, 1); + display_Update(); + + if (forceReset) { + println_Msg(F("")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); + display_Update(); + wait(); + if (ignoreError == 0) { + resetArduino(); + } else { + ignoreError = 0; + display_Clear(); + println_Msg(F("")); + println_Msg(F("Error Overwrite")); + println_Msg(F("")); + display_Update(); + delay(2000); + } + } +} + void wait() { // Switch status LED off statusLED(false); @@ -1916,7 +1994,7 @@ void save_log() { strcpy(fileName, romName); strcat(fileName, ".txt"); if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } while (myLog.available()) { @@ -2310,7 +2388,7 @@ byte questionBox_Serial(const __FlashStringHelper* question, char answers[7][20] EEPROM_readAnything(0, foldern); sprintf(fileName, "IMPORT/%d.bin", foldern); if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("Can't create file on SD"), true); + print_Error(create_file_STR, true); } // Read file from serial @@ -2577,7 +2655,7 @@ void wait_serial() { myFile.close(); } else { - print_Error(F("Can't open file"), true); + print_Error(open_file_STR, true); } }*/ } @@ -2915,7 +2993,7 @@ browserstart: // Open filepath directory if (!myDir.open(filePath)) { display_Clear(); - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } // Count files in directory @@ -2973,7 +3051,8 @@ page: println_Msg(F("Too many files")); display_Update(); println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); } @@ -2981,7 +3060,7 @@ page: // Open filepath directory if (!myDir.open(filePath)) { display_Clear(); - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } int countFile = 0; @@ -3231,7 +3310,8 @@ void loop() { print_Msg(F("Mode = ")); print_Msg(mode); println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); resetArduino(); @@ -3240,4 +3320,4 @@ void loop() { //****************************************** // End of File -//****************************************** \ No newline at end of file +//****************************************** diff --git a/Cart_Reader/FLASH.ino b/Cart_Reader/FLASH.ino index 7e815f6..79697ab 100644 --- a/Cart_Reader/FLASH.ino +++ b/Cart_Reader/FLASH.ino @@ -27,16 +27,16 @@ static const char flash8MenuItem3[] PROGMEM = "Read"; static const char flash8MenuItem4[] PROGMEM = "Write"; static const char flash8MenuItem5[] PROGMEM = "ID"; static const char flash8MenuItem6[] PROGMEM = "Print"; -static const char flash8MenuItem7[] PROGMEM = "Reset"; -static const char* const menuOptionsFLASH8[] PROGMEM = { flash8MenuItem1, flash8MenuItem2, flash8MenuItem3, flash8MenuItem4, flash8MenuItem5, flash8MenuItem6, flash8MenuItem7 }; +//static const char flash8MenuItem7[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const menuOptionsFLASH8[] PROGMEM = { flash8MenuItem1, flash8MenuItem2, flash8MenuItem3, flash8MenuItem4, flash8MenuItem5, flash8MenuItem6, string_reset2 }; #ifdef enable_FLASH16 // Flash start menu static const char flashMenuItem1[] PROGMEM = "8bit Flash adapter"; static const char flashMenuItem2[] PROGMEM = "Eprom adapter"; static const char flashMenuItem3[] PROGMEM = "MX26L6420 adapter"; -static const char flashMenuItem4[] PROGMEM = "Reset"; -static const char* const menuOptionsFlash[] PROGMEM = { flashMenuItem1, flashMenuItem2, flashMenuItem3, flashMenuItem4 }; +// static const char flashMenuItem4[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const menuOptionsFlash[] PROGMEM = { flashMenuItem1, flashMenuItem2, flashMenuItem3, string_reset2 }; // 16bit Flash menu items static const char flash16MenuItem1[] PROGMEM = "Blankcheck"; @@ -45,8 +45,8 @@ static const char flash16MenuItem3[] PROGMEM = "Read"; static const char flash16MenuItem4[] PROGMEM = "Write"; static const char flash16MenuItem5[] PROGMEM = "ID"; static const char flash16MenuItem6[] PROGMEM = "Print"; -static const char flash16MenuItem7[] PROGMEM = "Reset"; -static const char* const menuOptionsFLASH16[] PROGMEM = { flash16MenuItem1, flash16MenuItem2, flash16MenuItem3, flash16MenuItem4, flash16MenuItem5, flash16MenuItem6, flash16MenuItem7 }; +//static const char flash16MenuItem7[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const menuOptionsFLASH16[] PROGMEM = { flash16MenuItem1, flash16MenuItem2, flash16MenuItem3, flash16MenuItem4, flash16MenuItem5, flash16MenuItem6, string_reset2 }; // Eprom menu items static const char epromMenuItem1[] PROGMEM = "Blankcheck"; @@ -54,8 +54,8 @@ static const char epromMenuItem2[] PROGMEM = "Read"; static const char epromMenuItem3[] PROGMEM = "Write"; static const char epromMenuItem4[] PROGMEM = "Verify"; static const char epromMenuItem5[] PROGMEM = "Print"; -static const char epromMenuItem6[] PROGMEM = "Reset"; -static const char* const menuOptionsEprom[] PROGMEM = { epromMenuItem1, epromMenuItem2, epromMenuItem3, epromMenuItem4, epromMenuItem5, epromMenuItem6 }; +// static const char epromMenuItem6[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const menuOptionsEprom[] PROGMEM = { epromMenuItem1, epromMenuItem2, epromMenuItem3, epromMenuItem4, epromMenuItem5, string_reset2 }; void flashMenu() { // create menu with title and 3 options to choose from @@ -222,7 +222,8 @@ void flashromMenu8() { println_Msg(F("s")); display_Update(); } - print_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 0); display_Update(); wait(); } @@ -555,7 +556,8 @@ idtheflash: println_Msg(""); println_Msg(F("UNKNOWN FLASHROM")); println_Msg(""); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); @@ -570,7 +572,8 @@ idtheflash: print_Error(F("Press Button to reset"), true); } println_Msg(""); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); resetFlash8(); @@ -625,7 +628,8 @@ void id_Flash16() { println_Msg(""); } println_Msg(""); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); } #endif @@ -1038,7 +1042,7 @@ void eraseFlash29F032() { void writeFlash29F032() { // Create filepath sprintf(filePath, "%s/%s", filePath, fileName); - print_Msg(F("Flashing file ")); + print_STR(flashing_file_STR, 0); print_Msg(filePath); println_Msg(F("...")); display_Update(); @@ -1048,7 +1052,7 @@ void writeFlash29F032() { // Get rom size from file fileSize = myFile.fileSize(); if (fileSize > flashSize) - print_Error(F("File size exceeds flash size."), true); + print_Error(file_too_big_STR, true); // Set data pins to output dataOut(); @@ -1113,7 +1117,7 @@ void writeFlash29F032() { // Close the file: myFile.close(); } else { - println_Msg(F("Can't open file")); + print_STR(open_file_STR, 1); display_Update(); } } @@ -1179,7 +1183,7 @@ void resetFlash29F1610() { void writeFlash29F1610() { // Create filepath sprintf(filePath, "%s/%s", filePath, fileName); - println_Msg(F("Flashing file ")); + print_STR(flashing_file_STR, 1); println_Msg(filePath); display_Update(); @@ -1188,7 +1192,7 @@ void writeFlash29F1610() { // Get rom size from file fileSize = myFile.fileSize(); if (fileSize > flashSize) - print_Error(F("File size exceeds flash size."), true); + print_Error(file_too_big_STR, true); // Set data pins to output dataOut(); @@ -1225,7 +1229,7 @@ void writeFlash29F1610() { // Close the file: myFile.close(); } else { - println_Msg(F("Can't open file on SD")); + print_STR(open_file_STR, 1); display_Update(); } } @@ -1233,7 +1237,7 @@ void writeFlash29F1610() { void writeFlash29F1601() { // Create filepath sprintf(filePath, "%s/%s", filePath, fileName); - println_Msg(F("Flashing file ")); + print_STR(flashing_file_STR, 1); println_Msg(filePath); display_Update(); @@ -1242,7 +1246,7 @@ void writeFlash29F1601() { // Get rom size from file fileSize = myFile.fileSize(); if (fileSize > flashSize) - print_Error(F("File size exceeds flash size."), true); + print_Error(file_too_big_STR, true); // Set data pins to output dataOut(); @@ -1284,7 +1288,7 @@ void writeFlash29F1601() { // Close the file: myFile.close(); } else { - println_Msg(F("Can't open file on SD")); + print_STR(open_file_STR, 1); display_Update(); } } @@ -1376,7 +1380,7 @@ void busyCheck29LV640(unsigned long myAddress, byte myData) { void writeFlash29LV640() { // Create filepath sprintf(filePath, "%s/%s", filePath, fileName); - println_Msg(F("Flashing file ")); + print_STR(flashing_file_STR, 1); println_Msg(filePath); display_Update(); @@ -1385,7 +1389,7 @@ void writeFlash29LV640() { // Get rom size from file fileSize = myFile.fileSize(); if (fileSize > flashSize) - print_Error(F("File size exceeds flash size."), true); + print_Error(file_too_big_STR, true); // Set data pins to output dataOut(); @@ -1412,7 +1416,7 @@ void writeFlash29LV640() { // Close the file: myFile.close(); } else { - println_Msg(F("Can't open file on SD")); + print_STR(open_file_STR, 1); display_Update(); } } @@ -1423,7 +1427,7 @@ void writeFlash29LV640() { void writeFlash29GL(unsigned long sectorSize, byte bufferSize) { // Create filepath sprintf(filePath, "%s/%s", filePath, fileName); - println_Msg(F("Flashing file ")); + print_STR(flashing_file_STR, 1); println_Msg(filePath); display_Update(); @@ -1432,7 +1436,7 @@ void writeFlash29GL(unsigned long sectorSize, byte bufferSize) { // Get rom size from file fileSize = myFile.fileSize(); if (fileSize > flashSize) - print_Error(F("File size exceeds flash size."), true); + print_Error(file_too_big_STR, true); // Set data pins to output dataOut(); @@ -1479,7 +1483,7 @@ void writeFlash29GL(unsigned long sectorSize, byte bufferSize) { // Close the file: myFile.close(); } else { - println_Msg(F("Can't open file on SD")); + print_STR(open_file_STR, 1); display_Update(); } } @@ -1490,7 +1494,7 @@ void writeFlash29GL(unsigned long sectorSize, byte bufferSize) { void writeFlash29F800() { // Create filepath sprintf(filePath, "%s/%s", filePath, fileName); - println_Msg(F("Flashing file ")); + print_STR(flashing_file_STR, 1); println_Msg(filePath); display_Update(); @@ -1499,7 +1503,7 @@ void writeFlash29F800() { // Get rom size from file fileSize = myFile.fileSize(); if (fileSize > flashSize) - print_Error(F("File size exceeds flash size."), true); + print_Error(file_too_big_STR, true); // Set data pins to output dataOut(); @@ -1528,7 +1532,7 @@ void writeFlash29F800() { // Close the file: myFile.close(); } else { - println_Msg(F("Can't open file on SD")); + print_STR(open_file_STR, 1); display_Update(); } } @@ -1580,7 +1584,7 @@ void eraseFlash28FXXX() { void writeFlash28FXXX() { sprintf(filePath, "%s/%s", filePath, fileName); - print_Msg(F("Flashing file ")); + print_STR(flashing_file_STR, 0); println_Msg(filePath); display_Update(); @@ -1594,7 +1598,7 @@ void writeFlash28FXXX() { myFile.close(); } else { - println_Msg(F("Can't open file on SD")); + print_STR(open_file_STR, 1); display_Update(); } } @@ -1602,7 +1606,7 @@ void writeFlash28FXXX() { void writeFlashE28FXXXJ3A() { fileSize = myFile.fileSize(); if (fileSize > flashSize) { - print_Error(F("File size exceeds flash size."), false); + print_Error(file_too_big_STR, false); return; } @@ -1653,7 +1657,7 @@ void writeFlashE28FXXXJ3A() { void writeFlashLH28F0XX() { fileSize = myFile.fileSize(); if (fileSize > flashSize) { - print_Error(F("File size exceeds flash size."), false); + print_Error(file_too_big_STR, false); return; } @@ -1713,7 +1717,7 @@ void blankcheck_Flash() { } void verifyFlash() { - println_Msg(F("Verifying...")); + print_STR(verifying_STR, 1); display_Update(); // Open file on sd card @@ -1721,7 +1725,7 @@ void verifyFlash() { // Get rom size from file fileSize = myFile.fileSize(); if (fileSize > flashSize) - print_Error(F("File size exceeds flash size."), true); + print_Error(file_too_big_STR, true); blank = 0; for (unsigned long currByte = 0; currByte < fileSize; currByte += 512) { @@ -1737,15 +1741,15 @@ void verifyFlash() { println_Msg(F("Flashrom verified OK")); display_Update(); } else { - print_Msg(F("Error: ")); + print_STR(error_STR, 0); print_Msg(blank); - println_Msg(F(" bytes ")); - print_Error(F("did not verify."), false); + print_STR(_bytes_STR, 1); + print_Error(did_not_verify_STR, false); } // Close the file: myFile.close(); } else { - println_Msg(F("Can't open file on SD")); + print_STR(open_file_STR, 1); display_Update(); } } @@ -1772,7 +1776,7 @@ void readFlash() { // Open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("Can't create file on SD"), true); + print_Error(create_file_STR, true); } for (unsigned long currByte = 0; currByte < flashSize; currByte += 512) { for (int c = 0; c < 512; c++) { @@ -1834,7 +1838,7 @@ void resetFlash16() { void writeFlash16() { // Create filepath sprintf(filePath, "%s/%s", filePath, fileName); - println_Msg(F("Flashing file ")); + print_STR(flashing_file_STR, 1); println_Msg(filePath); display_Update(); @@ -1843,7 +1847,7 @@ void writeFlash16() { // Get rom size from file fileSize = myFile.fileSize(); if (fileSize > flashSize) - print_Error(F("File size exceeds flash size."), true); + print_Error(file_too_big_STR, true); // Set data pins to output dataOut16(); @@ -1892,7 +1896,7 @@ void writeFlash16() { void writeFlash16_29F1601() { // Create filepath sprintf(filePath, "%s/%s", filePath, fileName); - println_Msg(F("Flashing file ")); + print_STR(flashing_file_STR, 1); println_Msg(filePath); display_Update(); @@ -1901,7 +1905,7 @@ void writeFlash16_29F1601() { // Get rom size from file fileSize = myFile.fileSize(); if (fileSize > flashSize) - print_Error(F("File size exceeds flash size."), true); + print_Error(file_too_big_STR, true); // Set data pins to output dataOut16(); @@ -2024,7 +2028,7 @@ void blankcheck16() { } void verifyFlash16() { - println_Msg(F("Verifying...")); + print_STR(verifying_STR, 1); display_Update(); // Open file on sd card @@ -2032,7 +2036,7 @@ void verifyFlash16() { // Get rom size from file fileSize = myFile.fileSize(); if (fileSize > flashSize) { - print_Error(F("File size exceeds flash size."), true); + print_Error(file_too_big_STR, true); } blank = 0; @@ -2190,7 +2194,7 @@ void busyCheck16_29LV640(unsigned long myAddress, word myData) { void writeFlash16_29LV640() { // Create filepath sprintf(filePath, "%s/%s", filePath, fileName); - println_Msg(F("Flashing file ")); + print_STR(flashing_file_STR, 1); println_Msg(filePath); display_Update(); @@ -2199,7 +2203,7 @@ void writeFlash16_29LV640() { // Get rom size from file fileSize = myFile.fileSize(); if (fileSize > flashSize) - print_Error(F("File size exceeds flash size."), true); + print_Error(file_too_big_STR, true); // Set data pins to output dataOut16(); @@ -2417,7 +2421,7 @@ void read_Eprom() { void write_Eprom() { // Create filepath sprintf(filePath, "%s/%s", filePath, fileName); - println_Msg(F("Flashing file ")); + print_STR(flashing_file_STR, 1); println_Msg(filePath); display_Update(); @@ -2426,7 +2430,7 @@ void write_Eprom() { // Get rom size from file fileSize = myFile.fileSize(); if (fileSize > flashSize) - print_Error(F("File size exceeds flash size."), true); + print_Error(file_too_big_STR, true); // Switch VPP/OE(PH5) to HIGH PORTH |= (1 << 5); @@ -2477,7 +2481,7 @@ void write_Eprom() { } void verify_Eprom() { - println_Msg(F("Verifying...")); + print_STR(verifying_STR, 1); display_Update(); // Open file on sd card @@ -2485,7 +2489,7 @@ void verify_Eprom() { // Get rom size from file fileSize = myFile.fileSize(); if (fileSize > flashSize) { - print_Error(F("File size exceeds flash size."), true); + print_Error(file_too_big_STR, true); } blank = 0; diff --git a/Cart_Reader/GB.ino b/Cart_Reader/GB.ino index c4445bc..c4cc36d 100644 --- a/Cart_Reader/GB.ino +++ b/Cart_Reader/GB.ino @@ -19,15 +19,15 @@ static const char gbxMenuItem1[] PROGMEM = "Game Boy (Color)"; static const char gbxMenuItem2[] PROGMEM = "GB Advance (3V)"; static const char gbxMenuItem3[] PROGMEM = "Flash GBC Cart"; static const char gbxMenuItem4[] PROGMEM = "NPower GB Memory"; -static const char gbxMenuItem5[] PROGMEM = "Reset"; -static const char* const menuOptionsGBx[] PROGMEM = { gbxMenuItem1, gbxMenuItem2, gbxMenuItem3, gbxMenuItem4, gbxMenuItem5 }; +//static const char gbxMenuItem5[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const menuOptionsGBx[] PROGMEM = { gbxMenuItem1, gbxMenuItem2, gbxMenuItem3, gbxMenuItem4, string_reset2 }; // GB menu items static const char GBMenuItem1[] PROGMEM = "Read ROM"; static const char GBMenuItem2[] PROGMEM = "Read Save"; static const char GBMenuItem3[] PROGMEM = "Write Save"; -static const char GBMenuItem4[] PROGMEM = "Reset"; -static const char* const menuOptionsGB[] PROGMEM = { GBMenuItem1, GBMenuItem2, GBMenuItem3, GBMenuItem4 }; +//static const char GBMenuItem4[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const menuOptionsGB[] PROGMEM = { GBMenuItem1, GBMenuItem2, GBMenuItem3, string_reset2 }; // GB Flash items static const char GBFlashItem1[] PROGMEM = "29F Cart (MBC3)"; @@ -36,8 +36,8 @@ static const char GBFlashItem3[] PROGMEM = "29F Cart (CAM)"; static const char GBFlashItem4[] PROGMEM = "CFI Cart"; static const char GBFlashItem5[] PROGMEM = "CFI Cart and Save"; static const char GBFlashItem6[] PROGMEM = "GB Smart"; -static const char GBFlashItem7[] PROGMEM = "Reset"; -static const char* const menuOptionsGBFlash[] PROGMEM = { GBFlashItem1, GBFlashItem2, GBFlashItem3, GBFlashItem4, GBFlashItem5, GBFlashItem6, GBFlashItem7 }; +//static const char GBFlashItem7[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const menuOptionsGBFlash[] PROGMEM = { GBFlashItem1, GBFlashItem2, GBFlashItem3, GBFlashItem4, GBFlashItem5, GBFlashItem6, string_reset2 }; // Start menu for both GB and GBA void gbxMenu() { @@ -84,7 +84,8 @@ void gbxMenu() { //MBC3 writeFlash29F_GB(3, 1); // Reset - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); resetArduino(); @@ -102,7 +103,8 @@ void gbxMenu() { //MBC5 writeFlash29F_GB(5, 1); // Reset - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); resetArduino(); @@ -120,7 +122,8 @@ void gbxMenu() { sd.chdir("/"); //MBC3 writeFlash29F_GB(3, 1); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); @@ -131,7 +134,8 @@ void gbxMenu() { println_Msg(F("if you want to flash")); println_Msg(F("a second game")); println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); @@ -143,7 +147,8 @@ void gbxMenu() { // Reset println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); resetArduino(); @@ -167,7 +172,8 @@ void gbxMenu() { if (!writeCFI_GB()) { display_Clear(); println_Msg(F("Flashing failed, time out!")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); } @@ -194,7 +200,8 @@ void gbxMenu() { if (!writeCFI_GB()) { display_Clear(); println_Msg(F("Flashing failed, time out!")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); resetArduino(); @@ -230,10 +237,10 @@ void gbxMenu() { println_Msg(F("Verified OK")); display_Update(); } else { - print_Msg(F("Error: ")); + print_STR(error_STR, 0); print_Msg(wrErrors); - println_Msg(F(" bytes ")); - print_Error(F("did not verify."), false); + print_STR(_bytes_STR, 1); + print_Error(did_not_verify_STR, false); } break; } @@ -333,10 +340,10 @@ void gbMenu() { println_Msg(F("Verified OK")); display_Update(); } else { - print_Msg(F("Error: ")); + print_STR(error_STR, 0); print_Msg(wrErrors); - println_Msg(F(" bytes ")); - print_Error(F("did not verify."), false); + print_STR(_bytes_STR, 1); + print_Error(did_not_verify_STR, false); } } } else { @@ -349,7 +356,8 @@ void gbMenu() { resetArduino(); break; } - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); } @@ -534,7 +542,8 @@ void showCartInfo_GB() { // Wait for user input println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); } else { @@ -938,7 +947,7 @@ void readROM_GB() { sd.chdir(folder); display_Clear(); - print_Msg(F("Saving to ")); + print_STR(saving_to_STR, 0); print_Msg(folder); println_Msg(F("/...")); display_Update(); @@ -949,7 +958,7 @@ void readROM_GB() { //open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("Can't create file on SD"), true); + print_Error(create_file_STR, true); } int endAddress = 0x7FFF; @@ -1158,7 +1167,7 @@ void readSRAM_GB() { //open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } // MBC2 Fix @@ -1289,7 +1298,7 @@ unsigned long verifySRAM_GB() { myFile.close(); return writeErrors; } else { - print_Error(F("Can't open file"), true); + print_Error(open_file_STR, true); } } @@ -1306,7 +1315,7 @@ void readSRAMFLASH_MBC6_GB() { sd.chdir(folder); display_Clear(); - print_Msg(F("Saving to ")); + print_STR(saving_to_STR, 0); print_Msg(folder); println_Msg(F("/...")); display_Update(); @@ -1317,7 +1326,7 @@ void readSRAMFLASH_MBC6_GB() { //open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } //Initialize progress bar @@ -1788,7 +1797,7 @@ void writeFlash29F_GB(byte MBC, boolean flashErase) { } } - print_Msg(F("Verifying...")); + print_STR(verifying_STR, 0); display_Update(); // Go back to file beginning @@ -1837,11 +1846,11 @@ void writeFlash29F_GB(byte MBC, boolean flashErase) { } else { println_Msg(F("Error")); print_Msg(writeErrors); - println_Msg(F(" bytes ")); - print_Error(F("did not verify."), true); + print_STR(_bytes_STR, 1); + print_Error(did_not_verify_STR, true); } } else { - println_Msg(F("Can't open file")); + print_STR(open_file_STR, 1); display_Update(); } } @@ -2018,7 +2027,8 @@ bool writeCFI_GB() { print_Msg(F("but needs ")); print_Msg(romBanks); println_Msg(F(".")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); resetArduino(); @@ -2194,13 +2204,13 @@ bool writeCFI_GB() { println_Msg(F("OK")); display_Update(); } else { - print_Msg(F("Error: ")); + print_STR(error_STR, 0); print_Msg(writeErrors); - println_Msg(F(" bytes ")); - print_Error(F("did not verify."), false); + print_STR(_bytes_STR, 1); + print_Error(did_not_verify_STR, false); } } else { - println_Msg(F("Can't open file")); + print_STR(open_file_STR, 1); display_Update(); } return true; diff --git a/Cart_Reader/GBA.ino b/Cart_Reader/GBA.ino index e8352ad..78d216f 100644 --- a/Cart_Reader/GBA.ino +++ b/Cart_Reader/GBA.ino @@ -18,8 +18,8 @@ static const char GBAMenuItem2[] PROGMEM = "Read Save"; static const char GBAMenuItem3[] PROGMEM = "Write Save"; static const char GBAMenuItem4[] PROGMEM = "Force Savetype"; static const char GBAMenuItem5[] PROGMEM = "Flash Repro"; -static const char GBAMenuItem6[] PROGMEM = "Reset"; -static const char* const menuOptionsGBA[] PROGMEM = { GBAMenuItem1, GBAMenuItem2, GBAMenuItem3, GBAMenuItem4, GBAMenuItem5, GBAMenuItem6 }; +//static const char GBAMenuItem6[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const menuOptionsGBA[] PROGMEM = { GBAMenuItem1, GBAMenuItem2, GBAMenuItem3, GBAMenuItem4, GBAMenuItem5, string_reset2 }; // Rom menu static const char GBARomItem1[] PROGMEM = "1 MB"; @@ -129,7 +129,8 @@ void gbaMenu() { #ifdef global_log save_log(); #endif - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); break; @@ -231,7 +232,8 @@ void gbaMenu() { break; } println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); break; @@ -289,10 +291,10 @@ void gbaMenu() { println_Msg(F("Verified OK")); display_Update(); } else { - print_Msg(F("Error: ")); + print_STR(error_STR, 0); print_Msg(writeErrors); - println_Msg(F(" bytes ")); - print_Error(F("did not verify."), false); + print_STR(_bytes_STR, 1); + print_Error(did_not_verify_STR, false); } setROM_GBA(); break; @@ -307,10 +309,10 @@ void gbaMenu() { println_Msg(F("Verified OK")); display_Update(); } else { - print_Msg(F("Error: ")); + print_STR(error_STR, 0); print_Msg(writeErrors); - println_Msg(F(" bytes ")); - print_Error(F("did not verify."), false); + print_STR(_bytes_STR, 1); + print_Error(did_not_verify_STR, false); } setROM_GBA(); break; @@ -326,10 +328,10 @@ void gbaMenu() { println_Msg(F("Verified OK")); display_Update(); } else { - print_Msg(F("Error: ")); + print_STR(error_STR, 0); print_Msg(writeErrors); - println_Msg(F(" bytes ")); - print_Error(F("did not verify."), false); + print_STR(_bytes_STR, 1); + print_Error(did_not_verify_STR, false); } setROM_GBA(); break; @@ -358,7 +360,8 @@ void gbaMenu() { //print_Error(F(""), true); } println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); display_Clear(); @@ -399,7 +402,8 @@ void gbaMenu() { //print_Error(F(""), true); } println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); display_Clear(); @@ -437,16 +441,17 @@ void gbaMenu() { println_Msg(F("Verified OK")); display_Update(); } else { - print_Msg(F("Error: ")); + print_STR(error_STR, 0); print_Msg(writeErrors); - println_Msg(F(" bytes ")); - print_Error(F("did not verify."), false); + print_STR(_bytes_STR, 1); + print_Error(did_not_verify_STR, false); } setROM_GBA(); break; } println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); break; @@ -498,7 +503,8 @@ void gbaMenu() { display_Clear(); flashRepro_GBA(); println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); resetArduino(); @@ -565,7 +571,8 @@ void setup_GBA() { // Wait for user input println_Msg(""); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); } @@ -942,12 +949,12 @@ void getCartInfo_GBA() { println_Msg(saveTypeStr); #if defined(enable_OLED) - println_Msg(F("Press left to Change")); - println_Msg(F("and right to Select")); + print_STR(press_to_change_STR, 1); + print_STR(right_to_select_STR, 1); #elif defined(enable_LCD) println_Msg(F("")); - println_Msg(F("Rotate to Change")); - println_Msg(F("Press to Select")); + print_STR(rotate_to_change_STR, 1); + print_STR(press_to_select_STR, 1); #elif defined(SERIAL_MONITOR) println_Msg(F("")); println_Msg(F("U/D to Change")); @@ -1056,7 +1063,8 @@ void getCartInfo_GBA() { println_Msg(calcChecksumStr); print_Error(F("Checksum Error"), false); println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); } @@ -1127,7 +1135,7 @@ void readROM_GBA() { //clear the screen display_Clear(); - print_Msg(F("Saving to ")); + print_STR(saving_to_STR, 0); print_Msg(folder); println_Msg(F("/...")); display_Update(); @@ -1138,7 +1146,7 @@ void readROM_GBA() { //open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("Can't create file on SD"), true); + print_Error(create_file_STR, true); } //Initialize progress bar @@ -1234,7 +1242,7 @@ void readSRAM_GBA(boolean browseFile, unsigned long sramSize, uint32_t pos) { sd.chdir(folder); // Save location - print_Msg(F("Saving to ")); + print_STR(saving_to_STR, 0); print_Msg(folder); println_Msg(F("/...")); display_Update(); @@ -1245,7 +1253,7 @@ void readSRAM_GBA(boolean browseFile, unsigned long sramSize, uint32_t pos) { //open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } // Seek to a new position in the file @@ -1265,7 +1273,7 @@ void readSRAM_GBA(boolean browseFile, unsigned long sramSize, uint32_t pos) { myFile.close(); // Signal end of process - println_Msg(F("Done")); + print_STR(done_STR, 1); display_Update(); } @@ -1363,7 +1371,7 @@ void readFRAM_GBA(unsigned long framSize) { sd.chdir(folder); // Save location - print_Msg(F("Saving to ")); + print_STR(saving_to_STR, 0); print_Msg(folder); println_Msg(F("/...")); display_Update(); @@ -1373,7 +1381,7 @@ void readFRAM_GBA(unsigned long framSize) { //open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } for (unsigned long currAddress = 0; currAddress < framSize; currAddress += 512) { for (int c = 0; c < 512; c++) { @@ -1407,7 +1415,7 @@ void readFRAM_GBA(unsigned long framSize) { myFile.close(); // Signal end of process - println_Msg(F("Done")); + print_STR(done_STR, 1); display_Update(); } @@ -1790,7 +1798,7 @@ void readFLASH_GBA(boolean browseFile, unsigned long flashSize, uint32_t pos) { sd.chdir(folder); // Save location - print_Msg(F("Saving to ")); + print_STR(saving_to_STR, 0); print_Msg(folder); println_Msg(F("/...")); display_Update(); @@ -1802,7 +1810,7 @@ void readFLASH_GBA(boolean browseFile, unsigned long flashSize, uint32_t pos) { //open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } // Seek to a new position in the file @@ -1829,7 +1837,7 @@ void readFLASH_GBA(boolean browseFile, unsigned long flashSize, uint32_t pos) { PORTH |= (1 << 0); // Signal end of process - println_Msg(F("Done")); + print_STR(done_STR, 1); display_Update(); } @@ -1915,7 +1923,7 @@ void writeFLASH_GBA(boolean browseFile, unsigned long flashSize, uint32_t pos, b // Close the file: myFile.close(); - println_Msg(F("done")); + print_STR(done_STR, 1); display_Update(); } else { @@ -1947,7 +1955,7 @@ void verifyFLASH_GBA(unsigned long flashSize, uint32_t pos) { //open file on sd card if (!myFile.open(filePath, O_READ)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } // Seek to a new position in the file @@ -2010,7 +2018,7 @@ void writeEeprom_GBA(word eepSize) { // Close the file: myFile.close(); - println_Msg(F("done")); + print_STR(done_STR, 1); display_Update(); } else { println_Msg(F("Error")); @@ -2032,7 +2040,7 @@ void readEeprom_GBA(word eepSize) { sd.chdir(folder); // Save location - print_Msg(F("Saving to ")); + print_STR(saving_to_STR, 0); print_Msg(folder); println_Msg(F("/...")); display_Update(); @@ -2043,7 +2051,7 @@ void readEeprom_GBA(word eepSize) { //open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } // Each block contains 8 Bytes, so for a 8KB eeprom 1024 blocks need to be read @@ -2285,7 +2293,7 @@ unsigned long verifyEEP_GBA(word eepSize) { //open file on sd card if (!myFile.open(filePath, O_READ)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } // Fill sd Buffer @@ -2779,7 +2787,7 @@ boolean verifyFlashrom_GBA() { return 0; } } else { - print_Error(F("Can't open file"), true); + print_Error(open_file_STR, true); return 9999; } } @@ -2824,7 +2832,8 @@ void flashRepro_GBA() { println_Msg(F("Repro Cartridge.")); println_Msg(F("")); println_Msg(""); - println_Msg(F("Press Button")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); @@ -2903,7 +2912,7 @@ void flashRepro_GBA() { myFile.close(); // Verify - print_Msg(F("Verifying...")); + print_STR(verifying_STR, 0); display_Update(); if (strcmp(flashid, "8802") == 0) { // Don't know the correct size so just take some guesses @@ -2935,7 +2944,7 @@ void flashRepro_GBA() { } */ } else { - print_Error(F("Can't open file"), true); + print_Error(open_file_STR, true); } } else { println_Msg(F("Error")); diff --git a/Cart_Reader/GBM.ino b/Cart_Reader/GBM.ino index 7e388b6..1463059 100644 --- a/Cart_Reader/GBM.ino +++ b/Cart_Reader/GBM.ino @@ -42,7 +42,8 @@ void gbmMenu() { println_Msg(F("cartreader directly")); println_Msg(F("before reading")); println_Msg(""); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); // Clear screen @@ -71,7 +72,8 @@ void gbmMenu() { println_Msg(F("NP Cartridge.")); println_Msg(""); println_Msg(""); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); // Clear screen @@ -131,7 +133,8 @@ void gbmMenu() { println_Msg(F("NP Cartridge's")); println_Msg(F("mapping data")); println_Msg(""); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); @@ -171,7 +174,8 @@ void gbmMenu() { break; } println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); } @@ -333,7 +337,7 @@ void readROM_GBM(word numBanks) { // Open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("Can't create file on SD"), true); + print_Error(create_file_STR, true); } else { // Read rom word currAddress = 0; @@ -677,7 +681,7 @@ void writeFlash_GBM() { } // Close the file: myFile.close(); - println_Msg(F("Done")); + print_STR(done_STR, 1); } else { print_Error(F("Can't open file"), false); } @@ -716,7 +720,7 @@ void readMapping_GBM() { // Open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("Can't create file on SD"), true); + print_Error(create_file_STR, true); } else { for (byte currByte = 0; currByte < 128; currByte++) { sdBuffer[currByte] = readByte_GBM(currByte); @@ -891,7 +895,7 @@ void writeMapping_GBM() { // Close the file: myFile.close(); - println_Msg(F("Done")); + print_STR(done_STR, 1); } else { print_Error(F("Can't open file"), false); } diff --git a/Cart_Reader/GBS.ino b/Cart_Reader/GBS.ino index 0c4aedd..403304e 100644 --- a/Cart_Reader/GBS.ino +++ b/Cart_Reader/GBS.ino @@ -11,8 +11,8 @@ // GB Smart menu items static const char gbSmartMenuItem1[] PROGMEM = "Game Menu"; static const char gbSmartMenuItem2[] PROGMEM = "Flash Menu"; -static const char gbSmartMenuItem3[] PROGMEM = "Reset"; -static const char* const menuOptionsGBSmart[] PROGMEM = { gbSmartMenuItem1, gbSmartMenuItem2, gbSmartMenuItem3 }; +//static const char gbSmartMenuItem3[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const menuOptionsGBSmart[] PROGMEM = { gbSmartMenuItem1, gbSmartMenuItem2, string_reset2 }; static const char gbSmartFlashMenuItem1[] PROGMEM = "Read Flash"; static const char gbSmartFlashMenuItem2[] PROGMEM = "Write Flash"; @@ -23,8 +23,8 @@ static const char gbSmartGameMenuItem1[] PROGMEM = "Read Game"; static const char gbSmartGameMenuItem2[] PROGMEM = "Read SRAM"; static const char gbSmartGameMenuItem3[] PROGMEM = "Write SRAM"; static const char gbSmartGameMenuItem4[] PROGMEM = "Switch Game"; -static const char gbSmartGameMenuItem5[] PROGMEM = "Reset"; -static const char* const menuOptionsGBSmartGame[] PROGMEM = { gbSmartGameMenuItem1, gbSmartGameMenuItem2, gbSmartGameMenuItem3, gbSmartGameMenuItem4, gbSmartGameMenuItem5 }; +//static const char gbSmartGameMenuItem5[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const menuOptionsGBSmartGame[] PROGMEM = { gbSmartGameMenuItem1, gbSmartGameMenuItem2, gbSmartGameMenuItem3, gbSmartGameMenuItem4, string_reset2 }; typedef struct { @@ -216,10 +216,10 @@ void gbSmartGameOptions() { println_Msg(F("Verified OK")); display_Update(); } else { - print_Msg(F("Error: ")); + print_STR(error_STR, 0); print_Msg(wrErrors); println_Msg(F(" bytes")); - print_Error(F("did not verify."), false); + print_Error(did_not_verify_STR, false); } break; } @@ -238,7 +238,8 @@ void gbSmartGameOptions() { if (gameSubMenu != 3) { println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); } @@ -310,7 +311,8 @@ void gbSmartFlashMenu() { println_Msg(F("This will erase your")); println_Msg(F("GB Smart Cartridge.")); println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); @@ -331,7 +333,8 @@ void gbSmartFlashMenu() { } println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); } @@ -419,7 +422,7 @@ void gbSmartReadFlash() { display_Update(); if (!myFile.open(fileName, O_RDWR | O_CREAT)) - print_Error(F("Can't create file on SD"), true); + print_Error(create_file_STR, true); // reset flash to read array state for (int i = 0x00; i < gbSmartBanks; i += gbSmartBanksPerFlashChip) @@ -470,7 +473,7 @@ void gbSmartWriteFlash() { gbSmartEraseFlash(bank); gbSmartResetFlash(bank); - println_Msg(F("Done")); + print_STR(done_STR, 1); print_Msg(F("Blankcheck...")); display_Update(); @@ -487,7 +490,7 @@ void gbSmartWriteFlash() { gbSmartWriteFlashByte(0x0000, 0xff); } - print_Msg(F("Verifying...")); + print_STR(verifying_STR, 0); display_Update(); writeErrors = gbSmartVerifyFlash(); @@ -495,16 +498,16 @@ void gbSmartWriteFlash() { println_Msg(F("OK")); display_Update(); } else { - print_Msg(F("Error: ")); + print_STR(error_STR, 0); print_Msg(writeErrors); - println_Msg(F(" bytes ")); - print_Error(F("did not verify."), true); + print_STR(_bytes_STR, 1); + print_Error(did_not_verify_STR, true); } } void gbSmartWriteFlash(uint32_t start_bank) { if (!myFile.open(filePath, O_READ)) - print_Error(F("Can't open file on SD"), true); + print_Error(open_file_STR, true); // switch to flash base bank gbSmartRemapStartBank(start_bank, gbSmartFlashSizeGB, gbSmartSramSizeGB); diff --git a/Cart_Reader/INTV.ino b/Cart_Reader/INTV.ino index 1c9c335..2792239 100644 --- a/Cart_Reader/INTV.ino +++ b/Cart_Reader/INTV.ino @@ -95,8 +95,8 @@ byte newintvsize; static const char intvMenuItem1[] PROGMEM = "Select Cart"; static const char intvMenuItem2[] PROGMEM = "Read ROM"; static const char intvMenuItem3[] PROGMEM = "Set Mapper + Size"; -static const char intvMenuItem4[] PROGMEM = "Reset"; -static const char* const menuOptionsINTV[] PROGMEM = { intvMenuItem1, intvMenuItem2, intvMenuItem3, intvMenuItem4 }; +//static const char intvMenuItem4[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const menuOptionsINTV[] PROGMEM = { intvMenuItem1, intvMenuItem2, intvMenuItem3, string_reset2 }; void setup_INTV() { // Set Address Pins to Output (UNUSED) @@ -316,14 +316,14 @@ void readROM_INTV() { sd.chdir(folder); display_Clear(); - print_Msg(F("Saving to ")); + print_STR(saving_to_STR, 0); print_Msg(folder); println_Msg(F("/...")); display_Update(); // open file on sdcard if (!myFile.open(fileName, O_RDWR | O_CREAT)) - print_Error(F("Can't create file on SD"), true); + print_Error(create_file_STR, true); // write new folder number back to EEPROM foldern++; @@ -423,7 +423,8 @@ void readROM_INTV() { compareCRC("intv.txt", 0, 1, 0); println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); } @@ -528,11 +529,11 @@ void setMapper_INTV() { println_Msg(intvmapselect); println_Msg(F("")); #if defined(enable_OLED) - println_Msg(F("Press left to Change")); - println_Msg(F("and right to Select")); + print_STR(press_to_change_STR, 1); + print_STR(right_to_select_STR, 1); #elif defined(enable_LCD) - println_Msg(F("Rotate to Change")); - println_Msg(F("Press to Select")); + print_STR(rotate_to_change_STR, 1); + print_STR(press_to_select_STR, 1); #endif display_Update(); @@ -553,11 +554,11 @@ void setMapper_INTV() { println_Msg(intvmapselect); println_Msg(F("")); #if defined(enable_OLED) - println_Msg(F("Press left to Change")); - println_Msg(F("and right to Select")); + print_STR(press_to_change_STR, 1); + print_STR(right_to_select_STR, 1); #elif defined(enable_LCD) - println_Msg(F("Rotate to Change")); - println_Msg(F("Press to Select")); + print_STR(rotate_to_change_STR, 1); + print_STR(press_to_select_STR, 1); #endif display_Update(); } @@ -575,11 +576,11 @@ void setMapper_INTV() { println_Msg(intvmapselect); println_Msg(F("")); #if defined(enable_OLED) - println_Msg(F("Press left to Change")); - println_Msg(F("and right to Select")); + print_STR(press_to_change_STR, 1); + print_STR(right_to_select_STR, 1); #elif defined(enable_LCD) - println_Msg(F("Rotate to Change")); - println_Msg(F("Press to Select")); + print_STR(rotate_to_change_STR, 1); + print_STR(press_to_select_STR, 1); #endif display_Update(); } @@ -647,11 +648,11 @@ void setROMSize_INTV() { println_Msg(INTV[i]); println_Msg(F("")); #if defined(enable_OLED) - println_Msg(F("Press left to Change")); - println_Msg(F("and right to Select")); + print_STR(press_to_change_STR, 1); + print_STR(right_to_select_STR, 1); #elif defined(enable_LCD) - println_Msg(F("Rotate to Change")); - println_Msg(F("Press to Select")); + print_STR(rotate_to_change_STR, 1); + print_STR(press_to_select_STR, 1); #endif display_Update(); @@ -669,11 +670,11 @@ void setROMSize_INTV() { println_Msg(INTV[i]); println_Msg(F("")); #if defined(enable_OLED) - println_Msg(F("Press left to Change")); - println_Msg(F("and right to Select")); + print_STR(press_to_change_STR, 1); + print_STR(right_to_select_STR, 1); #elif defined(enable_LCD) - println_Msg(F("Rotate to Change")); - println_Msg(F("Press to Select")); + print_STR(rotate_to_change_STR, 1); + print_STR(press_to_select_STR, 1); #endif display_Update(); } @@ -688,11 +689,11 @@ void setROMSize_INTV() { println_Msg(INTV[i]); println_Msg(F("")); #if defined(enable_OLED) - println_Msg(F("Press left to Change")); - println_Msg(F("and right to Select")); + print_STR(press_to_change_STR, 1); + print_STR(right_to_select_STR, 1); #elif defined(enable_LCD) - println_Msg(F("Rotate to Change")); - println_Msg(F("Press to Select")); + print_STR(rotate_to_change_STR, 1); + print_STR(press_to_select_STR, 1); #endif display_Update(); } @@ -887,11 +888,11 @@ void setCart_INTV() { print_Msg(F("Mapper: ")); println_Msg(intvmapper); #if defined(enable_OLED) - println_Msg(F("Press left to Change")); - println_Msg(F("and right to Select")); + print_STR(press_to_change_STR, 1); + print_STR(right_to_select_STR, 1); #elif defined(enable_LCD) - println_Msg(F("Rotate to Change")); - println_Msg(F("Press to Select")); + print_STR(rotate_to_change_STR, 1); + print_STR(press_to_select_STR, 1); #elif defined(SERIAL_MONITOR) println_Msg(F("U/D to Change")); println_Msg(F("Space to Select")); diff --git a/Cart_Reader/MD.ino b/Cart_Reader/MD.ino index 82464f1..43bc439 100644 --- a/Cart_Reader/MD.ino +++ b/Cart_Reader/MD.ino @@ -192,8 +192,8 @@ void mdLoadConf() { static const char MDMenuItem1[] PROGMEM = "Game Cartridge"; static const char MDMenuItem2[] PROGMEM = "SegaCD RamCart"; static const char MDMenuItem3[] PROGMEM = "Flash Repro"; -static const char MDMenuItem4[] PROGMEM = "Reset"; -static const char* const menuOptionsMD[] PROGMEM = { MDMenuItem1, MDMenuItem2, MDMenuItem3, MDMenuItem4 }; +//static const char MDMenuItem4[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const menuOptionsMD[] PROGMEM = { MDMenuItem1, MDMenuItem2, MDMenuItem3, string_reset2 }; // Cart menu items static const char MDCartMenuItem1[] PROGMEM = "Read Rom"; @@ -202,14 +202,14 @@ static const char MDCartMenuItem3[] PROGMEM = "Write Sram"; static const char MDCartMenuItem4[] PROGMEM = "Read EEPROM"; static const char MDCartMenuItem5[] PROGMEM = "Write EEPROM"; static const char MDCartMenuItem6[] PROGMEM = "Cycle cart"; -static const char MDCartMenuItem7[] PROGMEM = "Reset"; -static const char* const menuOptionsMDCart[] PROGMEM = { MDCartMenuItem1, MDCartMenuItem2, MDCartMenuItem3, MDCartMenuItem4, MDCartMenuItem5, MDCartMenuItem6, MDCartMenuItem7 }; +//static const char MDCartMenuItem7[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const menuOptionsMDCart[] PROGMEM = { MDCartMenuItem1, MDCartMenuItem2, MDCartMenuItem3, MDCartMenuItem4, MDCartMenuItem5, MDCartMenuItem6, string_reset2 }; // Sega CD Ram Backup Cartridge menu items static const char SCDMenuItem1[] PROGMEM = "Read Backup RAM"; static const char SCDMenuItem2[] PROGMEM = "Write Backup RAM"; -static const char SCDMenuItem3[] PROGMEM = "Reset"; -static const char* const menuOptionsSCD[] PROGMEM = { SCDMenuItem1, SCDMenuItem2, SCDMenuItem3 }; +//static const char SCDMenuItem3[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const menuOptionsSCD[] PROGMEM = { SCDMenuItem1, SCDMenuItem2, string_reset2 }; // Sega start menu void mdMenu() { @@ -275,7 +275,8 @@ void mdMenu() { // Set CS(PH3) HIGH PORTH |= (1 << 3); println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); break; @@ -350,10 +351,10 @@ void mdCartMenu() { println_Msg(F("Sram verified OK")); display_Update(); } else { - print_Msg(F("Error: ")); + print_STR(error_STR, 0); print_Msg(writeErrors); - println_Msg(F(" bytes ")); - print_Error(F("did not verify."), false); + print_STR(_bytes_STR, 1); + print_Error(did_not_verify_STR, false); } } else { print_Error(F("Cart has no Sram"), false); @@ -400,7 +401,8 @@ void mdCartMenu() { resetArduino(); break; } - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); } @@ -441,7 +443,8 @@ void segaCDMenu() { break; } println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); } @@ -1082,7 +1085,8 @@ void getCartInfo_MD() { // Wait for user input #if (defined(enable_LCD) || defined(enable_OLED)) - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); #endif @@ -1155,7 +1159,7 @@ void readROM_MD() { sd.chdir(folder); display_Clear(); - print_Msg(F("Saving to ")); + print_STR(saving_to_STR, 0); print_Msg(folder); println_Msg(F("/...")); display_Update(); @@ -1166,7 +1170,7 @@ void readROM_MD() { // Open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } byte buffer[1024] = { 0 }; @@ -1489,10 +1493,10 @@ void writeSram_MD() { // Close the file: myFile.close(); - println_Msg(F("Done")); + print_STR(done_STR, 1); display_Update(); } else { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } dataIn_MD(); } @@ -1517,7 +1521,7 @@ void readSram_MD() { // Open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } for (unsigned long currBuffer = sramBase; currBuffer < sramBase + sramSize; currBuffer += 256) { @@ -1611,7 +1615,7 @@ unsigned long verifySram_MD() { // Close the file: myFile.close(); } else { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } // Return 0 if verified ok, or number of errors return writeErrors; @@ -1637,7 +1641,7 @@ void resetFlash_MD() { void write29F1610_MD() { // Create filepath sprintf(filePath, "%s/%s", filePath, fileName); - print_Msg(F("Flashing file ")); + print_STR(flashing_file_STR, 0); print_Msg(filePath); println_Msg(F("...")); display_Update(); @@ -1647,7 +1651,7 @@ void write29F1610_MD() { // Get rom size from file fileSize = myFile.fileSize(); if (fileSize > flashSize) { - print_Error(F("File size exceeds flash size."), true); + print_Error(file_too_big_STR, true); } // Set data pins to output dataOut_MD(); @@ -1686,7 +1690,7 @@ void write29F1610_MD() { // Close the file: myFile.close(); } else { - println_Msg(F("Can't open file")); + print_STR(open_file_STR, 1); display_Update(); } } @@ -1764,7 +1768,7 @@ void verifyFlash_MD() { // Get rom size from file fileSize = myFile.fileSize(); if (fileSize > flashSize) { - print_Error(F("File size exceeds flash size."), true); + print_Error(file_too_big_STR, true); } blank = 0; @@ -1789,15 +1793,15 @@ void verifyFlash_MD() { println_Msg(F("Flashrom verified OK")); display_Update(); } else { - print_Msg(F("Error: ")); + print_STR(error_STR, 0); print_Msg(blank); - println_Msg(F(" bytes ")); - print_Error(F("did not verify."), false); + print_STR(_bytes_STR, 1); + print_Error(did_not_verify_STR, false); } // Close the file: myFile.close(); } else { - println_Msg(F("Can't open file")); + print_STR(open_file_STR, 1); display_Update(); } } @@ -2382,7 +2386,7 @@ void readEEP_MD() { // Open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } if (eepSize > 0x100) { // 24C04+ for (word currByte = 0; currByte < eepSize; currByte += 256) { @@ -2448,10 +2452,10 @@ void writeEEP_MD() { myFile.close(); println_Msg(F("")); display_Clear(); - println_Msg(F("Done")); + print_STR(done_STR, 1); display_Update(); } else { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } dataIn_MD(); } @@ -2481,7 +2485,7 @@ void readBram_MD() { // Open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } for (unsigned long currByte = 0; currByte < bramSize; currByte += 512) { @@ -2527,10 +2531,10 @@ void writeBram_MD() { myFile.close(); println_Msg(F("")); display_Clear(); - println_Msg(F("Done")); + print_STR(done_STR, 1); display_Update(); } else { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } dataIn_MD(); } @@ -2568,7 +2572,7 @@ void readRealtec_MD() { sd.chdir(folder); display_Clear(); - print_Msg(F("Saving to ")); + print_STR(saving_to_STR, 0); print_Msg(folder); println_Msg(F("/...")); display_Update(); @@ -2579,7 +2583,7 @@ void readRealtec_MD() { // Open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } // Realtec Registers diff --git a/Cart_Reader/N64.ino b/Cart_Reader/N64.ino index 4d09619..8b6ee62 100644 --- a/Cart_Reader/N64.ino +++ b/Cart_Reader/N64.ino @@ -58,30 +58,30 @@ static const char n64MenuItem1[] PROGMEM = "Game Cartridge"; static const char n64MenuItem2[] PROGMEM = "Controller"; static const char n64MenuItem3[] PROGMEM = "Flash Repro"; static const char n64MenuItem4[] PROGMEM = "Flash Gameshark"; -static const char n64MenuItem5[] PROGMEM = "Reset"; -static const char* const menuOptionsN64[] PROGMEM = { n64MenuItem1, n64MenuItem2, n64MenuItem3, n64MenuItem4, n64MenuItem5 }; +//static const char n64MenuItem5[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const menuOptionsN64[] PROGMEM = { n64MenuItem1, n64MenuItem2, n64MenuItem3, n64MenuItem4, string_reset2 }; // N64 controller menu items static const char N64ContMenuItem1[] PROGMEM = "Test Controller"; static const char N64ContMenuItem2[] PROGMEM = "Read ControllerPak"; static const char N64ContMenuItem3[] PROGMEM = "Write ControllerPak"; -static const char N64ContMenuItem4[] PROGMEM = "Reset"; -static const char* const menuOptionsN64Controller[] PROGMEM = { N64ContMenuItem1, N64ContMenuItem2, N64ContMenuItem3, N64ContMenuItem4 }; +//static const char N64ContMenuItem4[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const menuOptionsN64Controller[] PROGMEM = { N64ContMenuItem1, N64ContMenuItem2, N64ContMenuItem3, string_reset2 }; // N64 cart menu items static const char N64CartMenuItem1[] PROGMEM = "Read ROM"; static const char N64CartMenuItem2[] PROGMEM = "Read Save"; static const char N64CartMenuItem3[] PROGMEM = "Write Save"; static const char N64CartMenuItem4[] PROGMEM = "Force Savetype"; -static const char N64CartMenuItem5[] PROGMEM = "Reset"; -static const char* const menuOptionsN64Cart[] PROGMEM = { N64CartMenuItem1, N64CartMenuItem2, N64CartMenuItem3, N64CartMenuItem4, N64CartMenuItem5 }; +//static const char N64CartMenuItem5[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const menuOptionsN64Cart[] PROGMEM = { N64CartMenuItem1, N64CartMenuItem2, N64CartMenuItem3, N64CartMenuItem4, string_reset2 }; // N64 CRC32 error menu items static const char N64CRCMenuItem1[] PROGMEM = "No"; static const char N64CRCMenuItem2[] PROGMEM = "Yes and keep old"; static const char N64CRCMenuItem3[] PROGMEM = "Yes and delete old"; -static const char N64CRCMenuItem4[] PROGMEM = "Reset"; -static const char* const menuOptionsN64CRC[] PROGMEM = { N64CRCMenuItem1, N64CRCMenuItem2, N64CRCMenuItem3, N64CRCMenuItem4 }; +//static const char N64CRCMenuItem4[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const menuOptionsN64CRC[] PROGMEM = { N64CRCMenuItem1, N64CRCMenuItem2, N64CRCMenuItem3, string_reset2 }; // Rom menu static const char N64RomItem1[] PROGMEM = "4 MB"; @@ -194,7 +194,8 @@ void n64ControllerMenu() { verifyCRC(); validateMPK(); println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); break; @@ -215,7 +216,8 @@ void n64ControllerMenu() { delay(500); verifyMPK(); println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); break; @@ -266,7 +268,8 @@ void n64CartMenu() { print_Error(F("Savetype Error"), false); } println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); break; @@ -285,10 +288,10 @@ void n64CartMenu() { println_Msg(F("SRAM verified OK")); display_Update(); } else { - print_Msg(F("Error: ")); + print_STR(error_STR, 0); print_Msg(writeErrors); - println_Msg(F(" bytes ")); - print_Error(F("did not verify."), false); + print_STR(_bytes_STR, 1); + print_Error(did_not_verify_STR, false); } } else if (saveType == 4) { // Launch file browser @@ -296,7 +299,7 @@ void n64CartMenu() { display_Clear(); getFramType(); writeFram(flashramType); - print_Msg(F("Verifying...")); + print_STR(verifying_STR, 0); display_Update(); writeErrors = verifyFram(flashramType); if (writeErrors == 0) { @@ -304,10 +307,10 @@ void n64CartMenu() { display_Update(); } else { println_Msg(""); - print_Msg(F("Error: ")); + print_STR(error_STR, 0); print_Msg(writeErrors); - println_Msg(F(" bytes ")); - print_Error(F("did not verify."), false); + print_STR(_bytes_STR, 1); + print_Error(did_not_verify_STR, false); } } else if ((saveType == 5) || (saveType == 6)) { // Launch file browser @@ -326,16 +329,17 @@ void n64CartMenu() { println_Msg(F("EEPROM verified OK")); display_Update(); } else { - print_Msg(F("Error: ")); + print_STR(error_STR, 0); print_Msg(writeErrors); - println_Msg(F(" bytes ")); - print_Error(F("did not verify."), false); + print_STR(_bytes_STR, 1); + print_Error(did_not_verify_STR, false); } } else { display_Clear(); print_Error(F("Save Type Error"), false); } - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); break; @@ -1611,12 +1615,12 @@ void readMPK() { strcat(filePath, ".crc"); FsFile crcFile; if (!crcFile.open(filePath, O_RDWR | O_CREAT)) { - print_Error(F("Can't open file on SD"), true); + print_Error(open_file_STR, true); } //open mpk file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("Can't open file on SD"), true); + print_Error(open_file_STR, true); } print_Msg(F("Saving N64/MPK/")); @@ -1669,18 +1673,18 @@ void readMPK() { void verifyCRC() { writeErrors = 0; - println_Msg(F("Verifying...")); + print_STR(verifying_STR, 1); display_Update(); //open CRC file on sd card FsFile crcFile; if (!crcFile.open(filePath, O_READ)) { - print_Error(F("Can't open file on SD"), true); + print_Error(open_file_STR, true); } //open MPK file on sd card if (!myFile.open(fileName, O_READ)) { - print_Error(F("Can't open file on SD"), true); + print_Error(open_file_STR, true); } //Initialize progress bar @@ -1715,10 +1719,10 @@ void verifyCRC() { sd.remove(filePath); display_Update(); } else { - print_Msg(F("Error: ")); + print_STR(error_STR, 0); print_Msg(writeErrors); println_Msg(F(" blocks ")); - print_Error(F("did not verify."), false); + print_Error(did_not_verify_STR, false); } } @@ -1743,7 +1747,7 @@ boolean checkHeader(byte startAddress) { void validateMPK() { //open file on sd card if (!myFile.open(fileName, O_READ)) { - print_Error(F("Can't open file"), true); + print_Error(open_file_STR, true); } // Read first 256 byte which contains the header including checksum and reverse checksum and three copies of it @@ -1856,7 +1860,7 @@ void writeMPK() { // Close the file: myFile.close(); } else { - print_Error(F("Can't open file on SD"), true); + print_Error(open_file_STR, true); } } @@ -1864,12 +1868,12 @@ void writeMPK() { void verifyMPK() { writeErrors = 0; - println_Msg(F("Verifying...")); + print_STR(verifying_STR, 1); display_Update(); //open file on sd card if (!myFile.open(filePath, O_READ)) { - print_Error(F("Can't open file on SD"), true); + print_Error(open_file_STR, true); } //Initialize progress bar @@ -1911,10 +1915,10 @@ void verifyMPK() { println_Msg(F("Written successfully")); display_Update(); } else { - print_Msg(F("Error: ")); + print_STR(error_STR, 0); print_Msg(writeErrors); - println_Msg(F(" bytes ")); - print_Error(F("did not verify."), false); + print_STR(_bytes_STR, 1); + print_Error(did_not_verify_STR, false); } } @@ -1963,7 +1967,8 @@ void printCartInfo_N64() { // Wait for user input println_Msg(F(" ")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); } else { @@ -1982,7 +1987,8 @@ void printCartInfo_N64() { strcpy(romName, "GPERROR"); print_Error(F("Cartridge unknown"), false); println_Msg(""); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); @@ -2344,11 +2350,11 @@ void writeEeprom_CLK() { // Close the file: myFile.close(); - println_Msg(F("Done")); + print_STR(done_STR, 1); display_Update(); delay(600); } else { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } } else { print_Error(F("Savetype Error"), true); @@ -2378,7 +2384,7 @@ void readEeprom_CLK() { // Open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("Can't create file on SD"), true); + print_Error(create_file_STR, true); } for (byte i = 0; i < (eepPages / 64); i++) { @@ -2481,7 +2487,7 @@ unsigned long verifyEeprom_CLK() { } else { // SD Error writeErrors = 999999; - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } // Return 0 if verified ok, or number of errors return writeErrors; @@ -2713,11 +2719,11 @@ void writeEeprom() { // Close the file: myFile.close(); - println_Msg(F("Done")); + print_STR(done_STR, 1); display_Update(); delay(600); } else { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } } else { print_Error(F("Savetype Error"), true); @@ -2743,7 +2749,7 @@ void readEeprom() { // Open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("Can't create file on SD"), true); + print_Error(create_file_STR, true); } for (byte i = 0; i < (eepPages / 64); i++) { @@ -2847,7 +2853,7 @@ unsigned long verifyEeprom() { } else { // SD Error writeErrors = 999999; - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } // Return 0 if verified ok, or number of errors return writeErrors; @@ -2888,10 +2894,10 @@ void writeSram(unsigned long sramSize) { } // Close the file: myFile.close(); - println_Msg(F("Done")); + print_STR(done_STR, 1); display_Update(); } else { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } } else { @@ -2931,7 +2937,7 @@ void readSram(unsigned long sramSize, byte flashramType) { // Open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } for (unsigned long currByte = sramBase; currByte < (sramBase + (sramSize / flashramType)); currByte += offset) { @@ -2994,7 +3000,7 @@ unsigned long verifySram(unsigned long sramSize, byte flashramType) { // Close the file: myFile.close(); } else { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } // Return 0 if verified ok, or number of errors return writeErrors; @@ -3100,7 +3106,7 @@ void writeFram(byte flashramType) { // Close the file: myFile.close(); } else { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } } else { print_Error(F("Savetype Error"), true); @@ -3327,7 +3333,7 @@ redumpnewfolder: sd.chdir(folder); display_Clear(); - print_Msg(F("Saving to ")); + print_STR(saving_to_STR, 0); print_Msg(folder); println_Msg(F("/...")); display_Update(); @@ -3339,7 +3345,7 @@ redumpnewfolder: redumpsamefolder: // Open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } // dumping rom slow @@ -3478,7 +3484,8 @@ redumpsamefolder: print_Msg(timeElapsed); // include elapsed time println_Msg(F("s)")); println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); // This saves a tt file with rom info next to the dumped rom #ifdef savesummarytotxt @@ -3493,7 +3500,8 @@ redumpsamefolder: errorLvl = 1; setColor_RGB(255, 0, 0); println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); // This saves a tt file with rom info next to the dumped rom #ifdef savesummarytotxt @@ -3528,7 +3536,7 @@ redumpsamefolder: sd.chdir(folder); // Delete old file if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } if (!myFile.remove()) { print_Error(F("Delete Error"), true); @@ -3554,7 +3562,7 @@ redumpsamefolder: void savesummary_N64(boolean checkfound, char crcStr[9], unsigned long timeElapsed) { // Open file on sd card if (!myFile.open("N64/ROM/n64log.txt", O_RDWR | O_CREAT | O_APPEND)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } //Write the info @@ -3675,7 +3683,8 @@ void flashRepro_N64() { println_Msg(F("Repro Cartridge.")); println_Msg(F("Attention: Use 3.3V!")); println_Msg(""); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); } else { @@ -3821,7 +3830,7 @@ void flashRepro_N64() { // Compare file size to flashrom size if ((fileSize / 1048576) > cartSize) { - print_Error(F("File too big"), true); + print_Error(file_too_big_STR, true); } // Erase needed sectors @@ -3879,7 +3888,7 @@ void flashRepro_N64() { myFile.close(); // Verify - print_Msg(F("Verifying...")); + print_STR(verifying_STR, 0); display_Update(); writeErrors = verifyFlashrom_N64(); if (writeErrors == 0) { @@ -3888,7 +3897,7 @@ void flashRepro_N64() { } else { print_Msg(writeErrors); print_Msg(F(" bytes ")); - print_Error(F("did not verify."), false); + print_Error(did_not_verify_STR, false); } } else { // Close the file @@ -3899,7 +3908,8 @@ void flashRepro_N64() { print_Error(F("Can't open file"), false); } - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); display_Clear(); @@ -4598,7 +4608,7 @@ unsigned long verifyFlashrom_N64() { myFile.close(); return writeErrors; } else { - println_Msg(F("Can't open file")); + print_STR(open_file_STR, 1); display_Update(); return 9999; } @@ -4627,7 +4637,8 @@ void flashGameshark_N64() { println_Msg(F("Gameshark cartridge")); println_Msg(F("Attention: Use 3.3V!")); println_Msg(F("Power OFF if Unsure!")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); @@ -4652,7 +4663,7 @@ void flashGameshark_N64() { // Compare file size to flashrom size if (fileSize > 262144) { - print_Error(F("File too big"), true); + print_Error(file_too_big_STR, true); } // SST 29LE010, chip erase not needed as this eeprom automaticly erases during the write cycle @@ -4668,7 +4679,7 @@ void flashGameshark_N64() { myFile.close(); // Verify - print_Msg(F("Verifying...")); + print_STR(verifying_STR, 0); display_Update(); writeErrors = verifyGameshark_N64(); @@ -4682,7 +4693,7 @@ void flashGameshark_N64() { } else { print_Msg(writeErrors); print_Msg(F(" bytes ")); - print_Error(F("did not verify."), false); + print_Error(did_not_verify_STR, false); } } else { print_Error(F("Can't open file"), false); @@ -4695,7 +4706,8 @@ void flashGameshark_N64() { print_Error(F("Unknown flashrom"), false); } - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); display_Clear(); @@ -4755,7 +4767,7 @@ void backupGameshark_N64() { // Open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } for (unsigned long currByte = romBase + 0xC00000; currByte < (romBase + 0xC00000 + 262144); currByte += 512) { @@ -4865,7 +4877,7 @@ unsigned long verifyGameshark_N64() { myFile.close(); return writeErrors; } else { - println_Msg(F("Can't open file")); + print_STR(open_file_STR, 1); display_Update(); return 9999; } diff --git a/Cart_Reader/NES.ino b/Cart_Reader/NES.ino index 51dd343..d559ce6 100644 --- a/Cart_Reader/NES.ino +++ b/Cart_Reader/NES.ino @@ -227,8 +227,8 @@ static const char nesMenuItem3[] PROGMEM = "Read Sram"; static const char nesMenuItem4[] PROGMEM = "Write Sram"; static const char nesMenuItem5[] PROGMEM = "Change Mapper"; static const char nesMenuItem6[] PROGMEM = "Flash NESMaker"; -static const char nesMenuItem7[] PROGMEM = "Reset"; -static const char* const menuOptionsNES[] PROGMEM = { nesMenuItem1, nesMenuItem2, nesMenuItem3, nesMenuItem4, nesMenuItem5, nesMenuItem6, nesMenuItem7 }; +//static const char nesMenuItem7[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const menuOptionsNES[] PROGMEM = { nesMenuItem1, nesMenuItem2, nesMenuItem3, nesMenuItem4, nesMenuItem5, nesMenuItem6, string_reset2 }; // NES chips menu #ifndef nointro @@ -269,7 +269,8 @@ void nesMenu() { sd.chdir("/"); readRom_NES(); println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); #ifdef global_log save_log(); #endif @@ -289,7 +290,8 @@ void nesMenu() { readRAM(); resetROM(); println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); break; @@ -299,7 +301,8 @@ void nesMenu() { writeRAM(); resetROM(); println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); break; @@ -329,7 +332,8 @@ void nesMenu() { println_Msg(F("Error:")); println_Msg(F("Can't write to this cartridge")); println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); } wait(); @@ -361,14 +365,16 @@ void nesChipMenu() { resetROM(); println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); #else display_Clear(); // Change working dir to root sd.chdir("/"); readRaw_NES(); println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); #ifdef global_log save_log(); #endif @@ -383,7 +389,8 @@ void nesChipMenu() { readPRG(false); resetROM(); println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); break; @@ -394,7 +401,8 @@ void nesChipMenu() { readCHR(false); resetROM(); println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); break; @@ -717,11 +725,11 @@ boolean getMapping() { println_Msg(F("K")); } #if defined(enable_OLED) - println_Msg(F("Press left to Change")); - println_Msg(F("and right to Select")); + print_STR(press_to_change_STR, 1); + print_STR(right_to_select_STR, 1); #elif defined(enable_LCD) - println_Msg(F("Rotate to Change")); - println_Msg(F("Press to Select")); + print_STR(rotate_to_change_STR, 1); + print_STR(press_to_select_STR, 1); #elif defined(SERIAL_MONITOR) println_Msg(F("U/D to Change")); println_Msg(F("Space to Select")); @@ -1005,11 +1013,11 @@ void selectMapping() { println_Msg(F("K")); } #if defined(enable_OLED) - println_Msg(F("Press left to Change")); - println_Msg(F("and right to Select")); + print_STR(press_to_change_STR, 1); + print_STR(right_to_select_STR, 1); #elif defined(enable_LCD) - println_Msg(F("Rotate to Change")); - println_Msg(F("Press to Select")); + print_STR(rotate_to_change_STR, 1); + print_STR(press_to_select_STR, 1); #elif defined(SERIAL_MONITOR) println_Msg(F("U/D to Change")); println_Msg(F("Space to Select")); @@ -1101,7 +1109,7 @@ void readRom_NES() { sd.chdir(folder); display_Clear(); - print_Msg(F("Saving to ")); + print_STR(saving_to_STR, 0); print_Msg(folder); println_Msg(F("/...")); display_Update(); @@ -1112,7 +1120,7 @@ void readRom_NES() { // Open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } //Initialize progress bar @@ -1160,7 +1168,7 @@ void readRaw_NES() { sd.chdir(folder); display_Clear(); - print_Msg(F("Saving to ")); + print_STR(saving_to_STR, 0); print_Msg(folder); println_Msg(F("/...")); display_Update(); @@ -1171,7 +1179,7 @@ void readRaw_NES() { // Open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } //Initialize progress bar @@ -1530,7 +1538,7 @@ void CreatePRGFileInSD() { display_Clear(); println_Msg(F("PRG FILE FAILED!")); display_Update(); - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); LED_RED_OFF; } @@ -1555,7 +1563,7 @@ void CreateCHRFileInSD() { display_Clear(); println_Msg(F("CHR FILE FAILED!")); display_Update(); - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); LED_RED_OFF; } @@ -1580,7 +1588,7 @@ void CreateRAMFileInSD() { display_Clear(); println_Msg(F("RAM FILE FAILED!")); display_Update(); - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); LED_RED_OFF; } @@ -1682,7 +1690,7 @@ void outputNES() { display_Clear(); println_Msg(F("PRG FILE FAILED!")); display_Update(); - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } if (has_header) { @@ -1702,7 +1710,7 @@ void outputNES() { display_Clear(); println_Msg(F("NES FILE FAILED!")); display_Update(); - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } if (has_header) { @@ -1726,7 +1734,7 @@ void outputNES() { display_Clear(); println_Msg(F("CHR FILE FAILED!")); display_Update(); - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } while ((n = myFile.read(sdBuffer, sizeof(sdBuffer))) > 0) { nesFile.write(sdBuffer, n); @@ -2065,7 +2073,7 @@ chooseMapper: println_Msg(""); println_Msg(""); println_Msg(""); - println_Msg(F("Press left to change")); + print_STR(press_to_change_STR, 1); println_Msg(F("Press right to select")); if (digit == 0) { @@ -2185,8 +2193,8 @@ chooseMapper: print_Msg(F("Mapper: ")); println_Msg(mapselect); println_Msg(F("")); - println_Msg(F("Rotate to change")); - println_Msg(F("Press to select")); + print_STR(rotate_to_change_STR, 1); + print_STR(press_to_select_STR, 1); display_Update(); while (1) { @@ -2203,8 +2211,8 @@ chooseMapper: print_Msg(F("Mapper: ")); println_Msg(mapselect); println_Msg(F("")); - println_Msg(F("Rotate to change")); - println_Msg(F("Press to select")); + print_STR(rotate_to_change_STR, 1); + print_STR(press_to_select_STR, 1); display_Update(); } @@ -2219,8 +2227,8 @@ chooseMapper: print_Msg(F("Mapper: ")); println_Msg(mapselect); println_Msg(F("")); - println_Msg(F("Rotate to change")); - println_Msg(F("Press to select")); + print_STR(rotate_to_change_STR, 1); + print_STR(press_to_select_STR, 1); display_Update(); } @@ -2321,11 +2329,11 @@ void setPRGSize() { println_Msg(PRG[i]); println_Msg(F("")); #if defined(enable_OLED) - println_Msg(F("Press left to change")); + print_STR(press_to_change_STR, 1); println_Msg(F("Press right to select")); #elif defined(enable_LCD) - println_Msg(F("Rotate to change")); - println_Msg(F("Press to select")); + print_STR(rotate_to_change_STR, 1); + print_STR(press_to_select_STR, 1); #endif display_Update(); @@ -2343,11 +2351,11 @@ void setPRGSize() { println_Msg(PRG[i]); println_Msg(F("")); #if defined(enable_OLED) - println_Msg(F("Press left to change")); + print_STR(press_to_change_STR, 1); println_Msg(F("Press right to select")); #elif defined(enable_LCD) - println_Msg(F("Rotate to change")); - println_Msg(F("Press to select")); + print_STR(rotate_to_change_STR, 1); + print_STR(press_to_select_STR, 1); #endif display_Update(); } @@ -2362,11 +2370,11 @@ void setPRGSize() { println_Msg(PRG[i]); println_Msg(F("")); #if defined(enable_OLED) - println_Msg(F("Press left to change")); + print_STR(press_to_change_STR, 1); println_Msg(F("Press right to select")); #elif defined(enable_LCD) - println_Msg(F("Rotate to change")); - println_Msg(F("Press to select")); + print_STR(rotate_to_change_STR, 1); + print_STR(press_to_select_STR, 1); #endif display_Update(); } @@ -2441,11 +2449,11 @@ void setCHRSize() { println_Msg(CHR[i]); println_Msg(F("")); #if defined(enable_OLED) - println_Msg(F("Press left to change")); + print_STR(press_to_change_STR, 1); println_Msg(F("Press right to select")); #elif defined(enable_LCD) - println_Msg(F("Rotate to change")); - println_Msg(F("Press to select")); + print_STR(rotate_to_change_STR, 1); + print_STR(press_to_select_STR, 1); #endif display_Update(); @@ -2463,11 +2471,11 @@ void setCHRSize() { println_Msg(CHR[i]); println_Msg(F("")); #if defined(enable_OLED) - println_Msg(F("Press left to change")); + print_STR(press_to_change_STR, 1); println_Msg(F("Press right to select")); #elif defined(enable_LCD) - println_Msg(F("Rotate to change")); - println_Msg(F("Press to select")); + print_STR(rotate_to_change_STR, 1); + print_STR(press_to_select_STR, 1); #endif display_Update(); } @@ -2483,11 +2491,11 @@ void setCHRSize() { println_Msg(CHR[i]); println_Msg(F("")); #if defined(enable_OLED) - println_Msg(F("Press left to change")); + print_STR(press_to_change_STR, 1); println_Msg(F("Press right to select")); #elif defined(enable_LCD) - println_Msg(F("Rotate to change")); - println_Msg(F("Press to select")); + print_STR(rotate_to_change_STR, 1); + print_STR(press_to_select_STR, 1); #endif display_Update(); } @@ -2576,11 +2584,11 @@ void setRAMSize() { println_Msg(RAM[i]); println_Msg(F("")); #if defined(enable_OLED) - println_Msg(F("Press left to change")); + print_STR(press_to_change_STR, 1); println_Msg(F("Press right to select")); #elif defined(enable_LCD) - println_Msg(F("Rotate to change")); - println_Msg(F("Press to select")); + print_STR(rotate_to_change_STR, 1); + print_STR(press_to_select_STR, 1); #endif display_Update(); @@ -2612,11 +2620,11 @@ void setRAMSize() { println_Msg(RAM[i]); println_Msg(F("")); #if defined(enable_OLED) - println_Msg(F("Press left to change")); + print_STR(press_to_change_STR, 1); println_Msg(F("Press right to select")); #elif defined(enable_LCD) - println_Msg(F("Rotate to change")); - println_Msg(F("Press to select")); + print_STR(rotate_to_change_STR, 1); + print_STR(press_to_select_STR, 1); #endif display_Update(); } @@ -2646,11 +2654,11 @@ void setRAMSize() { println_Msg(RAM[i]); println_Msg(F("")); #if defined(enable_OLED) - println_Msg(F("Press left to change")); + print_STR(press_to_change_STR, 1); println_Msg(F("Press right to select")); #elif defined(enable_LCD) - println_Msg(F("Rotate to change")); - println_Msg(F("Press to select")); + print_STR(rotate_to_change_STR, 1); + print_STR(press_to_select_STR, 1); #endif display_Update(); } @@ -2859,7 +2867,8 @@ void checkStatus_NES() { println_Msg(F("K")); } println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); } @@ -4808,7 +4817,7 @@ void writeRAM() { display_Update(); } else { - print_Error(F("SD ERROR"), true); + print_Error(sd_error_STR, true); } } diff --git a/Cart_Reader/NGP.ino b/Cart_Reader/NGP.ino index 79386f3..cad21aa 100644 --- a/Cart_Reader/NGP.ino +++ b/Cart_Reader/NGP.ino @@ -5,8 +5,8 @@ static const char ngpMenuItem1[] PROGMEM = "Read Rom"; static const char ngpMenuItem2[] PROGMEM = "Read chip info"; -static const char ngpMenuItemReset[] PROGMEM = "Reset"; -static const char* const menuOptionsNGP[] PROGMEM = { ngpMenuItem1, ngpMenuItem2, ngpMenuItemReset }; +//static const char ngpMenuItemReset[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const menuOptionsNGP[] PROGMEM = { ngpMenuItem1, ngpMenuItem2, string_reset2 }; static const char ngpRomItem1[] PROGMEM = "4 Mbits / 512 KB"; static const char ngpRomItem2[] PROGMEM = "8 Mbits / 1 MB"; @@ -73,7 +73,8 @@ void ngpMenu() { } println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); } @@ -169,7 +170,8 @@ void printCartInfo_NGP() { println_Msg(F(" Mbits")); } - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); } @@ -206,14 +208,14 @@ void readROM_NGP(char* outPathBuf, size_t bufferSize) { snprintf(outPathBuf, bufferSize, "%s/%s", folder, fileName); display_Clear(); - print_Msg(F("Saving to ")); + print_STR(saving_to_STR, 0); print_Msg(folder); println_Msg(F("/...")); display_Update(); // open file on sdcard if (!myFile.open(fileName, O_RDWR | O_CREAT)) - print_Error(F("Can't create file on SD"), true); + print_Error(create_file_STR, true); // write new folder number back to EEPROM foldern++; @@ -264,7 +266,7 @@ void scanChip_NGP() { // open file on sdcard if (!myFile.open(fileName, O_RDWR | O_CREAT)) - print_Error(F("Can't create file on SD"), true); + print_Error(create_file_STR, true); // write new folder number back to EEPROM foldern++; diff --git a/Cart_Reader/PCE.ino b/Cart_Reader/PCE.ino index 5c44f5a..0366a78 100644 --- a/Cart_Reader/PCE.ino +++ b/Cart_Reader/PCE.ino @@ -54,14 +54,14 @@ uint8_t tennokoe_bank_index = 0; static const char pceMenuItem1[] PROGMEM = "HuCARD (swapped)"; static const char pceMenuItem2[] PROGMEM = "HuCARD(not swapped)"; static const char pceMenuItem3[] PROGMEM = "Turbochip"; -static const char pceMenuItem4[] PROGMEM = "Reset"; -static const char *const menuOptionspce[] PROGMEM = { pceMenuItem1, pceMenuItem2, pceMenuItem3, pceMenuItem4 }; +//static const char pceMenuItem4[] PROGMEM = "Reset"; (stored in common strings array) +static const char *const menuOptionspce[] PROGMEM = { pceMenuItem1, pceMenuItem2, pceMenuItem3, string_reset2 }; // PCE card menu items static const char pceCartMenuItem1[] = "Read ROM"; static char pceCartMenuItem2[20]; static char pceCartMenuItem3[20]; -static const char pceCartMenuItem4[] = "Reset"; +//static const char pceCartMenuItem4[] = "Reset"; (stored in common strings array) static const char pceCartMenuItem5[] = "Inc Bank Number"; static const char pceCartMenuItem6[] = "Dec Bank Number"; static char pceCartMenuItem7[20]; @@ -69,8 +69,8 @@ static char menuOptionspceCart[7][20]; // Turbochip menu items static const char pceTCMenuItem1[] PROGMEM = "Read ROM"; -static const char pceTCMenuItem2[] PROGMEM = "Reset"; -static const char *const menuOptionspceTC[] PROGMEM = { pceTCMenuItem1, pceTCMenuItem2 }; +//static const char pceTCMenuItem2[] PROGMEM = "Reset"; (stored in common strings array) +static const char *const menuOptionspceTC[] PROGMEM = { pceTCMenuItem1, string_reset2 }; // PCE start menu void pcsMenu(void) { @@ -549,7 +549,7 @@ void read_tennokoe_bank_PCE(int bank_index) { //open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("Can't create file on SD"), true); + print_Error(create_file_STR, true); } pin_read_write_PCE(); @@ -688,8 +688,8 @@ void write_tennokoe_bank_PCE(int bank_index) { } else { println_Msg(F("Verify failed...")); print_Msg(diffcnt); - println_Msg(F(" bytes ")); - print_Error(F("did not verify."), false); + print_STR(_bytes_STR, 1); + print_Error(did_not_verify_STR, false); } pin_init_PCE(); @@ -743,7 +743,7 @@ void read_rom_PCE(void) { //open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("Can't create file on SD"), true); + print_Error(create_file_STR, true); } pin_read_write_PCE(); @@ -800,7 +800,7 @@ void pceMenu() { strcpy(menuOptionspceCart[0], pceCartMenuItem1); strcpy(menuOptionspceCart[1], pceCartMenuItem2); strcpy(menuOptionspceCart[2], pceCartMenuItem3); - strcpy(menuOptionspceCart[3], pceCartMenuItem4); + strcpy(menuOptionspceCart[3], string_reset2); // (stored in common strings array) strcpy(menuOptionspceCart[4], pceCartMenuItem5); strcpy(menuOptionspceCart[5], pceCartMenuItem6); if (pce_force_rom_size > 0) { @@ -865,7 +865,8 @@ void pceMenu() { } println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); } diff --git a/Cart_Reader/PCW.ino b/Cart_Reader/PCW.ino index f0f0122..53d36c0 100644 --- a/Cart_Reader/PCW.ino +++ b/Cart_Reader/PCW.ino @@ -137,8 +137,8 @@ void setup_PCW() { static const char pcwmenuItem1[] PROGMEM = "Read ROM"; static const char pcwmenuItem2[] PROGMEM = "Read SRAM"; static const char pcwmenuItem3[] PROGMEM = "Write SRAM"; -static const char pcwmenuItem4[] PROGMEM = "Reset"; -static const char* const menuOptionsPCW[] PROGMEM = { pcwmenuItem1, pcwmenuItem2, pcwmenuItem3, pcwmenuItem4 }; +//static const char pcwmenuItem4[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const menuOptionsPCW[] PROGMEM = { pcwmenuItem1, pcwmenuItem2, pcwmenuItem3, string_reset2 }; void pcwMenu() { convertPgm(menuOptionsPCW, 4); @@ -164,7 +164,8 @@ void pcwMenu() { readSRAM_PCW(); sd.chdir("/"); // Wait for user input - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); break; @@ -181,10 +182,10 @@ void pcwMenu() { println_Msg(F("SRAM verified OK")); display_Update(); } else { - print_Msg(F("Error: ")); + print_STR(error_STR, 0); print_Msg(writeErrors); - println_Msg(F(" bytes ")); - print_Error(F("did not verify."), false); + print_STR(_bytes_STR, 1); + print_Error(did_not_verify_STR, false); } break; @@ -468,7 +469,7 @@ void readROM_PCW() { sd.chdir(folder); display_Clear(); - print_Msg(F("Saving to ")); + print_STR(saving_to_STR, 0); print_Msg(folder); println_Msg(F("/...")); display_Update(); @@ -477,7 +478,7 @@ void readROM_PCW() { EEPROM_writeAnything(0, foldern); if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } read_setup_PCW(); for (unsigned long address = 0; address < 0x400000; address += 512) { // 4MB @@ -495,7 +496,8 @@ void readROM_PCW() { // Wait for user input println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); } @@ -510,7 +512,7 @@ void readMultiROM_PCW() { sd.chdir(folder); display_Clear(); - print_Msg(F("Saving to ")); + print_STR(saving_to_STR, 0); print_Msg(folder); println_Msg(F("/...")); display_Update(); @@ -519,7 +521,7 @@ void readMultiROM_PCW() { EEPROM_writeAnything(0, foldern); if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } display_Clear(); println_Msg(F("READING MULTI-PACK")); @@ -554,7 +556,8 @@ void readMultiROM_PCW() { // Wait for user input println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); } @@ -576,7 +579,7 @@ void readSRAM_PCW() { // readSRAM_1A() EEPROM_writeAnything(0, foldern); if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } display_Clear(); read_setup_PCW(); @@ -620,13 +623,13 @@ void writeSRAM_PCW() { } } myFile.close(); - println_Msg(F("Done")); + print_STR(done_STR, 1); display_Update(); } else { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } } else { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } display_Clear(); } @@ -649,7 +652,7 @@ unsigned long verifySRAM_PCW() { } myFile.close(); } else { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } return writeErrors; diff --git a/Cart_Reader/SFM.ino b/Cart_Reader/SFM.ino index 709ef8f..dcca1d7 100644 --- a/Cart_Reader/SFM.ino +++ b/Cart_Reader/SFM.ino @@ -34,8 +34,8 @@ boolean hirom[8]; // SFM menu items static const char sfmMenuItem1[] PROGMEM = "Game Menu"; static const char sfmMenuItem2[] PROGMEM = "Flash Menu"; -static const char sfmMenuItem3[] PROGMEM = "Reset"; -static const char* const menuOptionsSFM[] PROGMEM = { sfmMenuItem1, sfmMenuItem2, sfmMenuItem3 }; +//static const char sfmMenuItem3[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const menuOptionsSFM[] PROGMEM = { sfmMenuItem1, sfmMenuItem2, string_reset2 }; // SFM flash menu items static const char sfmFlashMenuItem1[] PROGMEM = "Read Flash"; @@ -51,8 +51,8 @@ static const char sfmGameMenuItem1[] PROGMEM = "Read Sram"; static const char sfmGameMenuItem2[] PROGMEM = "Read Game"; static const char sfmGameMenuItem3[] PROGMEM = "Write Sram"; static const char sfmGameMenuItem4[] PROGMEM = "Switch Game"; -static const char sfmGameMenuItem5[] PROGMEM = "Reset"; -static const char* const menuOptionsSFMGame[] PROGMEM = { sfmGameMenuItem1, sfmGameMenuItem2, sfmGameMenuItem3, sfmGameMenuItem4, sfmGameMenuItem5 }; +//static const char sfmGameMenuItem5[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const menuOptionsSFMGame[] PROGMEM = { sfmGameMenuItem1, sfmGameMenuItem2, sfmGameMenuItem3, sfmGameMenuItem4, string_reset2 }; void sfmMenu() { // create menu with title and 3 options to choose from @@ -182,10 +182,10 @@ void sfmGameOptions() { println_Msg(F("Verified OK")); display_Update(); } else { - print_Msg(F("Error: ")); + print_STR(error_STR, 0); print_Msg(wrErrors); - println_Msg(F(" bytes ")); - print_Error(F("did not verify."), false); + print_STR(_bytes_STR, 1); + print_Error(did_not_verify_STR, false); } break; @@ -201,7 +201,8 @@ void sfmGameOptions() { } if (gameSubMenu != 3) { println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); } @@ -267,7 +268,8 @@ void sfmFlashMenu() { println_Msg(F("This will erase your")); println_Msg(F("NP Cartridge.")); println_Msg(""); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); @@ -379,7 +381,8 @@ void sfmFlashMenu() { println_Msg(F("This will erase your")); println_Msg(F("NP Cartridge.")); println_Msg(""); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); @@ -429,7 +432,8 @@ void sfmFlashMenu() { } if (flashSubMenu != 5) { println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); } @@ -784,7 +788,8 @@ void getCartInfo_SFM() { print_Msg(F("Sram: ")); print_Msg(sramSize); println_Msg(F("Kbit")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); // Wait for user input wait(); @@ -927,7 +932,7 @@ void readROM_SFM() { //open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("Can't create file on SD"), true); + print_Error(create_file_STR, true); } // Check if LoROM or HiROM... @@ -1098,7 +1103,7 @@ void writeFlash_SFM(int startBank, uint32_t pos) { myFile.close(); println_Msg(""); } else { - print_Error(F("Can't open file on SD"), true); + print_Error(open_file_STR, true); } } @@ -1261,7 +1266,7 @@ void readFlash_SFM() { // Open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("Can't create file on SD"), true); + print_Error(create_file_STR, true); } if (romType) { for (int currBank = 0xC0; currBank < 0xC0 + numBanks; currBank++) { @@ -1405,7 +1410,7 @@ void readMapping() { //open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } // Read the mapping info out of the 1st chip @@ -1730,7 +1735,7 @@ void write_SFM(int startBank, uint32_t pos) { display_Update(); eraseFlash_SFM(startBank); resetFlash_SFM(startBank); - println_Msg(F("Done")); + print_STR(done_STR, 1); print_Msg(F("Blankcheck...")); display_Update(); if (blankcheck_SFM(startBank)) { @@ -1747,17 +1752,17 @@ void write_SFM(int startBank, uint32_t pos) { resetFlash_SFM(startBank); // Checking for errors - print_Msg(F("Verifying...")); + print_STR(verifying_STR, 0); display_Update(); writeErrors = verifyFlash_SFM(startBank, pos); if (writeErrors == 0) { println_Msg(F("OK")); display_Update(); } else { - print_Msg(F("Error: ")); + print_STR(error_STR, 0); print_Msg(writeErrors); - println_Msg(F(" bytes ")); - print_Error(F("did not verify."), true); + print_STR(_bytes_STR, 1); + print_Error(did_not_verify_STR, true); } } else { print_Error(F("Error: Wrong Flash ID"), true); diff --git a/Cart_Reader/SMS.ino b/Cart_Reader/SMS.ino index 052e60a..1020ed0 100644 --- a/Cart_Reader/SMS.ino +++ b/Cart_Reader/SMS.ino @@ -18,9 +18,9 @@ static const char* const menuAdapterSMS[] PROGMEM = { SMSAdapterItem1, SMSAdapte static const char SMSMenuItem1[] PROGMEM = "Read Rom"; static const char SMSMenuItem2[] PROGMEM = "Read from SRAM"; static const char SMSMenuItem3[] PROGMEM = "Write to SRAM"; -static const char SMSMenuItem4[] PROGMEM = "Reset"; +//static const char SMSMenuItem4[] PROGMEM = "Reset"; (stored in common strings array) static const char SMSMenuItem5[] PROGMEM = "Change Retrode Mode"; -static const char* const menuOptionsSMS[] PROGMEM = { SMSMenuItem1, SMSMenuItem2, SMSMenuItem3, SMSMenuItem4, SMSMenuItem5 }; +static const char* const menuOptionsSMS[] PROGMEM = { SMSMenuItem1, SMSMenuItem2, SMSMenuItem3, string_reset2, SMSMenuItem5 }; // Rom Size menu static const char SMSRomItem1[] PROGMEM = "8KB"; @@ -114,10 +114,12 @@ void _smsMenu() { } if (retrode_mode) { println_Msg(retrode_mode ? (retrode_mode_sms ? F("Retrode Mode SMS") : F("Retrode Mode GG")) : F("Retrode Mode Off")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); } else { println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); } display_Update(); wait(); @@ -550,7 +552,8 @@ void getCartInfo_SMS() { // Wait for user input #if (defined(enable_LCD) || defined(enable_OLED)) - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); #endif @@ -579,7 +582,7 @@ void readROM_SMS() { sd.chdir(folder); display_Clear(); - print_Msg(F("Saving to ")); + print_STR(saving_to_STR, 0); print_Msg(folder); println_Msg(F("/...")); display_Update(); @@ -590,7 +593,7 @@ void readROM_SMS() { // Open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } // set default bank size to 16KB @@ -664,7 +667,7 @@ void readSRAM_SMS() { sd.chdir(folder); display_Clear(); - print_Msg(F("Saving to ")); + print_STR(saving_to_STR, 0); print_Msg(folder); println_Msg(F("/...")); display_Update(); @@ -675,7 +678,7 @@ void readSRAM_SMS() { // Open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } // Write the whole 32KB // When there is only 8KB of SRAM, the contents should be duplicated @@ -742,10 +745,10 @@ void writeSRAM_SMS() { blinkLED(); println_Msg(F("")); - println_Msg(F("DONE")); + print_STR(done_STR, 1); display_Update(); } else { - print_Error(F("SD ERROR"), true); + print_Error(sd_error_STR, true); } } diff --git a/Cart_Reader/SNES.ino b/Cart_Reader/SNES.ino index b312747..5f4953b 100644 --- a/Cart_Reader/SNES.ino +++ b/Cart_Reader/SNES.ino @@ -35,11 +35,11 @@ static const char snsMenuItem3[] PROGMEM = "Satellaview BS-X"; static const char snsMenuItem4[] PROGMEM = "Flash repro"; #ifdef clockgen_calibration static const char snsMenuItem5[] PROGMEM = "Calibrate Clock"; -static const char snsMenuItem6[] PROGMEM = "Reset"; -static const char* const menuOptionsSNS[] PROGMEM = { snsMenuItem1, snsMenuItem2, snsMenuItem3, snsMenuItem4, snsMenuItem5, snsMenuItem6 }; +//static const char snsMenuItem6[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const menuOptionsSNS[] PROGMEM = { snsMenuItem1, snsMenuItem2, snsMenuItem3, snsMenuItem4, snsMenuItem5, string_reset2 }; #else -static const char snsMenuItem5[] PROGMEM = "Reset"; -static const char* const menuOptionsSNS[] PROGMEM = { snsMenuItem1, snsMenuItem2, snsMenuItem3, snsMenuItem4, snsMenuItem5 }; +//static const char snsMenuItem5[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const menuOptionsSNS[] PROGMEM = { snsMenuItem1, snsMenuItem2, snsMenuItem3, snsMenuItem4, string_reset2 }; #endif // SNES menu items @@ -49,24 +49,24 @@ static const char SnesMenuItem3[] PROGMEM = "Write Save"; static const char SnesMenuItem4[] PROGMEM = "Test SRAM"; static const char SnesMenuItem5[] PROGMEM = "Cycle cart"; static const char SnesMenuItem6[] PROGMEM = "Force cart type"; -static const char SnesMenuItem7[] PROGMEM = "Reset"; -static const char* const menuOptionsSNES[] PROGMEM = { SnesMenuItem1, SnesMenuItem2, SnesMenuItem3, SnesMenuItem4, SnesMenuItem5, SnesMenuItem6, SnesMenuItem7 }; +//static const char SnesMenuItem7[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const menuOptionsSNES[] PROGMEM = { SnesMenuItem1, SnesMenuItem2, SnesMenuItem3, SnesMenuItem4, SnesMenuItem5, SnesMenuItem6, string_reset2 }; // Manual config menu items static const char confMenuItem1[] PROGMEM = "Use header info"; static const char confMenuItem2[] PROGMEM = "4MB LoROM 256K SRAM"; static const char confMenuItem3[] PROGMEM = "4MB HiROM 64K SRAM"; static const char confMenuItem4[] PROGMEM = "6MB ExROM 256K SRAM"; -static const char confMenuItem5[] PROGMEM = "Reset"; -static const char* const menuOptionsConfManual[] PROGMEM = { confMenuItem1, confMenuItem2, confMenuItem3, confMenuItem4, confMenuItem5 }; +//static const char confMenuItem5[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const menuOptionsConfManual[] PROGMEM = { confMenuItem1, confMenuItem2, confMenuItem3, confMenuItem4, string_reset2 }; // Repro menu items static const char reproMenuItem1[] PROGMEM = "LoROM (P0)"; static const char reproMenuItem2[] PROGMEM = "HiROM (P0)"; static const char reproMenuItem3[] PROGMEM = "ExLoROM (P1)"; static const char reproMenuItem4[] PROGMEM = "ExHiROM (P1)"; -static const char reproMenuItem5[] PROGMEM = "Reset"; -static const char* const menuOptionsRepro[] PROGMEM = { reproMenuItem1, reproMenuItem2, reproMenuItem3, reproMenuItem4, reproMenuItem5 }; +//static const char reproMenuItem5[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const menuOptionsRepro[] PROGMEM = { reproMenuItem1, reproMenuItem2, reproMenuItem3, reproMenuItem4, string_reset2 }; // SNES repro menu void reproMenu() { @@ -247,10 +247,10 @@ void snesMenu() { println_Msg(F("Verified OK")); display_Update(); } else { - print_Msg(F("Error: ")); + print_STR(error_STR, 0); print_Msg(wrErrors); - println_Msg(F(" bytes ")); - print_Error(F("did not verify."), false); + print_STR(_bytes_STR, 1); + print_Error(did_not_verify_STR, false); } } else { display_Clear(); @@ -282,10 +282,10 @@ void snesMenu() { println_Msg(F("Restored OK")); display_Update(); } else { - print_Msg(F("Error: ")); + print_STR(error_STR, 0); print_Msg(wrErrors); - println_Msg(F(" bytes ")); - print_Error(F("did not verify."), false); + print_STR(_bytes_STR, 1); + print_Error(did_not_verify_STR, false); } } else { display_Clear(); @@ -323,7 +323,8 @@ void snesMenu() { break; } //println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); } @@ -840,7 +841,8 @@ void getCartInfo_SNES() { // Wait for user input #if (defined(enable_LCD) || defined(enable_OLED)) - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); #endif @@ -1314,7 +1316,7 @@ void readROM_SNES() { //clear the screen display_Clear(); - print_Msg(F("Saving to ")); + print_STR(saving_to_STR, 0); print_Msg(folder); println_Msg(F("/...")); display_Update(); @@ -1325,7 +1327,7 @@ void readROM_SNES() { //open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("Can't create file on SD"), true); + print_Error(create_file_STR, true); } //Dump Derby Stallion '96 (Japan) Actual Size is 24Mb @@ -1678,7 +1680,7 @@ void readSRAM() { //open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } int sramBanks = 0; if (romType == LO) { @@ -1951,10 +1953,10 @@ unsigned long verifySRAM() { if (writeErrors == 0) { println_Msg(F("Verified OK")); } else { - print_Msg(F("Error: ")); + print_STR(error_STR, 0); print_Msg(writeErrors); - println_Msg(F(" bytes ")); - print_Error(F("did not verify."), false); + print_STR(_bytes_STR, 1); + print_Error(did_not_verify_STR, false); } display_Update(); wait(); diff --git a/Cart_Reader/SV.ino b/Cart_Reader/SV.ino index dafad9a..6ad69ff 100644 --- a/Cart_Reader/SV.ino +++ b/Cart_Reader/SV.ino @@ -82,10 +82,10 @@ void svMenu() { println_Msg(F("Verified OK")); display_Update(); } else { - print_Msg(F("Error: ")); + print_STR(error_STR, 0); print_Msg(wrErrors); - println_Msg(F(" bytes ")); - print_Error(F("did not verify."), false); + print_STR(_bytes_STR, 1); + print_Error(did_not_verify_STR, false); } wait(); break; @@ -300,7 +300,7 @@ void readSRAM_SV() { //open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } int sramBanks = 0; @@ -435,7 +435,7 @@ void readROM_SV() { //clear the screen display_Clear(); - print_Msg(F("Saving to ")); + print_STR(saving_to_STR, 0); print_Msg(folder); println_Msg(F("/...")); display_Update(); @@ -446,7 +446,7 @@ void readROM_SV() { //open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("Can't create file on SD"), true); + print_Error(create_file_STR, true); } // Read Banks @@ -559,7 +559,7 @@ void writeROM_SV(void) { dataIn(); //Set pins to input controlIn_SNES(); myFile.seekSet(0); // Go back to file beginning - println_Msg(F("Verifying...")); + print_STR(verifying_STR, 1); display_Update(); for (int currBank = 0xC0; currBank < 0xD0; currBank++) { draw_progressbar(((currBank - 0xC0) * 0x10000), 0x100000); diff --git a/Cart_Reader/VBOY.ino b/Cart_Reader/VBOY.ino index 36ef1e2..709f360 100644 --- a/Cart_Reader/VBOY.ino +++ b/Cart_Reader/VBOY.ino @@ -97,8 +97,8 @@ void setup_VBOY() { static const char vboyMenuItem1[] PROGMEM = "Read ROM"; static const char vboyMenuItem2[] PROGMEM = "Read SRAM"; static const char vboyMenuItem3[] PROGMEM = "Write SRAM"; -static const char vboyMenuItem4[] PROGMEM = "Reset"; -static const char* const menuOptionsVBOY[] PROGMEM = { vboyMenuItem1, vboyMenuItem2, vboyMenuItem3, vboyMenuItem4 }; +//static const char vboyMenuItem4[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const menuOptionsVBOY[] PROGMEM = { vboyMenuItem1, vboyMenuItem2, vboyMenuItem3, string_reset2 }; void vboyMenu() { convertPgm(menuOptionsVBOY, 4); @@ -126,7 +126,8 @@ void vboyMenu() { } #if (defined(enable_OLED) || defined(enable_LCD)) // Wait for user input - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); #endif @@ -145,17 +146,18 @@ void vboyMenu() { println_Msg(F("SRAM verified OK")); display_Update(); } else { - print_Msg(F("Error: ")); + print_STR(error_STR, 0); print_Msg(writeErrors); - println_Msg(F(" bytes ")); - print_Error(F("did not verify."), false); + print_STR(_bytes_STR, 1); + print_Error(did_not_verify_STR, false); } } else { print_Error(F("Cart has no SRAM"), false); } #if (defined(enable_OLED) || defined(enable_LCD)) // Wait for user input - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); #endif @@ -395,7 +397,8 @@ void getCartInfo_VB() { #if (defined(enable_OLED) || defined(enable_LCD)) // Wait for user input - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); #endif @@ -417,7 +420,7 @@ void readROM_VB() { sd.chdir(folder); display_Clear(); - print_Msg(F("Saving to ")); + print_STR(saving_to_STR, 0); print_Msg(folder); println_Msg(F("/...")); display_Update(); @@ -426,7 +429,7 @@ void readROM_VB() { EEPROM_writeAnything(0, foldern); if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } word d = 0; @@ -469,7 +472,8 @@ void readROM_VB() { #if (defined(enable_OLED) || defined(enable_LCD)) // Wait for user input println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); #endif @@ -493,10 +497,10 @@ void writeSRAM_VB() { writeByte_VB(currByte, (myFile.read())); } myFile.close(); - println_Msg(F("Done")); + print_STR(done_STR, 1); display_Update(); } else { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } dataIn_VB(); } @@ -516,7 +520,7 @@ void readSRAM_VB() { EEPROM_writeAnything(0, foldern); if (!myFile.open(fileName, O_RDWR | O_CREAT)) { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } for (unsigned long currBuffer = 0; currBuffer < sramSize; currBuffer += 512) { for (int currByte = 0; currByte < 512; currByte++) { @@ -550,7 +554,7 @@ unsigned long verifySRAM_VB() { } myFile.close(); } else { - print_Error(F("SD Error"), true); + print_Error(sd_error_STR, true); } return writeErrors; diff --git a/Cart_Reader/WS.ino b/Cart_Reader/WS.ino index 5be2800..40e8273 100644 --- a/Cart_Reader/WS.ino +++ b/Cart_Reader/WS.ino @@ -35,9 +35,9 @@ static const char wsMenuItem1[] PROGMEM = "Read Rom"; static const char wsMenuItem2[] PROGMEM = "Read Save"; static const char wsMenuItem3[] PROGMEM = "Write Save"; -static const char wsMenuItem4[] PROGMEM = "Reset"; +//static const char wsMenuItem4[] PROGMEM = "Reset"; (stored in common strings array) static const char wsMenuItem5[] PROGMEM = "Write WitchOS"; -static const char *const menuOptionsWS[] PROGMEM = { wsMenuItem1, wsMenuItem2, wsMenuItem3, wsMenuItem4, wsMenuItem5 }; +static const char *const menuOptionsWS[] PROGMEM = { wsMenuItem1, wsMenuItem2, wsMenuItem3, string_reset2, wsMenuItem5 }; static const uint8_t wwLaunchCode[] PROGMEM = { 0xea, 0x00, 0x00, 0x00, 0xe0, 0x00, 0xff, 0xff }; @@ -184,7 +184,8 @@ void wsMenu() { } println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); @@ -404,7 +405,8 @@ void showCartInfo_WS() { print_Msg(F("Checksum: ")); println_Msg(checksumStr); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); } @@ -487,14 +489,14 @@ void readROM_WS(char *outPathBuf, size_t bufferSize) { snprintf(outPathBuf, bufferSize, "%s/%s", folder, fileName); display_Clear(); - print_Msg(F("Saving to ")); + print_STR(saving_to_STR, 0); print_Msg(folder); println_Msg(F("/...")); display_Update(); // open file on sdcard if (!myFile.open(fileName, O_RDWR | O_CREAT)) - print_Error(F("Can't create file on SD"), true); + print_Error(create_file_STR, true); // write new folder number back to EEPROM foldern++; @@ -561,7 +563,7 @@ void readSRAM_WS() { EEPROM_writeAnything(0, foldern); if (!myFile.open(fileName, O_RDWR | O_CREAT)) - print_Error(F("Can't create file on SD"), true); + print_Error(create_file_STR, true); uint32_t bank_size = (sramSize << 7); uint16_t end_bank = (bank_size >> 16); // 64KB per bank @@ -591,7 +593,7 @@ void readSRAM_WS() { myFile.close(); - println_Msg(F("Done")); + print_STR(done_STR, 1); display_Update(); } @@ -630,10 +632,10 @@ void verifySRAM_WS() { println_Msg(F("passed")); } else { println_Msg(F("failed")); - print_Msg(F("Error: ")); + print_STR(error_STR, 0); print_Msg(write_errors); - println_Msg(F(" bytes ")); - print_Error(F("did not verify."), false); + print_STR(_bytes_STR, 1); + print_Error(did_not_verify_STR, false); } } else { print_Error(F("File doesn't exist"), false); @@ -706,7 +708,7 @@ void readEEPROM_WS() { EEPROM_writeAnything(0, foldern); if (!myFile.open(fileName, O_RDWR | O_CREAT)) - print_Error(F("Can't create file on SD"), true); + print_Error(create_file_STR, true); uint32_t eepromSize = (sramSize << 7); uint32_t bufSize = (eepromSize < 512 ? eepromSize : 512); @@ -738,7 +740,7 @@ void readEEPROM_WS() { myFile.close(); - println_Msg(F("Done")); + print_STR(done_STR, 1); } void verifyEEPROM_WS() { @@ -784,10 +786,10 @@ void verifyEEPROM_WS() { println_Msg(F("passed")); } else { println_Msg(F("failed")); - print_Msg(F("Error: ")); + print_STR(error_STR, 0); print_Msg(write_errors); - println_Msg(F(" bytes ")); - print_Error(F("did not verify."), false); + print_STR(_bytes_STR, 1); + print_Error(did_not_verify_STR, false); } } else { print_Error(F("File doesn't exist"), false); @@ -839,7 +841,7 @@ void writeEEPROM_WS() { myFile.close(); - println_Msg(F("Done")); + print_STR(done_STR, 1); } else { print_Error(F("File doesn't exist"), false); } @@ -928,7 +930,7 @@ void writeWitchOS_WS() { myFile.close(); - println_Msg(F("Done")); + print_STR(done_STR, 1); } else { print_Error(F("File doesn't exist"), false); } diff --git a/Cart_Reader/WSV.ino b/Cart_Reader/WSV.ino index d7ed265..c3a70a5 100644 --- a/Cart_Reader/WSV.ino +++ b/Cart_Reader/WSV.ino @@ -102,8 +102,8 @@ void setup_WSV() { static const char wsvMenuItem1[] PROGMEM = "Select Cart"; static const char wsvMenuItem2[] PROGMEM = "Read ROM"; static const char wsvMenuItem3[] PROGMEM = "Set Size"; -static const char wsvMenuItem4[] PROGMEM = "Reset"; -static const char* const menuOptionsSV[] PROGMEM = { wsvMenuItem1, wsvMenuItem2, wsvMenuItem3, wsvMenuItem4 }; +//static const char wsvMenuItem4[] PROGMEM = "Reset"; (stored in common strings array) +static const char* const menuOptionsSV[] PROGMEM = { wsvMenuItem1, wsvMenuItem2, wsvMenuItem3, string_reset2 }; void wsvMenu() { convertPgm(menuOptionsSV, 4); @@ -198,14 +198,14 @@ void readROM_WSV() { sd.chdir(folder); display_Clear(); - print_Msg(F("Saving to ")); + print_STR(saving_to_STR, 0); print_Msg(folder); println_Msg(F("/...")); display_Update(); // open file on sdcard if (!myFile.open(fileName, O_RDWR | O_CREAT)) - print_Error(F("Can't create file on SD"), true); + print_Error(create_file_STR, true); // write new folder number back to EEPROM foldern++; @@ -233,7 +233,8 @@ void readROM_WSV() { compareCRC("wsv.txt", 0, 1, 0); println_Msg(F("")); - println_Msg(F("Press Button...")); + // Prints string out of the common strings array either with or without newline + print_STR(press_button_STR, 1); display_Update(); wait(); } @@ -256,11 +257,11 @@ void setROMSize_WSV() { println_Msg(WSV[i]); println_Msg(F("")); #if defined(enable_OLED) - println_Msg(F("Press left to Change")); - println_Msg(F("and right to Select")); + print_STR(press_to_change_STR, 1); + print_STR(right_to_select_STR, 1); #elif defined(enable_LCD) - println_Msg(F("Rotate to Change")); - println_Msg(F("Press to Select")); + print_STR(rotate_to_change_STR, 1); + print_STR(press_to_select_STR, 1); #endif display_Update(); @@ -278,11 +279,11 @@ void setROMSize_WSV() { println_Msg(WSV[i]); println_Msg(F("")); #if defined(enable_OLED) - println_Msg(F("Press left to Change")); - println_Msg(F("and right to Select")); + print_STR(press_to_change_STR, 1); + print_STR(right_to_select_STR, 1); #elif defined(enable_LCD) - println_Msg(F("Rotate to Change")); - println_Msg(F("Press to Select")); + print_STR(rotate_to_change_STR, 1); + print_STR(press_to_select_STR, 1); #endif display_Update(); } @@ -298,11 +299,11 @@ void setROMSize_WSV() { println_Msg(WSV[i]); println_Msg(F("")); #if defined(enable_OLED) - println_Msg(F("Press left to Change")); - println_Msg(F("and right to Select")); + print_STR(press_to_change_STR, 1); + print_STR(right_to_select_STR, 1); #elif defined(enable_LCD) - println_Msg(F("Rotate to Change")); - println_Msg(F("Press to Select")); + print_STR(rotate_to_change_STR, 1); + print_STR(press_to_select_STR, 1); #endif display_Update(); } @@ -478,11 +479,11 @@ void setCart_WSV() { println_Msg(F("KB")); println_Msg(F("")); #if defined(enable_OLED) - println_Msg(F("Press left to Change")); - println_Msg(F("and right to Select")); + print_STR(press_to_change_STR, 1); + print_STR(right_to_select_STR, 1); #elif defined(enable_LCD) - println_Msg(F("Rotate to Change")); - println_Msg(F("Press to Select")); + print_STR(rotate_to_change_STR, 1); + print_STR(press_to_select_STR, 1); #elif defined(SERIAL_MONITOR) println_Msg(F("U/D to Change")); println_Msg(F("Space to Select"));