aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorsmesgr9000 <smesgr9000>2024-05-25 14:25:35 +0200
committersmesgr9000 <smesgr9000>2024-05-25 14:25:35 +0200
commit41182a7eb07307e5151218cfa69eaa965e766816 (patch)
tree967fd80feddc3e7d4d7d7b1efed9348d26c613b9
parent6abe29fcd9b30e45c539876a57634aa840f77a58 (diff)
downloadcartreader-41182a7eb07307e5151218cfa69eaa965e766816.tar.gz
cartreader-41182a7eb07307e5151218cfa69eaa965e766816.zip
add option to clear display and remove duplicate code
-rw-r--r--Cart_Reader/2600.ino3
-rw-r--r--Cart_Reader/5200.ino3
-rw-r--r--Cart_Reader/7800.ino3
-rw-r--r--Cart_Reader/ARC.ino3
-rw-r--r--Cart_Reader/C64.ino3
-rw-r--r--Cart_Reader/COLV.ino3
-rw-r--r--Cart_Reader/Cart_Reader.ino5
-rw-r--r--Cart_Reader/FAIRCHILD.ino3
-rw-r--r--Cart_Reader/GB.ino9
-rw-r--r--Cart_Reader/GBA.ino4
-rw-r--r--Cart_Reader/GPC.ino3
-rw-r--r--Cart_Reader/INTV.ino3
-rw-r--r--Cart_Reader/LOOPY.ino3
-rw-r--r--Cart_Reader/MD.ino6
-rw-r--r--Cart_Reader/MSX.ino3
-rw-r--r--Cart_Reader/NES.ino3
-rw-r--r--Cart_Reader/NGP.ino3
-rw-r--r--Cart_Reader/ODY2.ino3
-rw-r--r--Cart_Reader/POKEMINI.ino3
-rw-r--r--Cart_Reader/SMS.ino6
-rw-r--r--Cart_Reader/SNES.ino4
-rw-r--r--Cart_Reader/ST.ino3
-rw-r--r--Cart_Reader/SUPRACAN.ino9
-rw-r--r--Cart_Reader/SV.ino3
-rw-r--r--Cart_Reader/VBOY.ino3
-rw-r--r--Cart_Reader/VECTREX.ino3
-rw-r--r--Cart_Reader/WS.ino9
-rw-r--r--Cart_Reader/WSV.ino3
28 files changed, 39 insertions, 73 deletions
diff --git a/Cart_Reader/2600.ino b/Cart_Reader/2600.ino
index 883051d..1d13d16 100644
--- a/Cart_Reader/2600.ino
+++ b/Cart_Reader/2600.ino
@@ -298,8 +298,7 @@ boolean checkE7(uint16_t bank) {
void readROM_2600() {
createFolder("ATARI", "ROM", romName, "a26");
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
// open file on sdcard
if (!myFile.open(fileName, O_RDWR | O_CREAT))
diff --git a/Cart_Reader/5200.ino b/Cart_Reader/5200.ino
index a3f6f9d..6e488ea 100644
--- a/Cart_Reader/5200.ino
+++ b/Cart_Reader/5200.ino
@@ -218,8 +218,7 @@ void readSegment_5200(uint16_t startaddr, uint16_t endaddr) {
void readROM_5200() {
createFolder("5200", "ROM", romName, "a52");
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
// open file on sdcard
if (!myFile.open(fileName, O_RDWR | O_CREAT))
diff --git a/Cart_Reader/7800.ino b/Cart_Reader/7800.ino
index b09b231..e446230 100644
--- a/Cart_Reader/7800.ino
+++ b/Cart_Reader/7800.ino
@@ -344,8 +344,7 @@ void bankSwitch_7800(uint16_t addr) {
void readROM_7800() {
createFolder("7800", "ROM", romName, "a78");
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
// open file on sdcard
if (!myFile.open(fileName, O_RDWR | O_CREAT))
diff --git a/Cart_Reader/ARC.ino b/Cart_Reader/ARC.ino
index 943741c..a2345b8 100644
--- a/Cart_Reader/ARC.ino
+++ b/Cart_Reader/ARC.ino
@@ -152,8 +152,7 @@ void readSegment_ARC(uint16_t startaddr, uint16_t endaddr) {
void readROM_ARC() {
createFolder("ARC", "ROM", romName, "bin");
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
// open file on sdcard
if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
diff --git a/Cart_Reader/C64.ino b/Cart_Reader/C64.ino
index dc88923..6ea33cf 100644
--- a/Cart_Reader/C64.ino
+++ b/Cart_Reader/C64.ino
@@ -366,8 +366,7 @@ void readPorts_C64() {
void readROM_C64() {
createFolder("C64", "ROM", romName, "bin");
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
// open file on sdcard
if (!myFile.open(fileName, O_RDWR | O_CREAT))
diff --git a/Cart_Reader/COLV.ino b/Cart_Reader/COLV.ino
index fd5ad45..ca866ab 100644
--- a/Cart_Reader/COLV.ino
+++ b/Cart_Reader/COLV.ino
@@ -164,8 +164,7 @@ void readSegment_COL(uint32_t startaddr, uint32_t endaddr) {
void readROM_COL() {
createFolder("COL", "ROM", romName, "col");
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
// open file on sdcard
if (!myFile.open(fileName, O_RDWR | O_CREAT))
diff --git a/Cart_Reader/Cart_Reader.ino b/Cart_Reader/Cart_Reader.ino
index 611f6a3..0e9bb09 100644
--- a/Cart_Reader/Cart_Reader.ino
+++ b/Cart_Reader/Cart_Reader.ino
@@ -678,8 +678,11 @@ void createFolder(const char* system, const char* subfolder, const char* gameNam
sd.chdir(folder);
}
-void printAndIncrementFolder() {
+void printAndIncrementFolder(bool displayClear = false) {
// Save location
+ if(displayClear) {
+ display_Clear();
+ }
print_STR(saving_to_STR, 0);
print_Msg(folder);
println_Msg(F("/..."));
diff --git a/Cart_Reader/FAIRCHILD.ino b/Cart_Reader/FAIRCHILD.ino
index d2120ac..3b02e94 100644
--- a/Cart_Reader/FAIRCHILD.ino
+++ b/Cart_Reader/FAIRCHILD.ino
@@ -394,8 +394,7 @@ uint8_t readData_FAIRCHILD() {
void readROM_FAIRCHILD() {
createFolder("FAIRCHILD", "ROM", romName, "bin");
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
// open file on sdcard
if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
diff --git a/Cart_Reader/GB.ino b/Cart_Reader/GB.ino
index e77e694..1654541 100644
--- a/Cart_Reader/GB.ino
+++ b/Cart_Reader/GB.ino
@@ -1109,8 +1109,7 @@ void readROM_GB() {
// Get name, add extension and convert to char array for sd lib
createFolder("GB", "ROM", romName, "gb");
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
//open file on sd card
if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
@@ -1457,8 +1456,7 @@ void readSRAMFLASH_MBC6_GB() {
// Get name, add extension and convert to char array for sd lib
createFolder("GB", "SAVE", romName, "sav");
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
//open file on sd card
if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
@@ -2528,8 +2526,7 @@ void readPelican_GB() {
// Get name, add extension and convert to char array for sd lib
createFolder("GB", "ROM", "Pelican", "GB");
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
//open file on sd card
if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
diff --git a/Cart_Reader/GBA.ino b/Cart_Reader/GBA.ino
index 6e2b55d..530cc84 100644
--- a/Cart_Reader/GBA.ino
+++ b/Cart_Reader/GBA.ino
@@ -823,9 +823,7 @@ void readROM_GBA() {
// Get name, add extension and convert to char array for sd lib
createFolder("GBA", "ROM", romName, "gba");
- //clear the screen
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
//open file on sd card
if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
diff --git a/Cart_Reader/GPC.ino b/Cart_Reader/GPC.ino
index 629609a..7240f03 100644
--- a/Cart_Reader/GPC.ino
+++ b/Cart_Reader/GPC.ino
@@ -271,8 +271,7 @@ void readRAM_GPC() {
createFolder("SNES", "ROM", "GPC4M", "sfc");
//clear the screen
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
//open file on sd card
if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
diff --git a/Cart_Reader/INTV.ino b/Cart_Reader/INTV.ino
index e593ce1..f5564a6 100644
--- a/Cart_Reader/INTV.ino
+++ b/Cart_Reader/INTV.ino
@@ -305,8 +305,7 @@ void readSegment_INTV(uint32_t startaddr, uint32_t endaddr) {
void readROM_INTV() {
createFolder("INTV", "ROM", romName, "int");
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
// open file on sdcard
if (!myFile.open(fileName, O_RDWR | O_CREAT))
diff --git a/Cart_Reader/LOOPY.ino b/Cart_Reader/LOOPY.ino
index 21574e1..3b6c45c 100644
--- a/Cart_Reader/LOOPY.ino
+++ b/Cart_Reader/LOOPY.ino
@@ -524,8 +524,7 @@ void readROM_LOOPY() {
createFolder("LOOPY", "ROM", romName, "bin");
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
print_FatalError(sd_error_STR);
diff --git a/Cart_Reader/MD.ino b/Cart_Reader/MD.ino
index b216fdd..b70b3bb 100644
--- a/Cart_Reader/MD.ino
+++ b/Cart_Reader/MD.ino
@@ -1426,8 +1426,7 @@ void readROM_MD() {
// Get name, add extension and convert to char array for sd lib
createFolder("MD", "ROM", romName, "BIN");
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
// Open file on sd card
if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
@@ -2875,8 +2874,7 @@ void readRealtec_MD() {
// Get name, add extension and convert to char array for sd lib
createFolder("MD", "ROM", romName, "MD");
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
// Open file on sd card
if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
diff --git a/Cart_Reader/MSX.ino b/Cart_Reader/MSX.ino
index 7be291a..29747d4 100644
--- a/Cart_Reader/MSX.ino
+++ b/Cart_Reader/MSX.ino
@@ -345,8 +345,7 @@ void readROM_MSX() {
} else {
createFolder("MSX", "ROM", romName, "bin");
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
// open file on sdcard
if (!myFile.open(fileName, O_RDWR | O_CREAT))
diff --git a/Cart_Reader/NES.ino b/Cart_Reader/NES.ino
index 6ef2f14..7b05bf9 100644
--- a/Cart_Reader/NES.ino
+++ b/Cart_Reader/NES.ino
@@ -713,8 +713,7 @@ void read_NES(const char* fileSuffix, const byte* header, const uint8_t headersi
// Get name, add extension and convert to char array for sd lib
createFolder("NES", "ROM", romName, fileSuffix);
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
// Open file on sd card
if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
diff --git a/Cart_Reader/NGP.ino b/Cart_Reader/NGP.ino
index b0e9b46..c0f0744 100644
--- a/Cart_Reader/NGP.ino
+++ b/Cart_Reader/NGP.ino
@@ -214,8 +214,7 @@ void readROM_NGP(char* outPathBuf, size_t bufferSize) {
if (outPathBuf != NULL && bufferSize > 0)
snprintf(outPathBuf, bufferSize, "%s/%s", folder, fileName);
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
// open file on sdcard
if (!myFile.open(fileName, O_RDWR | O_CREAT))
diff --git a/Cart_Reader/ODY2.ino b/Cart_Reader/ODY2.ino
index 47edf40..94d7e3d 100644
--- a/Cart_Reader/ODY2.ino
+++ b/Cart_Reader/ODY2.ino
@@ -214,8 +214,7 @@ void bankSwitch_ODY2(uint16_t addr, uint8_t data) {
void readROM_ODY2() {
createFolder("ODY2", "ROM", romName, "bin");
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
// open file on sdcard
if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
diff --git a/Cart_Reader/POKEMINI.ino b/Cart_Reader/POKEMINI.ino
index bbbe5fa..89df9f3 100644
--- a/Cart_Reader/POKEMINI.ino
+++ b/Cart_Reader/POKEMINI.ino
@@ -241,8 +241,7 @@ void writeData_POKE(uint32_t addr, uint8_t data) {
void readROM_POKE() {
createFolder("POKE", "ROM", romName, "min");
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
// open file on sdcard
if (!myFile.open(fileName, O_RDWR | O_CREAT))
diff --git a/Cart_Reader/SMS.ino b/Cart_Reader/SMS.ino
index 977ccaa..bc30f0c 100644
--- a/Cart_Reader/SMS.ino
+++ b/Cart_Reader/SMS.ino
@@ -558,8 +558,7 @@ void readROM_SMS() {
createFolder("SG1000", "ROM", romName, "sg");
}
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
// Open file on sd card
if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
@@ -650,8 +649,7 @@ void readSRAM_SMS() {
}
createFolder(system, "SAVE", romName, "sav");
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
// Create file on sd card
if (myFile.open(fileName, O_RDWR | O_CREAT)) {
diff --git a/Cart_Reader/SNES.ino b/Cart_Reader/SNES.ino
index e961c3d..9826a20 100644
--- a/Cart_Reader/SNES.ino
+++ b/Cart_Reader/SNES.ino
@@ -1293,9 +1293,7 @@ void readROM_SNES() {
// Get name, add extension and convert to char array for sd lib
createFolder("SNES", "ROM", romName, "sfc");
- //clear the screen
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
//open file on sd card
if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
diff --git a/Cart_Reader/ST.ino b/Cart_Reader/ST.ino
index dd96b5d..046c66d 100644
--- a/Cart_Reader/ST.ino
+++ b/Cart_Reader/ST.ino
@@ -169,8 +169,7 @@ void readRom_ST(unsigned int bankStart, unsigned int bankEnd) {
// create a new folder to save rom file
createFolder("ST", "ROM", "SUFAMI_TURBO", "st");
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
//open file on sd card
if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
diff --git a/Cart_Reader/SUPRACAN.ino b/Cart_Reader/SUPRACAN.ino
index 6d737f7..c096f21 100644
--- a/Cart_Reader/SUPRACAN.ino
+++ b/Cart_Reader/SUPRACAN.ino
@@ -151,8 +151,7 @@ static void readROM_Acan() {
EEPROM_readAnything(0, foldern);
snprintf(folder, FILEPATH_LENGTH, "/ACAN/ROM/%d", foldern);
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
sd.mkdir(folder, true);
sd.chdir(folder);
@@ -190,8 +189,7 @@ static void readSRAM_Acan() {
EEPROM_readAnything(0, foldern);
snprintf(folder, FILEPATH_LENGTH, "/ACAN/SAVE/%d", foldern);
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
sd.mkdir(folder, true);
sd.chdir(folder);
@@ -282,8 +280,7 @@ static void readUM6650() {
EEPROM_readAnything(0, foldern);
snprintf(folder, sizeof(folder), "/ACAN/UM6650/%d", foldern);
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
sd.mkdir(folder, true);
sd.chdir(folder);
diff --git a/Cart_Reader/SV.ino b/Cart_Reader/SV.ino
index 9e36b03..98ef186 100644
--- a/Cart_Reader/SV.ino
+++ b/Cart_Reader/SV.ino
@@ -416,8 +416,7 @@ void readROM_SV() {
createFolder("SNES", "ROM", "MEMPACK", "bs");
//clear the screen
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
//open file on sd card
if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
diff --git a/Cart_Reader/VBOY.ino b/Cart_Reader/VBOY.ino
index bd68bd2..25cf14e 100644
--- a/Cart_Reader/VBOY.ino
+++ b/Cart_Reader/VBOY.ino
@@ -412,8 +412,7 @@ void readROM_VB() {
createFolder("VBOY", "ROM", romName, "vb");
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
print_FatalError(sd_error_STR);
diff --git a/Cart_Reader/VECTREX.ino b/Cart_Reader/VECTREX.ino
index a541d71..10c7dd1 100644
--- a/Cart_Reader/VECTREX.ino
+++ b/Cart_Reader/VECTREX.ino
@@ -198,8 +198,7 @@ void readSegment_VECTREX(uint16_t startaddr, uint16_t endaddr) {
void readROM_VECTREX() {
createFolder("VECTREX", "ROM", romName, "vec");
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
// open file on sdcard
if (!myFile.open(fileName, O_RDWR | O_CREAT))
diff --git a/Cart_Reader/WS.ino b/Cart_Reader/WS.ino
index f4617be..3ca1d63 100644
--- a/Cart_Reader/WS.ino
+++ b/Cart_Reader/WS.ino
@@ -489,8 +489,7 @@ static uint16_t readROM_WS(char *outPathBuf, size_t bufferSize) {
if (outPathBuf != NULL && bufferSize > 0)
snprintf(outPathBuf, bufferSize, "%s/%s", folder, fileName);
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
// open file on sdcard
if (!myFile.open(fileName, O_RDWR | O_CREAT))
@@ -556,8 +555,7 @@ static void readSRAM_WS() {
// generate fullname of rom file
createFolder("WS", "SAVE", romName, "save");
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
if (!myFile.open(fileName, O_RDWR | O_CREAT))
print_FatalError(create_file_STR);
@@ -689,8 +687,7 @@ static void readEEPROM_WS() {
// generate fullname of eep file
createFolder("WS", "SAVE", romName, "eep");
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
if (!myFile.open(fileName, O_RDWR | O_CREAT))
print_FatalError(create_file_STR);
diff --git a/Cart_Reader/WSV.ino b/Cart_Reader/WSV.ino
index 8b047f6..82b65f2 100644
--- a/Cart_Reader/WSV.ino
+++ b/Cart_Reader/WSV.ino
@@ -187,8 +187,7 @@ uint8_t readByte_WSV(uint32_t addr) {
void readROM_WSV() {
createFolder("WSV", "ROM", romName, "sv");
- display_Clear();
- printAndIncrementFolder();
+ printAndIncrementFolder(true);
// open file on sdcard
if (!myFile.open(fileName, O_RDWR | O_CREAT))