reuse GB common functions

This commit is contained in:
smesgr9000 2024-06-03 17:56:46 +02:00
parent 2b01f7fc4d
commit ccbb5447d3

View File

@ -79,6 +79,14 @@ bool gbxFlashCFI() {
return true; return true;
} }
void feedbackPressAndReset() {
// Prints string out of the common strings array either with or without newline
print_STR(press_button_STR, 1);
display_Update();
wait();
resetArduino();
}
// Start menu for both GB and GBA // Start menu for both GB and GBA
void gbxMenu() { void gbxMenu() {
// create menu with title and 5 options to choose from // create menu with title and 5 options to choose from
@ -133,12 +141,7 @@ void gbxMenu() {
sd.chdir("/"); sd.chdir("/");
//MBC3 //MBC3
writeFlash29F_GB(3, 1); writeFlash29F_GB(3, 1);
// Reset feedbackPressAndReset();
// Prints string out of the common strings array either with or without newline
print_STR(press_button_STR, 1);
display_Update();
wait();
resetArduino();
break; break;
case 1: case 1:
@ -152,12 +155,7 @@ void gbxMenu() {
sd.chdir("/"); sd.chdir("/");
//MBC5 //MBC5
writeFlash29F_GB(5, 1); writeFlash29F_GB(5, 1);
// Reset feedbackPressAndReset();
// Prints string out of the common strings array either with or without newline
print_STR(press_button_STR, 1);
display_Update();
wait();
resetArduino();
break; break;
case 2: case 2:
@ -178,12 +176,7 @@ void gbxMenu() {
sd.chdir("/"); sd.chdir("/");
//MBC5 //MBC5
writeFlash29F_GB(3, 1); writeFlash29F_GB(3, 1);
// Reset feedbackPressAndReset();
// Prints string out of the common strings array either with or without newline
print_STR(press_button_STR, 1);
display_Update();
wait();
resetArduino();
break; break;
case 3: case 3:
@ -223,11 +216,7 @@ void gbxMenu() {
// Reset // Reset
println_Msg(FS(FSTRING_EMPTY)); println_Msg(FS(FSTRING_EMPTY));
// Prints string out of the common strings array either with or without newline feedbackPressAndReset();
print_STR(press_button_STR, 1);
display_Update();
wait();
resetArduino();
break; break;
case 4: case 4:
@ -359,22 +348,12 @@ void gbxMenu() {
switch (gbPelican) { switch (gbPelican) {
case 0: case 0:
readPelican_GB(); readPelican_GB();
// Reset feedbackPressAndReset();
// Prints string out of the common strings array either with or without newline
print_STR(press_button_STR, 1);
display_Update();
wait();
resetArduino();
break; break;
case 1: case 1:
writePelican_GB(); writePelican_GB();
// Reset feedbackPressAndReset();
// Prints string out of the common strings array either with or without newline
print_STR(press_button_STR, 1);
display_Update();
wait();
resetArduino();
break; break;
} }
break; break;
@ -416,42 +395,22 @@ void gbxMenu() {
switch (gbDatel) { switch (gbDatel) {
case 0: case 0:
readMegaMem_GB(); readMegaMem_GB();
// Reset feedbackPressAndReset();
// Prints string out of the common strings array either with or without newline
print_STR(press_button_STR, 1);
display_Update();
wait();
resetArduino();
break; break;
case 1: case 1:
writeMegaMem_GB(); writeMegaMem_GB();
// Reset feedbackPressAndReset();
// Prints string out of the common strings array either with or without newline
print_STR(press_button_STR, 1);
display_Update();
wait();
resetArduino();
break; break;
case 2: case 2:
readGameshark_GB(); readGameshark_GB();
// Reset feedbackPressAndReset();
// Prints string out of the common strings array either with or without newline
print_STR(press_button_STR, 1);
display_Update();
wait();
resetArduino();
break; break;
case 3: case 3:
writeGameshark_GB(); writeGameshark_GB();
// Reset feedbackPressAndReset();
// Prints string out of the common strings array either with or without newline
print_STR(press_button_STR, 1);
display_Update();
wait();
resetArduino();
break; break;
} }
break; break;
@ -2315,11 +2274,7 @@ bool writeCFI_GB() {
print_Msg(F("but needs ")); print_Msg(F("but needs "));
print_Msg(romBanks); print_Msg(romBanks);
println_Msg(F(".")); println_Msg(F("."));
// Prints string out of the common strings array either with or without newline feedbackPressAndReset();
print_STR(press_button_STR, 1);
display_Update();
wait();
resetArduino();
} }
// Set ROM bank hi 0 // Set ROM bank hi 0