Now reports when no save has been found on "Flash ROM and save"

(cherry picked from commit 9cf556d981b218c1bd7f56b30cc6afada593a0cf)
This commit is contained in:
Dakkaron 2021-07-02 14:18:56 +02:00
parent f554adccce
commit 233b89fc91

View File

@ -173,15 +173,16 @@ void gbMenu() {
} }
} }
sprintf(filePath, "/GB/SAVE/%s/", fileName); sprintf(filePath, "/GB/SAVE/%s/", fileName);
bool saveFound=false;
if (sd.exists(filePath)) { if (sd.exists(filePath)) {
println_Msg(F("Save folder found"));
EEPROM_readAnything(0, foldern); EEPROM_readAnything(0, foldern);
for (int i=foldern;i>=0;i--) { for (int i=foldern;i>=0;i--) {
sprintf(filePath, "/GB/SAVE/%s/%d/%s.SAV", fileName, i, fileName); sprintf(filePath, "/GB/SAVE/%s/%d/%s.SAV", fileName, i, fileName);
if (sd.exists(filePath)) { if (sd.exists(filePath)) {
print_Msg(F("Save slot ")); print_Msg(F("Save number "));
print_Msg(i); print_Msg(i);
println_Msg(F(" found.")); println_Msg(F(" found."));
saveFound=true;
sprintf(filePath, "/GB/SAVE/%s/%d", fileName, i); sprintf(filePath, "/GB/SAVE/%s/%d", fileName, i);
sprintf(fileName, "%s.SAV", fileName); sprintf(fileName, "%s.SAV", fileName);
writeSRAM_GB(); writeSRAM_GB();
@ -197,9 +198,13 @@ void gbMenu() {
println_Msg(F(" bytes ")); println_Msg(F(" bytes "));
print_Error(F("did not verify."), false); print_Error(F("did not verify."), false);
} }
break;
} }
} }
} }
if (!saveFound) {
println_Msg(F("Error: No save found."));
}
} }
else { else {
print_Error(F("Cart has no Sram"), false); print_Error(F("Cart has no Sram"), false);