V6.2: Add option to manually config N64 repro

This commit is contained in:
sanni 2021-05-26 16:29:57 +02:00
parent c343094966
commit 0c99780c5d
2 changed files with 182 additions and 106 deletions

View File

@ -1,8 +1,8 @@
/********************************************************************************** /**********************************************************************************
Cartridge Reader for Arduino Mega2560 Cartridge Reader for Arduino Mega2560
Date: 26.04.2021 Date: 26.05.2021
Version: 6.1 Version: 6.2
SD lib: https://github.com/greiman/SdFat SD lib: https://github.com/greiman/SdFat
LCD lib: https://github.com/adafruit/Adafruit_SSD1306 LCD lib: https://github.com/adafruit/Adafruit_SSD1306
@ -43,7 +43,7 @@
**********************************************************************************/ **********************************************************************************/
char ver[5] = "6.1"; char ver[5] = "6.2";
/****************************************** /******************************************
Libraries Libraries

View File

@ -98,6 +98,12 @@ static const char N64SaveItem4[] PROGMEM = "SRAM";
static const char N64SaveItem5[] PROGMEM = "FLASHRAM"; static const char N64SaveItem5[] PROGMEM = "FLASHRAM";
static const char* const saveOptionsN64[] PROGMEM = {N64SaveItem1, N64SaveItem2, N64SaveItem3, N64SaveItem4, N64SaveItem5}; static const char* const saveOptionsN64[] PROGMEM = {N64SaveItem1, N64SaveItem2, N64SaveItem3, N64SaveItem4, N64SaveItem5};
// Repro menu
static const char N64ReproItem1[] PROGMEM = "no buffer";
static const char N64ReproItem2[] PROGMEM = "32 byte";
static const char N64ReproItem3[] PROGMEM = "128 byte";
static const char* const reproOptionsN64[] PROGMEM = {N64ReproItem1, N64ReproItem2, N64ReproItem3};
// N64 start menu // N64 start menu
void n64Menu() { void n64Menu() {
// create menu with title and 5 options to choose from // create menu with title and 5 options to choose from
@ -3045,6 +3051,88 @@ void flashRepro_N64() {
println_Msg(F("Press Button")); println_Msg(F("Press Button"));
display_Update(); display_Update();
wait(); wait();
}
else {
print_Msg(F("Vendor: "));
println_Msg(vendorID);
print_Msg(F("ID: "));
print_Msg(flashid);
print_Msg(F(" "));
println_Msg(cartID);
println_Msg(F("Unknown flashrom"));
println_Msg(F(" "));
println_Msg(F("Press button for"));
println_Msg(F("manual config"));
display_Update();
wait();
// Set cartsize manually
unsigned char N64RomMenu;
// Copy menuOptions out of progmem
convertPgm(romOptionsN64, 6);
N64RomMenu = question_box(F("Select REPRO size"), menuOptions, 6, 0);
// wait for user choice to come back from the question box menu
switch (N64RomMenu)
{
case 0:
// 4MB
cartSize = 4;
break;
case 1:
// 8MB
cartSize = 8;
break;
case 2:
// 12MB
cartSize = 12;
break;
case 3:
// 16MB
cartSize = 16;
break;
case 4:
// 32MB
cartSize = 32;
break;
case 5:
// 64MB
cartSize = 64;
break;
}
// Set flashid manually
unsigned char N64ReproMenu;
// Copy menuOptions out of progmem
convertPgm(reproOptionsN64, 3);
N64ReproMenu = question_box(F("Select flash buffer"), menuOptions, 3, 0);
// wait for user choice to come back from the question box menu
switch (N64ReproMenu)
{
case 0:
// no buffer
sprintf(flashid, "%s", "22C9");
break;
case 1:
// 32 byte buffer
sprintf(flashid, "%s", "227E");
break;
case 2:
// 128 byte buffer
sprintf(flashid, "%s", "227E");
sprintf(cartID, "%s", "3901");
break;
}
}
// Launch file browser // Launch file browser
filePath[0] = '\0'; filePath[0] = '\0';
@ -3097,7 +3185,6 @@ void flashRepro_N64() {
println_Msg(filePath); println_Msg(filePath);
display_Update(); display_Update();
if ((strcmp(cartID, "3901") == 0) && (strcmp(flashid, "227E") == 0)) { if ((strcmp(cartID, "3901") == 0) && (strcmp(flashid, "227E") == 0)) {
// Intel 512M29EW(64MB) with 0x20000 sector size and 128 byte buffer // Intel 512M29EW(64MB) with 0x20000 sector size and 128 byte buffer
writeFlashBuffer_N64(0x20000, 128); writeFlashBuffer_N64(0x20000, 128);
@ -3146,17 +3233,6 @@ void flashRepro_N64() {
else { else {
print_Error(F("Can't open file"), false); print_Error(F("Can't open file"), false);
} }
}
// If the ID is unknown show error message
else {
print_Msg(F("Vendor: "));
println_Msg(vendorID);
print_Msg(F("ID: "));
print_Msg(flashid);
print_Msg(F(" "));
println_Msg(cartID);
print_Error(F("Unknown flashrom"), false);
}
println_Msg(F("Press Button...")); println_Msg(F("Press Button..."));
display_Update(); display_Update();