Extracts user interaction from writeSRAM_GB() and writeFlash_GB() to allow for more flexibility

This commit is contained in:
Dakkaron 2021-07-02 08:11:44 +02:00
parent 9fb439a27f
commit 34e7f90d70

View File

@ -115,6 +115,8 @@ void gbMenu() {
if (sramEndAddress > 0) { if (sramEndAddress > 0) {
// Change working dir to root // Change working dir to root
sd.chdir("/"); sd.chdir("/");
filePath[0] = '\0';
fileBrowser(F("Select sav file"));
writeSRAM_GB(); writeSRAM_GB();
unsigned long wrErrors; unsigned long wrErrors;
wrErrors = verifySRAM_GB(); wrErrors = verifySRAM_GB();
@ -138,6 +140,11 @@ void gbMenu() {
// Change working dir to root // Change working dir to root
sd.chdir("/"); sd.chdir("/");
//MBC3 //MBC3
// Launch filebrowser
filePath[0] = '\0';
sd.chdir("/");
fileBrowser(F("Select file"));
display_Clear();
writeFlash_GB(3); writeFlash_GB(3);
// Reset // Reset
wait(); wait();
@ -148,6 +155,11 @@ void gbMenu() {
// Change working dir to root // Change working dir to root
sd.chdir("/"); sd.chdir("/");
//MBC5 //MBC5
// Launch filebrowser
filePath[0] = '\0';
sd.chdir("/");
fileBrowser(F("Select file"));
display_Clear();
writeFlash_GB(5); writeFlash_GB(5);
// Reset // Reset
wait(); wait();
@ -652,10 +664,6 @@ void readSRAM_GB() {
void writeSRAM_GB() { void writeSRAM_GB() {
// Does cartridge have SRAM // Does cartridge have SRAM
if (sramEndAddress > 0) { if (sramEndAddress > 0) {
filePath[0] = '\0';
sd.chdir("/");
fileBrowser(F("Select sav file"));
// Create filepath // Create filepath
sprintf(filePath, "%s/%s", filePath, fileName); sprintf(filePath, "%s/%s", filePath, fileName);
@ -766,12 +774,6 @@ unsigned long verifySRAM_GB() {
// A0-A13 directly connected to cart edge -> 16384(0x0-0x3FFF) bytes per bank -> 256(0x0-0xFF) banks // A0-A13 directly connected to cart edge -> 16384(0x0-0x3FFF) bytes per bank -> 256(0x0-0xFF) banks
// A14-A21 connected to MBC5 // A14-A21 connected to MBC5
void writeFlash_GB(byte MBC) { void writeFlash_GB(byte MBC) {
// Launch filebrowser
filePath[0] = '\0';
sd.chdir("/");
fileBrowser(F("Select file"));
display_Clear();
// Create filepath // Create filepath
sprintf(filePath, "%s/%s", filePath, fileName); sprintf(filePath, "%s/%s", filePath, fileName);