From d039c590cce55723bad15975c5aea21ea8671340 Mon Sep 17 00:00:00 2001 From: smesgr9000 Date: Tue, 28 May 2024 21:11:48 +0200 Subject: [PATCH] define more commonly used string in OSCR and reuse them --- Cart_Reader/2600.ino | 6 +++--- Cart_Reader/5200.ino | 8 ++++---- Cart_Reader/7800.ino | 8 ++++---- Cart_Reader/ARC.ino | 4 ++-- Cart_Reader/C64.ino | 4 ++-- Cart_Reader/COLV.ino | 6 +++--- Cart_Reader/FAIRCHILD.ino | 4 ++-- Cart_Reader/GB.ino | 2 +- Cart_Reader/INTV.ino | 10 +++++----- Cart_Reader/LOOPY.ino | 2 +- Cart_Reader/MD.ino | 2 +- Cart_Reader/MSX.ino | 6 +++--- Cart_Reader/NES.ino | 2 +- Cart_Reader/ODY2.ino | 4 ++-- Cart_Reader/OSCR.cpp | 3 +++ Cart_Reader/OSCR.h | 3 +++ Cart_Reader/SFM.ino | 2 +- Cart_Reader/SMS.ino | 2 +- Cart_Reader/SNES.ino | 2 +- Cart_Reader/VBOY.ino | 2 +- Cart_Reader/VECTREX.ino | 6 +++--- Cart_Reader/WSV.ino | 6 +++--- 22 files changed, 50 insertions(+), 44 deletions(-) diff --git a/Cart_Reader/2600.ino b/Cart_Reader/2600.ino index ac1d7f4..6a888bb 100644 --- a/Cart_Reader/2600.ino +++ b/Cart_Reader/2600.ino @@ -598,7 +598,7 @@ void checkStatus_2600() { println_Msg(FS(FSTRING_EMPTY)); print_Msg(F("MAPPER: ")); println_Mapper2600(a2600mapper); - print_Msg(F("ROM SIZE: ")); + print_Msg(FS(FSTRING_ROM_SIZE)); if (a2600mapper == 0xD0) print_Msg(F("10")); else @@ -610,7 +610,7 @@ void checkStatus_2600() { Serial.print(F("MAPPER: ")); println_Mapper2600(a2600mapper); - Serial.print(F("ROM SIZE: ")); + Serial.print(FS(FSTRING_ROM_SIZE)); if (a2600mapper == 0xD0) Serial.print(F("10")); else @@ -627,7 +627,7 @@ void checkStatus_2600() { #if (defined(ENABLE_OLED) || defined(ENABLE_LCD)) void printMapperSelection_2600(int index) { display_Clear(); - print_Msg(F("Mapper: ")); + print_Msg(FS(FSTRING_MAPPER)); a2600index = index * 2; a2600mapselect = pgm_read_byte(a2600mapsize + a2600index); println_Mapper2600(a2600mapselect); diff --git a/Cart_Reader/5200.ino b/Cart_Reader/5200.ino index f24c3a8..3099c93 100644 --- a/Cart_Reader/5200.ino +++ b/Cart_Reader/5200.ino @@ -365,7 +365,7 @@ void setROMSize_5200() { display.setCursor(0, 56); // Display selection at bottom } - print_Msg(F("ROM SIZE ")); + print_Msg(FS(FSTRING_ROM_SIZE)); print_Msg(a5200[new5200size]); println_Msg(F("K")); display_Update(); @@ -422,7 +422,7 @@ void checkStatus_5200() { print_Msg(F("MAPPER: ")); println_Msg(a5200mapper); println_Mapper5200(a5200mapper); - print_Msg(F("ROM SIZE: ")); + print_Msg(FS(FSTRING_ROM_SIZE)); print_Msg(a5200[a5200size]); println_Msg(F("K")); display_Update(); @@ -431,7 +431,7 @@ void checkStatus_5200() { Serial.print(F("MAPPER: ")); Serial.println(a5200mapper); println_Mapper5200(a5200mapper); - Serial.print(F("ROM SIZE: ")); + Serial.print(FS(FSTRING_ROM_SIZE)); Serial.print(a5200[a5200size]); Serial.println(F("K")); Serial.println(FS(FSTRING_EMPTY)); @@ -445,7 +445,7 @@ void checkStatus_5200() { #if (defined(ENABLE_OLED) || defined(ENABLE_LCD)) void printMapperSelection_5200(int index) { display_Clear(); - print_Msg(F("Mapper: ")); + print_Msg(FS(FSTRING_MAPPER)); a5200index = index * 3; a5200mapselect = pgm_read_byte(a5200mapsize + a5200index); println_Msg(a5200mapselect); diff --git a/Cart_Reader/7800.ino b/Cart_Reader/7800.ino index 80ef2cf..fee491d 100644 --- a/Cart_Reader/7800.ino +++ b/Cart_Reader/7800.ino @@ -495,7 +495,7 @@ void setROMSize_7800() { new7800size = navigateMenu(a7800lo, a7800hi, &printRomSize_7800); display.setCursor(0, 56); // Display selection at bottom } - print_Msg(F("ROM SIZE ")); + print_Msg(FS(FSTRING_ROM_SIZE)); print_Msg(a7800[new7800size]); println_Msg(F("K")); display_Update(); @@ -552,7 +552,7 @@ void checkStatus_7800() { print_Msg(F("MAPPER: ")); println_Msg(a7800mapper); println_Mapper7800(a7800mapper); - print_Msg(F("ROM SIZE: ")); + print_Msg(FS(FSTRING_ROM_SIZE)); print_Msg(a7800[a7800size]); println_Msg(F("K")); display_Update(); @@ -576,7 +576,7 @@ void checkStatus_7800() { Serial.println(F("Karateka (PAL) [78S4 Variant]")); else if (a7800mapper == 7) Serial.println(F("Bankset")); - Serial.print(F("ROM SIZE: ")); + Serial.print(FS(FSTRING_ROM_SIZE)); Serial.print(A7800[a7800size]); Serial.println(F("K")); Serial.println(FS(FSTRING_EMPTY)); @@ -590,7 +590,7 @@ void checkStatus_7800() { #if (defined(ENABLE_OLED) || defined(ENABLE_LCD)) void printMapperSelection_7800(int index) { display_Clear(); - print_Msg(F("Mapper: ")); + print_Msg(FS(FSTRING_MAPPER)); a7800index = index * 3; a7800mapselect = pgm_read_byte(a7800mapsize + a7800index); println_Msg(a7800mapselect); diff --git a/Cart_Reader/ARC.ino b/Cart_Reader/ARC.ino index 921c884..d3c62a0 100644 --- a/Cart_Reader/ARC.ino +++ b/Cart_Reader/ARC.ino @@ -195,7 +195,7 @@ void setROMSize_ARC() { display.setCursor(0, 56); // Display selection at bottom } - print_Msg(F("ROM SIZE ")); + print_Msg(FS(FSTRING_ROM_SIZE)); print_Msg(ARC[newarcsize]); println_Msg(F("K")); display_Update(); @@ -244,7 +244,7 @@ void checkStatus_ARC() { println_Msg(F("ARCADIA 2001 READER")); println_Msg(FS(FSTRING_CURRENT_SETTINGS)); println_Msg(FS(FSTRING_EMPTY)); - print_Msg(F("ROM SIZE: ")); + print_Msg(FS(FSTRING_ROM_SIZE)); print_Msg(ARC[arcsize]); println_Msg(F("K")); display_Update(); diff --git a/Cart_Reader/C64.ino b/Cart_Reader/C64.ino index a6a943f..cac9258 100644 --- a/Cart_Reader/C64.ino +++ b/Cart_Reader/C64.ino @@ -562,7 +562,7 @@ void readROM_C64() { #if (defined(ENABLE_OLED) || defined(ENABLE_LCD)) void printMapperSelection_C64(int index) { display_Clear(); - print_Msg(F("Mapper: ")); + print_Msg(FS(FSTRING_MAPPER)); c64index = index * 3; c64mapselect = pgm_read_byte(c64mapsize + c64index); println_Msg(c64mapselect); @@ -645,7 +645,7 @@ void setROMSize_C64() { display.setCursor(0, 56); // Display selection at bottom } - print_Msg(F("ROM SIZE ")); + print_Msg(FS(FSTRING_ROM_SIZE)); print_Msg(C64[newc64size]); println_Msg(F("K")); display_Update(); diff --git a/Cart_Reader/COLV.ino b/Cart_Reader/COLV.ino index 2298595..8b852ca 100644 --- a/Cart_Reader/COLV.ino +++ b/Cart_Reader/COLV.ino @@ -222,7 +222,7 @@ void setROMSize_COL() { display.setCursor(0, 56); // Display selection at bottom } - print_Msg(F("ROM SIZE ")); + print_Msg(FS(FSTRING_ROM_SIZE)); print_Msg(pgm_read_byte(&(COL[newcolsize]))); println_Msg(F("K")); display_Update(); @@ -271,7 +271,7 @@ void checkStatus_COL() { println_Msg(F("COLECOVISION READER")); println_Msg(FS(FSTRING_CURRENT_SETTINGS)); println_Msg(FS(FSTRING_EMPTY)); - print_Msg(F("ROM SIZE: ")); + print_Msg(FS(FSTRING_ROM_SIZE)); print_Msg(pgm_read_byte(&(COL[colsize]))); println_Msg(F("K")); println_Msg(FS(FSTRING_EMPTY)); @@ -325,7 +325,7 @@ void readDataLine_COL(FsFile& database, void* entry) { void printDataLine_COL(void* entry) { struct database_entry_COL* castEntry = (database_entry_COL*)entry; - print_Msg(F("Size: ")); + print_Msg(FS(FSTRING_SIZE)); print_Msg(castEntry->gameSize); println_Msg(F("KB")); } diff --git a/Cart_Reader/FAIRCHILD.ino b/Cart_Reader/FAIRCHILD.ino index 4961e45..ca1fe73 100644 --- a/Cart_Reader/FAIRCHILD.ino +++ b/Cart_Reader/FAIRCHILD.ino @@ -527,7 +527,7 @@ void setROMSize_FAIRCHILD() { display.setCursor(0, 56); // Display selection at bottom } - print_Msg(F("ROM SIZE ")); + print_Msg(FS(FSTRING_ROM_SIZE)); print_Msg(FAIRCHILD[newfairchildsize]); println_Msg(F("K")); display_Update(); @@ -576,7 +576,7 @@ void checkStatus_FAIRCHILD() { println_Msg(F("CHANNEL F READER")); println_Msg(FS(FSTRING_CURRENT_SETTINGS)); println_Msg(FS(FSTRING_EMPTY)); - print_Msg(F("ROM SIZE: ")); + print_Msg(FS(FSTRING_ROM_SIZE)); print_Msg(FAIRCHILD[fairchildsize]); println_Msg(F("K")); display_Update(); diff --git a/Cart_Reader/GB.ino b/Cart_Reader/GB.ino index eafea41..4032d75 100644 --- a/Cart_Reader/GB.ino +++ b/Cart_Reader/GB.ino @@ -605,7 +605,7 @@ void showCartInfo_GB() { print_Msg(F("Revision: ")); println_Msg(romVersion); - print_Msg(F("Mapper: ")); + print_Msg(FS(FSTRING_MAPPER)); if ((romType == 0) || (romType == 8) || (romType == 9)) print_Msg(F("none")); else if ((romType == 1) || (romType == 2) || (romType == 3)) diff --git a/Cart_Reader/INTV.ino b/Cart_Reader/INTV.ino index 7ecde98..8c945fe 100644 --- a/Cart_Reader/INTV.ino +++ b/Cart_Reader/INTV.ino @@ -464,7 +464,7 @@ void ecsBank(uint32_t addr, uint8_t bank) { #if (defined(ENABLE_OLED) || defined(ENABLE_LCD)) void printMapperSelection_INTV(int index) { display_Clear(); - print_Msg(F("Mapper: ")); + print_Msg(FS(FSTRING_MAPPER)); intvindex = index * 4; intvmapselect = pgm_read_byte(intvmapsize + intvindex); println_Msg(intvmapselect); @@ -540,7 +540,7 @@ void setROMSize_INTV() { display.setCursor(0, 56); // Display selection at bottom } - print_Msg(F("ROM SIZE ")); + print_Msg(FS(FSTRING_ROM_SIZE)); print_Msg(pgm_read_byte(&(INTV[newintvsize]))); println_Msg(F("K")); display_Update(); @@ -596,7 +596,7 @@ void checkStatus_INTV() { println_Msg(FS(FSTRING_EMPTY)); print_Msg(F("MAPPER: ")); println_Msg(intvmapper); - print_Msg(F("ROM SIZE: ")); + print_Msg(FS(FSTRING_ROM_SIZE)); print_Msg(pgm_read_byte(&(INTV[intvsize]))); println_Msg(F("K")); display_Update(); @@ -660,10 +660,10 @@ void readDataLine_INTV(FsFile& database, void* entry) { void printDataLine_INTV(void* entry) { struct database_entry_INTV* castEntry = (database_entry_INTV*)entry; - print_Msg(F("Size: ")); + print_Msg(FS(FSTRING_SIZE)); print_Msg(castEntry->gameSize); println_Msg(F("KB")); - print_Msg(F("Mapper: ")); + print_Msg(FS(FSTRING_MAPPER)); println_Msg(castEntry->gameMapper); } diff --git a/Cart_Reader/LOOPY.ino b/Cart_Reader/LOOPY.ino index c4065cb..65515c8 100644 --- a/Cart_Reader/LOOPY.ino +++ b/Cart_Reader/LOOPY.ino @@ -498,7 +498,7 @@ void getCartInfo_LOOPY() { println_Msg(loopyRomNameLong); print_Msg(F("Checksum: ")); println_Msg(checksumStr); - print_Msg(F("Size: ")); + print_Msg(FS(FSTRING_SIZE)); print_Msg(cartSize * 8 / 1024 / 1024); println_Msg(F(" MBit")); print_Msg(F("Sram: ")); diff --git a/Cart_Reader/MD.ino b/Cart_Reader/MD.ino index ab78674..6e3ee38 100644 --- a/Cart_Reader/MD.ino +++ b/Cart_Reader/MD.ino @@ -1306,7 +1306,7 @@ void getCartInfo_MD() { print_Msg(F("bramSize(KB): ")); println_Msg(bramSize >> 10); } - print_Msg(F("Size: ")); + print_Msg(FS(FSTRING_SIZE)); print_Msg(cartSize * 8 / 1024 / 1024); switch (SnKmode) { case 2: diff --git a/Cart_Reader/MSX.ino b/Cart_Reader/MSX.ino index bc848c9..51dbe95 100644 --- a/Cart_Reader/MSX.ino +++ b/Cart_Reader/MSX.ino @@ -821,7 +821,7 @@ void writeRAM_MSX() { #if (defined(ENABLE_OLED) || defined(ENABLE_LCD)) void printMapperSelection_MSX(int index) { display_Clear(); - print_Msg(F("Mapper: ")); + print_Msg(FS(FSTRING_MAPPER)); msxindex = index * 5; msxmapselect = pgm_read_byte(msxmapsize + msxindex); println_Msg(msxmapselect); @@ -950,7 +950,7 @@ void setROMSize_MSX() { } display.setCursor(0, 56); // Display selection at bottom } - print_Msg(F("ROM SIZE ")); + print_Msg(FS(FSTRING_ROM_SIZE)); if (msxmapper == 12) // R-Type print_Msg(F("384")); else @@ -1143,7 +1143,7 @@ void checkStatus_MSX() { print_Msg(F("MAPPER: ")); println_Msg(msxmapper); printMapper(msxmapper); - print_Msg(F("ROM SIZE: ")); + print_Msg(FS(FSTRING_ROM_SIZE)); if (msxmapper == 12) // R-Type print_Msg(F("384")); else diff --git a/Cart_Reader/NES.ino b/Cart_Reader/NES.ino index e9f7c82..3115418 100644 --- a/Cart_Reader/NES.ino +++ b/Cart_Reader/NES.ino @@ -996,7 +996,7 @@ void CreateRAMFileInSD() { void printMapperSelection_NES(int index) { display_Clear(); mapselect = pgm_read_word(mapsize + index); - print_Msg(F("Mapper: ")); + print_Msg(FS(FSTRING_MAPPER)); println_Msg(mapselect); } #endif diff --git a/Cart_Reader/ODY2.ino b/Cart_Reader/ODY2.ino index 5559bb1..aca0464 100644 --- a/Cart_Reader/ODY2.ino +++ b/Cart_Reader/ODY2.ino @@ -273,7 +273,7 @@ void setROMSize_ODY2() { display.setCursor(0, 56); // Display selection at bottom } - print_Msg(F("ROM SIZE ")); + print_Msg(FS(FSTRING_ROM_SIZE)); print_Msg(ODY2[newody2size]); println_Msg(F("K")); display_Update(); @@ -329,7 +329,7 @@ void checkStatus_ODY2() { println_Msg(FS(FSTRING_EMPTY)); print_Msg(F("MAPPER: ")); println_Msg(ody2mapper); - print_Msg(F("ROM SIZE: ")); + print_Msg(FS(FSTRING_ROM_SIZE)); print_Msg(ODY2[ody2size]); println_Msg(F("K")); display_Update(); diff --git a/Cart_Reader/OSCR.cpp b/Cart_Reader/OSCR.cpp index 9bdf395..3370297 100644 --- a/Cart_Reader/OSCR.cpp +++ b/Cart_Reader/OSCR.cpp @@ -72,6 +72,9 @@ constexpr char PROGMEM FSTRING_SELECT_CART[] = "Select Cart"; constexpr char PROGMEM FSTRING_SELECT_CART_TYPE[] = "Select Cart Type"; constexpr char PROGMEM FSTRING_SET_SIZE[] = "Set Size"; constexpr char PROGMEM FSTRING_REFRESH_CART[] = "Refresh Cart"; +constexpr char PROGMEM FSTRING_MAPPER[] = "Mapper: "; +constexpr char PROGMEM FSTRING_SIZE[] = "Size: "; +constexpr char PROGMEM FSTRING_ROM_SIZE[] ="ROM SIZE: "; /*==== /CONSTANTS =================================================*/ diff --git a/Cart_Reader/OSCR.h b/Cart_Reader/OSCR.h index 9239acf..1a4ff98 100644 --- a/Cart_Reader/OSCR.h +++ b/Cart_Reader/OSCR.h @@ -52,6 +52,9 @@ extern const char PROGMEM FSTRING_SELECT_CART[]; extern const char PROGMEM FSTRING_SELECT_CART_TYPE[]; extern const char PROGMEM FSTRING_SET_SIZE[]; extern const char PROGMEM FSTRING_REFRESH_CART[]; +extern const char PROGMEM FSTRING_MAPPER[]; +extern const char PROGMEM FSTRING_SIZE[]; +extern const char PROGMEM FSTRING_ROM_SIZE[]; #define FS(pmem_string) (reinterpret_cast(pmem_string)) diff --git a/Cart_Reader/SFM.ino b/Cart_Reader/SFM.ino index 80a4543..fa32782 100644 --- a/Cart_Reader/SFM.ino +++ b/Cart_Reader/SFM.ino @@ -745,7 +745,7 @@ void getCartInfo_SFM() { print_Msg(F("Checksum: ")); println_Msg(checksumStr); - print_Msg(F("Size: ")); + print_Msg(FS(FSTRING_SIZE)); print_Msg(romSize); println_Msg(F("Mbit ")); diff --git a/Cart_Reader/SMS.ino b/Cart_Reader/SMS.ino index c2366cf..a1680ae 100644 --- a/Cart_Reader/SMS.ino +++ b/Cart_Reader/SMS.ino @@ -527,7 +527,7 @@ void getCartInfo_SMS() { println_Msg(FS(FSTRING_SPACE)); print_Msg(F("Name: ")); println_Msg(romName); - print_Msg(F("Size: ")); + print_Msg(FS(FSTRING_SIZE)); print_Msg(cartSize / 1024); println_Msg(F("KB")); println_Msg(FS(FSTRING_SPACE)); diff --git a/Cart_Reader/SNES.ino b/Cart_Reader/SNES.ino index c2cad1f..3fb5d8f 100644 --- a/Cart_Reader/SNES.ino +++ b/Cart_Reader/SNES.ino @@ -933,7 +933,7 @@ void checkAltConf(char crcStr[9]) { if (((romSize != romSize2) || (numBanks != numBanks2)) && ((romSize2 == 10) || (romSize2 == 12) || (romSize2 == 20) || (romSize2 == 24) || (romSize2 == 40) || (romSize2 == 48))) { // Correct size println_Msg(F("Correcting size")); - print_Msg(F("Size: ")); + print_Msg(FS(FSTRING_SIZE)); print_Msg(romSize); print_Msg(F(" -> ")); print_Msg(romSize2); diff --git a/Cart_Reader/VBOY.ino b/Cart_Reader/VBOY.ino index 8212e7f..7abe8c2 100644 --- a/Cart_Reader/VBOY.ino +++ b/Cart_Reader/VBOY.ino @@ -383,7 +383,7 @@ void getCartInfo_VB() { println_Msg(FS(FSTRING_SPACE)); print_Msg(F("Name: ")); println_Msg(romName); - print_Msg(F("Size: ")); + print_Msg(FS(FSTRING_SIZE)); print_Msg(cartSize * 8 / 1024 / 1024); println_Msg(F(" MBit")); print_Msg(F("Sram: ")); diff --git a/Cart_Reader/VECTREX.ino b/Cart_Reader/VECTREX.ino index ee9bcb4..f5dba3b 100644 --- a/Cart_Reader/VECTREX.ino +++ b/Cart_Reader/VECTREX.ino @@ -254,7 +254,7 @@ void setROMSize_VECTREX() { display.setCursor(0, 56); // Display selection at bottom } - print_Msg(F("ROM SIZE ")); + print_Msg(FS(FSTRING_ROM_SIZE)); print_Msg(VECTREX[newvectrexsize]); println_Msg(F("KB")); display_Update(); @@ -303,13 +303,13 @@ void checkStatus_VECTREX() { println_Msg(F("VECTREX READER")); println_Msg(FS(FSTRING_CURRENT_SETTINGS)); println_Msg(FS(FSTRING_EMPTY)); - print_Msg(F("ROM SIZE: ")); + print_Msg(FS(FSTRING_ROM_SIZE)); print_Msg(VECTREX[vectrexsize]); println_Msg(F("KB")); display_Update(); wait(); #else - Serial.print(F("ROM SIZE: ")); + Serial.print(FS(FSTRING_ROM_SIZE)); Serial.print(VECTREX[vectrexsize]); Serial.println(F("KB")); Serial.println(FS(FSTRING_EMPTY)); diff --git a/Cart_Reader/WSV.ino b/Cart_Reader/WSV.ino index d326cf3..7360875 100644 --- a/Cart_Reader/WSV.ino +++ b/Cart_Reader/WSV.ino @@ -238,7 +238,7 @@ void setROMSize_WSV() { display.setCursor(0, 56); // Display selection at bottom } - print_Msg(F("ROM SIZE ")); + print_Msg(FS(FSTRING_ROM_SIZE)); print_Msg(pgm_read_word(&(WSV[newwsvsize]))); println_Msg(F("K")); display_Update(); @@ -287,7 +287,7 @@ void checkStatus_WSV() { println_Msg(F("WATARA SUPERVISION")); println_Msg(FS(FSTRING_CURRENT_SETTINGS)); println_Msg(FS(FSTRING_EMPTY)); - print_Msg(F("ROM SIZE: ")); + print_Msg(FS(FSTRING_ROM_SIZE)); print_Msg(pgm_read_word(&(WSV[wsvsize]))); println_Msg(F("K")); display_Update(); @@ -336,7 +336,7 @@ void readDataLine_WSV(FsFile& database, void* entry) { void printDataLine_WSV(void* entry) { struct database_entry_WSV* castEntry = (database_entry_WSV*)entry; - print_Msg(F("Size: ")); + print_Msg(FS(FSTRING_SIZE)); if (castEntry->gameSize == 51) print_Msg(F("512")); else