replace custom folder creation function with common

This commit is contained in:
smesgr9000 2024-05-26 21:48:57 +02:00
parent 41182a7eb0
commit 78bf1462d0
2 changed files with 10 additions and 54 deletions

View File

@ -4194,22 +4194,8 @@ void resetGameshark_N64() {
// Read rom and save to the SD card
void backupGameshark_N64() {
// create a new folder
EEPROM_readAnything(0, foldern);
sprintf(fileName, "GS%d", foldern);
strcat(fileName, ".z64");
sd.mkdir("N64/ROM/Gameshark", true);
sd.chdir("N64/ROM/Gameshark");
display_Clear();
print_Msg(F("Saving "));
print_Msg(fileName);
println_Msg(F("..."));
display_Update();
// write new folder number back to eeprom
foldern = foldern + 1;
EEPROM_writeAnything(0, foldern);
createFolder("N64", "ROM", "GameShark", "z64");
printAndIncrementFolder(true);
// Open file on sd card
if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
@ -4577,21 +4563,8 @@ void resetXplorer_N64() {
// Read rom and save to the SD card
void backupXplorer_N64() {
// create a new folder
EEPROM_readAnything(0, foldern);
sprintf(fileName, "XP64-%d", foldern);
strcat(fileName, ".z64");
sd.mkdir("N64/ROM/XPLORER64", true);
sd.chdir("N64/ROM/XPLORER64");
display_Clear();
print_Msg(F("Saving "));
print_Msg(fileName);
println_Msg(F("..."));
display_Update();
// write new folder number back to eeprom
foldern = foldern + 1;
EEPROM_writeAnything(0, foldern);
createFolder("N64", "ROM", "XPLORER64", "z64");
printAndIncrementFolder(true);
// Open file on sd card
if (!myFile.open(fileName, O_RDWR | O_CREAT)) {

View File

@ -148,15 +148,10 @@ void suprAcanMenu() {
static void readROM_Acan() {
uint32_t crc32 = 0xffffffff;
EEPROM_readAnything(0, foldern);
snprintf(folder, FILEPATH_LENGTH, "/ACAN/ROM/%d", foldern);
createFolder("/ACAN", "ROM", "rom", "bin");
printAndIncrementFolder(true);
sd.mkdir(folder, true);
sd.chdir(folder);
if (!myFile.open("rom.bin", O_RDWR | O_CREAT))
if (!myFile.open(fileName, O_RDWR | O_CREAT))
print_FatalError(create_file_STR);
draw_progressbar(0, cartSize);
@ -185,16 +180,10 @@ static void readROM_Acan() {
}
static void readSRAM_Acan() {
// create a new folder for storing rom file
EEPROM_readAnything(0, foldern);
snprintf(folder, FILEPATH_LENGTH, "/ACAN/SAVE/%d", foldern);
createFolder("/ACAN", "SAVE", "save", "bin");
printAndIncrementFolder(true);
sd.mkdir(folder, true);
sd.chdir(folder);
if (!myFile.open("save.bin", O_RDWR | O_CREAT))
if (!myFile.open(fileName, O_RDWR | O_CREAT))
print_FatalError(create_file_STR);
dataIn_MD();
@ -276,16 +265,10 @@ static void verifySRAM_Acan() {
}
static void readUM6650() {
// create a new folder for storing rom file
EEPROM_readAnything(0, foldern);
snprintf(folder, sizeof(folder), "/ACAN/UM6650/%d", foldern);
createFolder("/ACAN", "UM6650", "UM6650", "bin");
printAndIncrementFolder(true);
sd.mkdir(folder, true);
sd.chdir(folder);
if (!myFile.open("UM6650.bin", O_RDWR | O_CREAT))
if (!myFile.open(fileName, O_RDWR | O_CREAT))
print_FatalError(create_file_STR);
for (uint16_t i = 0; i < 256; i++) {