N64.ino: Build eeprom path and file name with snprintf_P

So the format string is stored in flash rather than in ram.
The gain from doing just one like this is not much, to be done in more
places.
This commit is contained in:
Vincent Pelletier 2022-10-28 13:03:01 +00:00
parent a43b2553cd
commit d9daadb1f9

View File

@ -50,6 +50,9 @@ String CRC1 = "";
String CRC2 = "";
#endif
static const char N64_EEP_FILENAME_FMT[] PROGMEM = "%s.eep";
static const char N64_SAVE_DIRNAME_FMT[] PROGMEM = "N64/SAVE/%s/%d";
/******************************************
Menu
*****************************************/
@ -2687,12 +2690,11 @@ void writeEeprom() {
void readEeprom() {
if ((saveType == 5) || (saveType == 6)) {
// Get name, add extension and convert to char array for sd lib
strcpy(fileName, romName);
strcat(fileName, ".eep");
snprintf_P(fileName, sizeof(fileName), N64_EEP_FILENAME_FMT, romName);
// create a new folder for the save file
EEPROM_readAnything(0, foldern);
sprintf(folder, "N64/SAVE/%s/%d", romName, foldern);
snprintf_P(folder, sizeof(folder), N64_SAVE_DIRNAME_FMT, romName, foldern);
sd.mkdir(folder, true);
sd.chdir(folder);