Don't log manual mapper selection to file for NES/GBA

This commit is contained in:
sanni 2022-10-04 20:30:53 +02:00
parent 20898cf3d3
commit bef9d0f5f9
5 changed files with 73 additions and 34 deletions

View File

@ -183,6 +183,7 @@ FsFile myDir;
FsFile myFile;
#ifdef global_log
FsFile myLog;
boolean dont_log = false;
#endif
// AVR Eeprom
@ -690,6 +691,11 @@ boolean compareCRC(char* database, char* crcString, boolean renamerom, int offse
}
byte starting_letter() {
#ifdef global_log
// Disable log to prevent unnecessary logging
dont_log = true;
#endif
#if (defined(enable_LCD) || defined(enable_OLED))
byte selection = 0;
byte line = 0;
@ -786,6 +792,11 @@ byte starting_letter() {
byte incomingByte = Serial.read();
return incomingByte;
#endif
#ifdef global_log
// Enable log again
dont_log = false;
#endif
}
/******************************************
@ -1985,7 +1996,7 @@ void print_Msg(const __FlashStringHelper * string) {
Serial.print(string);
#endif
#ifdef global_log
myLog.print(string);
if (!dont_log)myLog.print(string);
#endif
}
@ -2018,7 +2029,7 @@ void print_Msg(const char myString[]) {
Serial.print(myString);
#endif
#ifdef global_log
myLog.print(myString);
if (!dont_log)myLog.print(myString);
#endif
}
@ -2033,7 +2044,7 @@ void print_Msg(long unsigned int message) {
Serial.print(message);
#endif
#ifdef global_log
myLog.print(message);
if (!dont_log)myLog.print(message);
#endif
}
@ -2048,7 +2059,7 @@ void print_Msg(byte message, int outputFormat) {
Serial.print(message, outputFormat);
#endif
#ifdef global_log
myLog.print(message, outputFormat);
if (!dont_log)myLog.print(message, outputFormat);
#endif
}
@ -2063,7 +2074,7 @@ void print_Msg(word message, int outputFormat) {
Serial.print(message, outputFormat);
#endif
#ifdef global_log
myLog.print(message, outputFormat);
if (!dont_log)myLog.print(message, outputFormat);
#endif
}
@ -2078,7 +2089,7 @@ void print_Msg(int message, int outputFormat) {
Serial.print(message, outputFormat);
#endif
#ifdef global_log
myLog.print(message, outputFormat);
if (!dont_log)myLog.print(message, outputFormat);
#endif
}
@ -2093,7 +2104,7 @@ void print_Msg(long unsigned int message, int outputFormat) {
Serial.print(message, outputFormat);
#endif
#ifdef global_log
myLog.print(message, outputFormat);
if (!dont_log)myLog.print(message, outputFormat);
#endif
}
@ -2108,7 +2119,7 @@ void print_Msg(String string) {
Serial.print(string);
#endif
#ifdef global_log
myLog.print(string);
if (!dont_log)myLog.print(string);
#endif
}
@ -2140,7 +2151,7 @@ void println_Msg(String string) {
Serial.println(string);
#endif
#ifdef global_log
myLog.println(string);
if (!dont_log)myLog.println(string);
#endif
}
@ -2156,7 +2167,7 @@ void println_Msg(byte message, int outputFormat) {
Serial.println(message, outputFormat);
#endif
#ifdef global_log
myLog.println(message, outputFormat);
if (!dont_log)myLog.println(message, outputFormat);
#endif
}
@ -2190,7 +2201,7 @@ void println_Msg(const char myString[]) {
Serial.println(myString);
#endif
#ifdef global_log
myLog.println(myString);
if (!dont_log)myLog.println(myString);
#endif
}
@ -2209,7 +2220,7 @@ void println_Msg(const __FlashStringHelper * string) {
char myBuffer[15];
strlcpy_P(myBuffer, (char *)string, 15);
if ((strncmp(myBuffer, "Press Button...", 14) != 0) && (strncmp(myBuffer, "Select file", 10) != 0)) {
myLog.println(string);
if (!dont_log)myLog.println(string);
}
#endif
}
@ -2226,7 +2237,7 @@ void println_Msg(long unsigned int message) {
Serial.println(message);
#endif
#ifdef global_log
myLog.println(message);
if (!dont_log)myLog.println(message);
#endif
}
@ -2241,7 +2252,7 @@ void display_Update() {
delay(100);
#endif
#ifdef global_log
myLog.flush();
if (!dont_log)myLog.flush();
#endif
}
@ -2255,7 +2266,7 @@ void display_Clear() {
display.setCursor(0, 0);
#endif
#ifdef global_log
myLog.println("");
if (!dont_log)myLog.println("");
#endif
}

View File

@ -841,6 +841,11 @@ void getCartInfo_GBA() {
if (myFile.open("gba.txt", O_READ)) {
char gamename[100];
#ifdef global_log
// Disable log to prevent unnecessary logging
dont_log = true;
#endif
// Loop through file
while (myFile.available()) {
// Skip first line with name
@ -994,6 +999,11 @@ void getCartInfo_GBA() {
}
// Close the file:
myFile.close();
#ifdef global_log
// Enable log again
dont_log = false;
#endif
}
else {
print_Error(F("GBA.txt missing"), true);

View File

@ -650,6 +650,10 @@ boolean getMapping() {
ram = 1; // 1K
}
#ifdef global_log
// Disable log to prevent unnecessary logging
dont_log = true;
#endif
println_Msg(gamename);
print_Msg(F("MAPPER: "));
println_Msg(mapper);
@ -695,6 +699,10 @@ boolean getMapping() {
#endif
display_Update();
#ifdef global_log
// Enable log again
dont_log = false;
#endif
int b = 0;
while (1) {
// Check button input
@ -800,6 +808,12 @@ void selectMapping() {
// Open database
if (myFile.open("nes.txt", O_READ)) {
#ifdef global_log
// Disable log to prevent unnecessary logging
dont_log = true;
#endif
// Skip ahead to selected starting letter
if ((myLetter > 0) && (myLetter <= 26)) {
while (myFile.available()) {
@ -1049,6 +1063,10 @@ void selectMapping() {
}
}
}
#ifdef global_log
// Enable log again
dont_log = false;
#endif
}
else {
print_Error(F("Database file not found"), true);