mirror of
https://github.com/sanni/cartreader.git
synced 2024-11-30 00:14:15 +01:00
add option to clear display and remove duplicate code
This commit is contained in:
parent
6abe29fcd9
commit
41182a7eb0
@ -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))
|
||||
|
@ -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))
|
||||
|
@ -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))
|
||||
|
@ -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)) {
|
||||
|
@ -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))
|
||||
|
@ -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))
|
||||
|
@ -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("/..."));
|
||||
|
@ -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)) {
|
||||
|
@ -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)) {
|
||||
|
@ -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)) {
|
||||
|
@ -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)) {
|
||||
|
@ -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))
|
||||
|
@ -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);
|
||||
|
@ -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)) {
|
||||
|
@ -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))
|
||||
|
@ -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)) {
|
||||
|
@ -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))
|
||||
|
@ -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)) {
|
||||
|
@ -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))
|
||||
|
@ -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)) {
|
||||
|
@ -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)) {
|
||||
|
@ -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)) {
|
||||
|
@ -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);
|
||||
|
@ -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)) {
|
||||
|
@ -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);
|
||||
|
@ -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))
|
||||
|
@ -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);
|
||||
|
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user