Disable N64 controller test by default

This commit is contained in:
sanni 2024-08-16 08:39:05 +02:00
parent a2b8d0446d
commit 9400330fca
3 changed files with 30 additions and 11 deletions

View File

@ -219,6 +219,7 @@
*/ */
#define ENABLE_N64 #define ENABLE_N64
//#define ENABLE_CONTROLLERTEST
/****/ /****/

View File

@ -178,6 +178,8 @@ void n64ControllerMenu() {
// wait for user choice to come back from the question box menu // wait for user choice to come back from the question box menu
switch (mainMenu) { switch (mainMenu) {
#if defined(ENABLE_CONTROLLERTEST)
case 0: case 0:
resetController(); resetController();
display_Clear(); display_Clear();
@ -189,6 +191,7 @@ void n64ControllerMenu() {
#endif #endif
quit = 1; quit = 1;
break; break;
#endif
case 1: case 1:
resetController(); resetController();
@ -230,6 +233,9 @@ void n64ControllerMenu() {
case 3: case 3:
resetArduino(); resetArduino();
break; break;
default:
print_MissingModule(); // does not return
} }
} }
@ -286,7 +292,8 @@ void n64CartMenu() {
} else if ((saveType == 5) || (saveType == 6)) { } else if ((saveType == 5) || (saveType == 6)) {
println_Msg(F("Reading EEPROM...")); println_Msg(F("Reading EEPROM..."));
display_Update(); display_Update();
readEeprom(); resetEeprom_N64();
readEeprom_N64();
} else { } else {
print_Error(F("Savetype Error")); print_Error(F("Savetype Error"));
} }
@ -355,9 +362,10 @@ void n64CartMenu() {
// Launch file browser // Launch file browser
fileBrowser(F("Select eep file")); fileBrowser(F("Select eep file"));
display_Clear(); display_Clear();
resetEeprom_N64();
writeEeprom(); writeEeprom_N64();
writeErrors = verifyEeprom(); resetEeprom_N64();
writeErrors = verifyEeprom_N64();
if (writeErrors == 0) { if (writeErrors == 0) {
println_Msg(F("EEPROM verified OK")); println_Msg(F("EEPROM verified OK"));
@ -1005,6 +1013,8 @@ void get_button() {
/****************************************** /******************************************
N64 Controller Test N64 Controller Test
*****************************************/ *****************************************/
#if defined(ENABLE_CONTROLLERTEST)
#ifdef ENABLE_SERIAL #ifdef ENABLE_SERIAL
void controllerTest_Serial() { void controllerTest_Serial() {
while (quit) { while (quit) {
@ -1523,6 +1533,7 @@ void controllerTest_Display() {
} }
} }
#endif #endif
#endif
/****************************************** /******************************************
N64 Controller Pak Functions N64 Controller Pak Functions
@ -2208,7 +2219,7 @@ void idCart() {
} }
// Write Eeprom to cartridge // Write Eeprom to cartridge
void writeEeprom() { void writeEeprom_N64() {
if ((saveType == 5) || (saveType == 6)) { if ((saveType == 5) || (saveType == 6)) {
// Create filepath // Create filepath
@ -2283,8 +2294,18 @@ boolean readEepromPageList(byte* output, byte page_number, byte page_count) {
return 1; return 1;
} }
// Reset Eeprom
void resetEeprom_N64() {
// Pull RESET(PH0) low
PORTH &= ~(1 << 0);
delay(100);
// Pull RESET(PH0) high
PORTH |= (1 << 0);
delay(100);
}
// Dump Eeprom to SD // Dump Eeprom to SD
void readEeprom() { void readEeprom_N64() {
if ((saveType == 5) || (saveType == 6)) { if ((saveType == 5) || (saveType == 6)) {
// Get name, add extension and convert to char array for sd lib // Get name, add extension and convert to char array for sd lib
createFolderAndOpenFile("N64", "SAVE", romName, "eep"); createFolderAndOpenFile("N64", "SAVE", romName, "eep");
@ -2303,17 +2324,13 @@ void readEeprom() {
} }
// Close the file: // Close the file:
myFile.close(); myFile.close();
print_Msg(F("Saved to "));
print_Msg(folder);
println_Msg(F("/"));
display_Update();
} else { } else {
print_FatalError(F("Savetype Error")); print_FatalError(F("Savetype Error"));
} }
} }
// Check if a write succeeded, returns 0 if all is ok and number of errors if not // Check if a write succeeded, returns 0 if all is ok and number of errors if not
unsigned long verifyEeprom() { unsigned long verifyEeprom_N64() {
unsigned long writeErrors; unsigned long writeErrors;
if ((saveType == 5) || (saveType == 6)) { if ((saveType == 5) || (saveType == 6)) {

View File

@ -331,6 +331,7 @@ void nesMenu() {
// Write FLASH // Write FLASH
case 5: case 5:
nesFlashMenu(); nesFlashMenu();
break;
// Reset // Reset
case 6: case 6: