GB: Fix flashing MBC0

This commit is contained in:
sanni 2024-09-16 10:36:54 +02:00
parent 7ad07067c9
commit 4f427c0ce4

View File

@ -2147,21 +2147,22 @@ void writeFlash_GB(byte MBC, boolean commandSet, boolean flashErase) {
} }
else if (MBC == 0) { else if (MBC == 0) {
if (fileSize > 0x8000)
print_FatalError(file_too_big_STR);
if (audioWE) if (audioWE)
println_Msg(F("Writing flash (Audio)")); println_Msg(F("Writing flash (Audio)"));
else else
println_Msg(F("Writing flash (WR)")); println_Msg(F("Writing flash (WR)"));
display_Update(); display_Update();
// Limit file size to 32KB
romBanks = 2;
// Write flash // Write flash
//Initialize progress bar //Initialize progress bar
uint32_t processedProgressBar = 0; uint32_t processedProgressBar = 0;
uint32_t totalProgressBar = (uint32_t)(romBanks)*16384; uint32_t totalProgressBar = (uint32_t)(romBanks)*16384;
draw_progressbar(0, totalProgressBar); draw_progressbar(0, totalProgressBar);
for (unsigned int currAddr = 0x4000; currAddr < fileSize; currAddr += 512) { for (unsigned int currAddr = 0; currAddr < 0x7FFF; currAddr += 512) {
myFile.read(sdBuffer, 512); myFile.read(sdBuffer, 512);
for (int currByte = 0; currByte < 512; currByte++) { for (int currByte = 0; currByte < 512; currByte++) {