Fix hardware-only bug

We need to erase the sector before copying the data.

I also fixed an endianness problem in initialize_memory_locations(). This one was not caused by me.
This commit is contained in:
Philippe Symons
2026-04-02 11:52:26 +02:00
parent 9967fde1ad
commit b9f5fed1cd
2 changed files with 13 additions and 3 deletions

View File

@@ -143,6 +143,8 @@ void Gen3CartridgeSaveReader::flush()
}
update_memory_buffer_checksum(sector_buffer_, (sector_start_ == HALL_OF_FAME));
// Real flash requires erase before rewriting bytes that may need 0->1 transitions.
erase_sector(sector_start_);
copy_ram_to_save(sector_buffer_, sector_start_, SECTOR_SIZE);
dirty_ = false;
}