From cf820cfbbdd5d7f8179bd653bfa8bc3e1b71a147 Mon Sep 17 00:00:00 2001 From: sanni Date: Fri, 9 Aug 2024 15:35:30 +0200 Subject: [PATCH] Update FLASH.ino --- Cart_Reader/FLASH.ino | 12 ++++++++++-- Cart_Reader/SNES.ino | 15 ++++++++------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Cart_Reader/FLASH.ino b/Cart_Reader/FLASH.ino index 81d90e80..b6ca00da 100644 --- a/Cart_Reader/FLASH.ino +++ b/Cart_Reader/FLASH.ino @@ -178,6 +178,7 @@ void flashromMenu8() { print_STR(press_button_STR, 1); display_Update(); wait(); + rgbLed(black_color); println_Msg(FS(FSTRING_EMPTY)); println_Msg(F("Please wait...")); display_Update(); @@ -2883,7 +2884,8 @@ void adjustFileSizeOffset(byte currChip, byte totalChips, boolean reversed) { } else if (fileSize > flashSize / 2) { fileSize = fileSize - flashSize / 2; myFile.seekSet(flashSize / 2); - } + } else + fileSize = 0; } // 4*2MB @@ -2951,6 +2953,12 @@ void writeCFI_Flash(byte currChip, byte totalChips, boolean reversed) { print_STR(flashing_file_STR, 0); print_Msg(filePath); println_Msg(F("...")); + // Check size + if ((flashSize == 8388608) && (fileSize < 6291456) && reversed) { + println_Msg(FS(FSTRING_EMPTY)); + print_STR(error_STR, 0); + print_FatalError(F("ROM file not ExROM")); + } display_Update(); // Reset flash @@ -2991,7 +2999,7 @@ void writeCFI_Flash(byte currChip, byte totalChips, boolean reversed) { print_Msg(F("Writing flash")); - // For file offset indicator SNES repros with multiple chips + // File offset indicator for SNES repros with multiple chips if ((totalChips > 1) || reversed) { print_Msg(FS(FSTRING_SPACE)); print_Msg(currChip); diff --git a/Cart_Reader/SNES.ino b/Cart_Reader/SNES.ino index 275da1a7..53fe8afc 100644 --- a/Cart_Reader/SNES.ino +++ b/Cart_Reader/SNES.ino @@ -71,10 +71,11 @@ static const char reproCFIItem5[] PROGMEM = "4x 2MB"; static const char reproCFIItem6[] PROGMEM = "1x 8MB"; static const char* const menuOptionsReproCFI[] PROGMEM = { reproCFIItem1, reproCFIItem2, reproCFIItem3, reproCFIItem4, reproCFIItem5, reproCFIItem6, FSTRING_RESET }; -// ROM file order +/* ROM file order static const char reproEXItem1[] PROGMEM = "ExROM (CDAB)"; static const char reproEXItem2[] PROGMEM = "standard (ABCD)"; static const char* const menuOptionsReproEX[] PROGMEM = { reproEXItem1, reproEXItem2, FSTRING_RESET }; +*/ void setupCFI() { #ifdef ENABLE_FLASH @@ -91,7 +92,7 @@ void setupCFI() { #endif } -boolean reproEXMenu() { +/*boolean reproEXMenu() { boolean fileOrder = 0; #ifdef ENABLE_FLASH // create menu with title and 3 options to choose from @@ -114,11 +115,11 @@ boolean reproEXMenu() { } #endif return fileOrder; -} +}*/ // Setup number of flashroms void reproCFIMenu() { - boolean reversed = 0; + boolean reversed = 1; // create menu with title and 7 options to choose from unsigned char snsReproCFI; // Copy menuOptions out of progmem @@ -165,7 +166,7 @@ void reproCFIMenu() { break; case 3: - reversed = reproEXMenu(); + //reversed = reproEXMenu(); setupCFI(); flashSize = 8388608; // Write first rom chip @@ -188,7 +189,7 @@ void reproCFIMenu() { break; case 4: - reversed = reproEXMenu(); + //reversed = reproEXMenu(); setupCFI(); flashSize = 8388608; // Write first rom chip @@ -237,7 +238,7 @@ void reproCFIMenu() { break; case 5: - reversed = reproEXMenu(); + //reversed = reproEXMenu(); setupCFI(); flashSize = 8388608; writeCFI_Flash(1, 1, reversed);