remove duplicate GB Flash reading function

This commit is contained in:
smesgr9000 2024-05-12 14:33:21 +02:00
parent dc47202c4d
commit 38b2b2476b

View File

@ -53,6 +53,32 @@ static const char GameSharkRead[] PROGMEM = "Read GBC GameShark";
static const char GameSharkWrite[] PROGMEM = "Write GBC GameShark"; static const char GameSharkWrite[] PROGMEM = "Write GBC GameShark";
static const char* const menuOptionsGBDatel[] PROGMEM = { MegaMemRead, MegaMemWrite, GameSharkRead, GameSharkWrite }; static const char* const menuOptionsGBDatel[] PROGMEM = { MegaMemRead, MegaMemWrite, GameSharkRead, GameSharkWrite };
bool gbxFlashCFI() {
// Flash CFI
display_Clear();
display_Update();
setup_GB();
mode = CORE_GB;
// Change working dir to root
sd.chdir("/");
// Launch filebrowser
filePath[0] = '\0';
sd.chdir("/");
fileBrowser(F("Select file"));
display_Clear();
identifyCFI_GB();
if (!writeCFI_GB()) {
display_Clear();
println_Msg(F("Flashing failed, time out!"));
// Prints string out of the common strings array either with or without newline
print_STR(press_button_STR, 1);
display_Update();
return false;
}
return true;
}
// 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
@ -212,53 +238,14 @@ void gbxMenu() {
case 1: case 1:
// Flash CFI // Flash CFI
display_Clear(); gbxFlashCFI();
display_Update();
setup_GB();
mode = CORE_GB;
// Change working dir to root
sd.chdir("/");
// Launch filebrowser
filePath[0] = '\0';
sd.chdir("/");
fileBrowser(F("Select file"));
display_Clear();
identifyCFI_GB();
if (!writeCFI_GB()) {
display_Clear();
println_Msg(F("Flashing failed, time out!"));
// Prints string out of the common strings array either with or without newline
print_STR(press_button_STR, 1);
display_Update();
wait();
}
// Reset
wait(); wait();
resetArduino(); resetArduino();
break; break;
case 2: case 2:
// Flash CFI and Save // Flash CFI and save
display_Clear(); if (!gbxFlashCFI()) {
display_Update();
setup_GB();
mode = CORE_GB;
// Change working dir to root
sd.chdir("/");
// Launch filebrowser
filePath[0] = '\0';
sd.chdir("/");
fileBrowser(F("Select file"));
display_Clear();
identifyCFI_GB();
if (!writeCFI_GB()) {
display_Clear();
println_Msg(F("Flashing failed, time out!"));
// Prints string out of the common strings array either with or without newline
print_STR(press_button_STR, 1);
display_Update();
wait(); wait();
resetArduino(); resetArduino();
} }