Revert NES CreateRAMFileInSD function to previous version

This commit is contained in:
sanni 2023-06-26 15:46:47 +02:00
parent 3a2db439be
commit 0489df7bd4
3 changed files with 31 additions and 2 deletions

View File

@ -2081,8 +2081,10 @@ void setup() {
#endif #endif
#endif #endif
#ifdef ENABLE_VSELECT
// Set power to low to protect carts // Set power to low to protect carts
setVoltage(VOLTS_SET_3V3); setVoltage(VOLTS_SET_3V3);
#endif
#ifdef enable_OLED #ifdef enable_OLED
display.begin(); display.begin();

View File

@ -267,7 +267,7 @@
* other than HW5 and HW3. * other than HW5 and HW3.
*/ */
#define ENABLE_UPDATER //#define ENABLE_UPDATER
/****/ /****/

View File

@ -1178,8 +1178,35 @@ void CreateCHRFileInSD() {
myFile = createNewFile("CHR", "bin"); myFile = createNewFile("CHR", "bin");
} }
//createNewFile fails to dump RAM if ROM isn't dumped first
//void CreateRAMFileInSD() {
//myFile = createNewFile("RAM", "bin");
//}
//Temporary fix
void CreateRAMFileInSD() { void CreateRAMFileInSD() {
myFile = createNewFile("RAM", "bin"); char fileCount[3];
strcpy(fileName, "RAM");
strcat(fileName, ".bin");
for (byte i = 0; i < 100; i++) {
if (!sd.exists(fileName)) {
myFile = sd.open(fileName, O_RDWR | O_CREAT);
break;
}
sprintf(fileCount, "%02d", i);
strcpy(fileName, "RAM.");
strcat(fileName, fileCount);
strcat(fileName, ".bin");
}
if (!myFile) {
LED_RED_ON;
display_Clear();
println_Msg(F("RAM FILE FAILED!"));
display_Update();
//print_Error(F("SD Error"), true);
LED_RED_OFF;
}
} }
#ifndef nointro #ifndef nointro