Skip to content

Commit

Permalink
Update FLASH.ino
Browse files Browse the repository at this point in the history
  • Loading branch information
sanni committed Aug 9, 2024
1 parent c96c27c commit cf820cf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
12 changes: 10 additions & 2 deletions Cart_Reader/FLASH.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
15 changes: 8 additions & 7 deletions Cart_Reader/SNES.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -165,7 +166,7 @@ void reproCFIMenu() {
break;

case 3:
reversed = reproEXMenu();
//reversed = reproEXMenu();
setupCFI();
flashSize = 8388608;
// Write first rom chip
Expand All @@ -188,7 +189,7 @@ void reproCFIMenu() {
break;

case 4:
reversed = reproEXMenu();
//reversed = reproEXMenu();
setupCFI();
flashSize = 8388608;
// Write first rom chip
Expand Down Expand Up @@ -237,7 +238,7 @@ void reproCFIMenu() {
break;

case 5:
reversed = reproEXMenu();
//reversed = reproEXMenu();
setupCFI();
flashSize = 8388608;
writeCFI_Flash(1, 1, reversed);
Expand Down

0 comments on commit cf820cf

Please sign in to comment.