Fix NES manual mapper selection

This commit is contained in:
sanni 2022-11-02 00:32:54 +01:00
parent 78aa7a3d34
commit a3b1882e88
2 changed files with 142 additions and 134 deletions

View File

@ -971,6 +971,9 @@ void mainMenu() {
display_Clear(); display_Clear();
display_Update(); display_Update();
setup_NES(); setup_NES();
#ifdef nointro
getMapping();
#endif
checkStatus_NES(); checkStatus_NES();
nesMenu(); nesMenu();
break; break;
@ -1227,6 +1230,9 @@ void consoleMenu() {
display_Clear(); display_Clear();
display_Update(); display_Update();
setup_NES(); setup_NES();
#ifdef nointro
getMapping();
#endif
checkStatus_NES(); checkStatus_NES();
nesMenu(); nesMenu();
break; break;

View File

@ -526,6 +526,7 @@ void getMapping() {
} }
oldcrc32 = ~oldcrc32; oldcrc32 = ~oldcrc32;
oldcrc32MMC3 = ~oldcrc32MMC3; oldcrc32MMC3 = ~oldcrc32MMC3;
boolean browseDatabase;
// Filter out all 0xFF checksums at 0x8000 and 0xE000 // Filter out all 0xFF checksums at 0x8000 and 0xE000
if (oldcrc32 == 0xBD7BC39F && oldcrc32MMC3 == 0xBD7BC39F) { if (oldcrc32 == 0xBD7BC39F && oldcrc32MMC3 == 0xBD7BC39F) {
@ -534,7 +535,7 @@ void getMapping() {
display_Update(); display_Update();
delay(1000); delay(1000);
setDefaultRomName(); setDefaultRomName();
selectMapping(database); browseDatabase = selectMapping(database);
} else { } else {
println_Msg(F("Searching database")); println_Msg(F("Searching database"));
print_Msg(F("for ")); print_Msg(F("for "));
@ -573,9 +574,10 @@ void getMapping() {
// Change ROM name to CART // Change ROM name to CART
setDefaultRomName(); setDefaultRomName();
selectMapping(database); browseDatabase = selectMapping(database);
} }
} }
if (browseDatabase) {
byte fastScrolling = 1; byte fastScrolling = 1;
// Display database // Display database
@ -715,6 +717,7 @@ void getMapping() {
EEPROM_writeAnything(10, ramsize); EEPROM_writeAnything(10, ramsize);
break; break;
} }
}
database.close(); database.close();
} }
@ -733,7 +736,7 @@ static void readDatabaseEntry(FsFile& database, struct database_entry* entry) {
entry->crc512 = strtoul(entry->crc512_str, NULL, 16); entry->crc512 = strtoul(entry->crc512_str, NULL, 16);
} }
static void selectMapping(FsFile& database) { boolean selectMapping(FsFile& database) {
// Select starting letter // Select starting letter
byte myLetter = starting_letter(); byte myLetter = starting_letter();
@ -744,6 +747,7 @@ static void selectMapping(FsFile& database) {
setPRGSize(); setPRGSize();
setCHRSize(); setCHRSize();
setRAMSize(); setRAMSize();
return 0;
} else { } else {
#ifdef global_log #ifdef global_log
// Disable log to prevent unnecessary logging // Disable log to prevent unnecessary logging
@ -766,6 +770,7 @@ static void selectMapping(FsFile& database) {
dont_log = false; dont_log = false;
#endif #endif
} }
return 1;
} }
void readRom_NES() { void readRom_NES() {
@ -2334,9 +2339,6 @@ void checkMMC6() { // Detect MMC6 Carts - read PRG 0x3E00A ("START
} }
void checkStatus_NES() { void checkStatus_NES() {
#ifdef nointro
getMapping();
#endif
EEPROM_readAnything(7, mapper); EEPROM_readAnything(7, mapper);
EEPROM_readAnything(8, prgsize); EEPROM_readAnything(8, prgsize);
EEPROM_readAnything(9, chrsize); EEPROM_readAnything(9, chrsize);