mirror of
https://github.com/sanni/cartreader.git
synced 2024-11-23 21:19:16 +01:00
Don't log manual mapper selection to file for NES/GBA
This commit is contained in:
parent
20898cf3d3
commit
bef9d0f5f9
@ -183,6 +183,7 @@ FsFile myDir;
|
|||||||
FsFile myFile;
|
FsFile myFile;
|
||||||
#ifdef global_log
|
#ifdef global_log
|
||||||
FsFile myLog;
|
FsFile myLog;
|
||||||
|
boolean dont_log = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// AVR Eeprom
|
// AVR Eeprom
|
||||||
@ -690,6 +691,11 @@ boolean compareCRC(char* database, char* crcString, boolean renamerom, int offse
|
|||||||
}
|
}
|
||||||
|
|
||||||
byte starting_letter() {
|
byte starting_letter() {
|
||||||
|
#ifdef global_log
|
||||||
|
// Disable log to prevent unnecessary logging
|
||||||
|
dont_log = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if (defined(enable_LCD) || defined(enable_OLED))
|
#if (defined(enable_LCD) || defined(enable_OLED))
|
||||||
byte selection = 0;
|
byte selection = 0;
|
||||||
byte line = 0;
|
byte line = 0;
|
||||||
@ -786,6 +792,11 @@ byte starting_letter() {
|
|||||||
byte incomingByte = Serial.read();
|
byte incomingByte = Serial.read();
|
||||||
return incomingByte;
|
return incomingByte;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef global_log
|
||||||
|
// Enable log again
|
||||||
|
dont_log = false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************
|
/******************************************
|
||||||
@ -1985,7 +1996,7 @@ void print_Msg(const __FlashStringHelper * string) {
|
|||||||
Serial.print(string);
|
Serial.print(string);
|
||||||
#endif
|
#endif
|
||||||
#ifdef global_log
|
#ifdef global_log
|
||||||
myLog.print(string);
|
if (!dont_log)myLog.print(string);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2018,7 +2029,7 @@ void print_Msg(const char myString[]) {
|
|||||||
Serial.print(myString);
|
Serial.print(myString);
|
||||||
#endif
|
#endif
|
||||||
#ifdef global_log
|
#ifdef global_log
|
||||||
myLog.print(myString);
|
if (!dont_log)myLog.print(myString);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2033,7 +2044,7 @@ void print_Msg(long unsigned int message) {
|
|||||||
Serial.print(message);
|
Serial.print(message);
|
||||||
#endif
|
#endif
|
||||||
#ifdef global_log
|
#ifdef global_log
|
||||||
myLog.print(message);
|
if (!dont_log)myLog.print(message);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2048,7 +2059,7 @@ void print_Msg(byte message, int outputFormat) {
|
|||||||
Serial.print(message, outputFormat);
|
Serial.print(message, outputFormat);
|
||||||
#endif
|
#endif
|
||||||
#ifdef global_log
|
#ifdef global_log
|
||||||
myLog.print(message, outputFormat);
|
if (!dont_log)myLog.print(message, outputFormat);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2063,7 +2074,7 @@ void print_Msg(word message, int outputFormat) {
|
|||||||
Serial.print(message, outputFormat);
|
Serial.print(message, outputFormat);
|
||||||
#endif
|
#endif
|
||||||
#ifdef global_log
|
#ifdef global_log
|
||||||
myLog.print(message, outputFormat);
|
if (!dont_log)myLog.print(message, outputFormat);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2078,7 +2089,7 @@ void print_Msg(int message, int outputFormat) {
|
|||||||
Serial.print(message, outputFormat);
|
Serial.print(message, outputFormat);
|
||||||
#endif
|
#endif
|
||||||
#ifdef global_log
|
#ifdef global_log
|
||||||
myLog.print(message, outputFormat);
|
if (!dont_log)myLog.print(message, outputFormat);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2093,7 +2104,7 @@ void print_Msg(long unsigned int message, int outputFormat) {
|
|||||||
Serial.print(message, outputFormat);
|
Serial.print(message, outputFormat);
|
||||||
#endif
|
#endif
|
||||||
#ifdef global_log
|
#ifdef global_log
|
||||||
myLog.print(message, outputFormat);
|
if (!dont_log)myLog.print(message, outputFormat);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2108,7 +2119,7 @@ void print_Msg(String string) {
|
|||||||
Serial.print(string);
|
Serial.print(string);
|
||||||
#endif
|
#endif
|
||||||
#ifdef global_log
|
#ifdef global_log
|
||||||
myLog.print(string);
|
if (!dont_log)myLog.print(string);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2140,7 +2151,7 @@ void println_Msg(String string) {
|
|||||||
Serial.println(string);
|
Serial.println(string);
|
||||||
#endif
|
#endif
|
||||||
#ifdef global_log
|
#ifdef global_log
|
||||||
myLog.println(string);
|
if (!dont_log)myLog.println(string);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2156,7 +2167,7 @@ void println_Msg(byte message, int outputFormat) {
|
|||||||
Serial.println(message, outputFormat);
|
Serial.println(message, outputFormat);
|
||||||
#endif
|
#endif
|
||||||
#ifdef global_log
|
#ifdef global_log
|
||||||
myLog.println(message, outputFormat);
|
if (!dont_log)myLog.println(message, outputFormat);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2190,7 +2201,7 @@ void println_Msg(const char myString[]) {
|
|||||||
Serial.println(myString);
|
Serial.println(myString);
|
||||||
#endif
|
#endif
|
||||||
#ifdef global_log
|
#ifdef global_log
|
||||||
myLog.println(myString);
|
if (!dont_log)myLog.println(myString);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2209,7 +2220,7 @@ void println_Msg(const __FlashStringHelper * string) {
|
|||||||
char myBuffer[15];
|
char myBuffer[15];
|
||||||
strlcpy_P(myBuffer, (char *)string, 15);
|
strlcpy_P(myBuffer, (char *)string, 15);
|
||||||
if ((strncmp(myBuffer, "Press Button...", 14) != 0) && (strncmp(myBuffer, "Select file", 10) != 0)) {
|
if ((strncmp(myBuffer, "Press Button...", 14) != 0) && (strncmp(myBuffer, "Select file", 10) != 0)) {
|
||||||
myLog.println(string);
|
if (!dont_log)myLog.println(string);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -2226,7 +2237,7 @@ void println_Msg(long unsigned int message) {
|
|||||||
Serial.println(message);
|
Serial.println(message);
|
||||||
#endif
|
#endif
|
||||||
#ifdef global_log
|
#ifdef global_log
|
||||||
myLog.println(message);
|
if (!dont_log)myLog.println(message);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2241,7 +2252,7 @@ void display_Update() {
|
|||||||
delay(100);
|
delay(100);
|
||||||
#endif
|
#endif
|
||||||
#ifdef global_log
|
#ifdef global_log
|
||||||
myLog.flush();
|
if (!dont_log)myLog.flush();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2255,7 +2266,7 @@ void display_Clear() {
|
|||||||
display.setCursor(0, 0);
|
display.setCursor(0, 0);
|
||||||
#endif
|
#endif
|
||||||
#ifdef global_log
|
#ifdef global_log
|
||||||
myLog.println("");
|
if (!dont_log)myLog.println("");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -833,13 +833,13 @@ void getCartInfo_GB() {
|
|||||||
else if (sramSize > 1) {
|
else if (sramSize > 1) {
|
||||||
lastByte = 0xBFFF;
|
lastByte = 0xBFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
// MBC6
|
// MBC6
|
||||||
if (romType == 32) {
|
if (romType == 32) {
|
||||||
sramBanks = 8;
|
sramBanks = 8;
|
||||||
lastByte = 0xAFFF;
|
lastByte = 0xAFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get Checksum as string
|
// Get Checksum as string
|
||||||
eepbit[6] = sdBuffer[0x14E];
|
eepbit[6] = sdBuffer[0x14E];
|
||||||
eepbit[7] = sdBuffer[0x14F];
|
eepbit[7] = sdBuffer[0x14F];
|
||||||
@ -907,7 +907,7 @@ void getCartInfo_GB() {
|
|||||||
(strncmp(romName, "MORTALKOMBAT DUO", 16) == 0) && (sdBuffer[0x14D] == 0xA7)) {
|
(strncmp(romName, "MORTALKOMBAT DUO", 16) == 0) && (sdBuffer[0x14D] == 0xA7)) {
|
||||||
romType += 0x100;
|
romType += 0x100;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ROM revision
|
// ROM revision
|
||||||
romVersion = sdBuffer[0x14C];
|
romVersion = sdBuffer[0x14C];
|
||||||
}
|
}
|
||||||
@ -986,11 +986,11 @@ void readROM_GB() {
|
|||||||
// Set ROM bank for MBC1M
|
// Set ROM bank for MBC1M
|
||||||
else if (romType == 0x101 || romType == 0x103) {
|
else if (romType == 0x101 || romType == 0x103) {
|
||||||
if (currBank < 10) {
|
if (currBank < 10) {
|
||||||
writeByte_GB(0x4000, currBank >> 4);
|
writeByte_GB(0x4000, currBank >> 4);
|
||||||
writeByte_GB(0x2000, (currBank & 0x1f));
|
writeByte_GB(0x2000, (currBank & 0x1f));
|
||||||
} else {
|
} else {
|
||||||
writeByte_GB(0x4000, currBank >> 4);
|
writeByte_GB(0x4000, currBank >> 4);
|
||||||
writeByte_GB(0x2000, 0x10 | (currBank & 0x1f));
|
writeByte_GB(0x2000, 0x10 | (currBank & 0x1f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1321,7 +1321,7 @@ void readSRAMFLASH_MBC6_GB() {
|
|||||||
uint32_t processedProgressBar = 0;
|
uint32_t processedProgressBar = 0;
|
||||||
uint32_t totalProgressBar = 0x108000;
|
uint32_t totalProgressBar = 0x108000;
|
||||||
draw_progressbar(0, totalProgressBar);
|
draw_progressbar(0, totalProgressBar);
|
||||||
|
|
||||||
// Enable Mapper and SRAM
|
// Enable Mapper and SRAM
|
||||||
writeByte_GB(0x0000, 0x0A);
|
writeByte_GB(0x0000, 0x0A);
|
||||||
|
|
||||||
@ -1354,7 +1354,7 @@ void readSRAMFLASH_MBC6_GB() {
|
|||||||
// Switch FLASH banks
|
// Switch FLASH banks
|
||||||
for (byte currBank = 0; currBank < 128; currBank++) {
|
for (byte currBank = 0; currBank < 128; currBank++) {
|
||||||
word romAddress = 0x4000;
|
word romAddress = 0x4000;
|
||||||
|
|
||||||
writeByte_GB(0x2000, currBank);
|
writeByte_GB(0x2000, currBank);
|
||||||
writeByte_GB(0x3000, currBank);
|
writeByte_GB(0x3000, currBank);
|
||||||
|
|
||||||
@ -1376,7 +1376,7 @@ void readSRAMFLASH_MBC6_GB() {
|
|||||||
writeByte_GB(0x1000, 0x00);
|
writeByte_GB(0x1000, 0x00);
|
||||||
writeByte_GB(0x2800, 0x00);
|
writeByte_GB(0x2800, 0x00);
|
||||||
writeByte_GB(0x3800, 0x00);
|
writeByte_GB(0x3800, 0x00);
|
||||||
|
|
||||||
// Close the file:
|
// Close the file:
|
||||||
myFile.close();
|
myFile.close();
|
||||||
|
|
||||||
@ -1395,7 +1395,7 @@ void writeSRAMFLASH_MBC6_GB() {
|
|||||||
display_Clear();
|
display_Clear();
|
||||||
println_Msg(F("Writing MBC6 save..."));
|
println_Msg(F("Writing MBC6 save..."));
|
||||||
display_Update();
|
display_Update();
|
||||||
|
|
||||||
//Initialize progress bar
|
//Initialize progress bar
|
||||||
uint32_t processedProgressBar = 0;
|
uint32_t processedProgressBar = 0;
|
||||||
uint32_t totalProgressBar = 0x108000;
|
uint32_t totalProgressBar = 0x108000;
|
||||||
@ -1403,7 +1403,7 @@ void writeSRAMFLASH_MBC6_GB() {
|
|||||||
|
|
||||||
// Enable Mapper and SRAM
|
// Enable Mapper and SRAM
|
||||||
writeByte_GB(0x0000, 0x0A);
|
writeByte_GB(0x0000, 0x0A);
|
||||||
|
|
||||||
// Switch SRAM banks
|
// Switch SRAM banks
|
||||||
for (byte currBank = 0; currBank < sramBanks; currBank++) {
|
for (byte currBank = 0; currBank < sramBanks; currBank++) {
|
||||||
writeByte_GB(0x0400, currBank);
|
writeByte_GB(0x0400, currBank);
|
||||||
@ -1417,20 +1417,20 @@ void writeSRAMFLASH_MBC6_GB() {
|
|||||||
processedProgressBar += (lastByte + 1) - 0xA000;
|
processedProgressBar += (lastByte + 1) - 0xA000;
|
||||||
draw_progressbar(processedProgressBar, totalProgressBar);
|
draw_progressbar(processedProgressBar, totalProgressBar);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable SRAM
|
// Disable SRAM
|
||||||
writeByte_GB(0x0000, 0x00);
|
writeByte_GB(0x0000, 0x00);
|
||||||
|
|
||||||
// Enable flash save memory (map to ROM)
|
// Enable flash save memory (map to ROM)
|
||||||
writeByte_GB(0x1000, 0x01);
|
writeByte_GB(0x1000, 0x01);
|
||||||
writeByte_GB(0x0C00, 0x01);
|
writeByte_GB(0x0C00, 0x01);
|
||||||
writeByte_GB(0x1000, 0x01);
|
writeByte_GB(0x1000, 0x01);
|
||||||
writeByte_GB(0x2800, 0x08);
|
writeByte_GB(0x2800, 0x08);
|
||||||
writeByte_GB(0x3800, 0x08);
|
writeByte_GB(0x3800, 0x08);
|
||||||
|
|
||||||
for (byte currBank = 0; currBank < 128; currBank++) {
|
for (byte currBank = 0; currBank < 128; currBank++) {
|
||||||
word romAddress = 0x4000;
|
word romAddress = 0x4000;
|
||||||
|
|
||||||
// Erase FLASH sector
|
// Erase FLASH sector
|
||||||
if (((processedProgressBar - 0x8000) % 0x20000) == 0) {
|
if (((processedProgressBar - 0x8000) % 0x20000) == 0) {
|
||||||
writeByte_GB(0x2800, 0x08);
|
writeByte_GB(0x2800, 0x08);
|
||||||
@ -1471,7 +1471,7 @@ void writeSRAMFLASH_MBC6_GB() {
|
|||||||
writeByte_GB(0x2000, currBank);
|
writeByte_GB(0x2000, currBank);
|
||||||
writeByte_GB(0x3000, currBank);
|
writeByte_GB(0x3000, currBank);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write to FLASH
|
// Write to FLASH
|
||||||
while (romAddress <= 0x5FFF) {
|
while (romAddress <= 0x5FFF) {
|
||||||
writeByte_GB(0x2000, 0x01);
|
writeByte_GB(0x2000, 0x01);
|
||||||
|
@ -841,6 +841,11 @@ void getCartInfo_GBA() {
|
|||||||
if (myFile.open("gba.txt", O_READ)) {
|
if (myFile.open("gba.txt", O_READ)) {
|
||||||
char gamename[100];
|
char gamename[100];
|
||||||
|
|
||||||
|
#ifdef global_log
|
||||||
|
// Disable log to prevent unnecessary logging
|
||||||
|
dont_log = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Loop through file
|
// Loop through file
|
||||||
while (myFile.available()) {
|
while (myFile.available()) {
|
||||||
// Skip first line with name
|
// Skip first line with name
|
||||||
@ -994,6 +999,11 @@ void getCartInfo_GBA() {
|
|||||||
}
|
}
|
||||||
// Close the file:
|
// Close the file:
|
||||||
myFile.close();
|
myFile.close();
|
||||||
|
|
||||||
|
#ifdef global_log
|
||||||
|
// Enable log again
|
||||||
|
dont_log = false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print_Error(F("GBA.txt missing"), true);
|
print_Error(F("GBA.txt missing"), true);
|
||||||
|
@ -650,6 +650,10 @@ boolean getMapping() {
|
|||||||
ram = 1; // 1K
|
ram = 1; // 1K
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef global_log
|
||||||
|
// Disable log to prevent unnecessary logging
|
||||||
|
dont_log = true;
|
||||||
|
#endif
|
||||||
println_Msg(gamename);
|
println_Msg(gamename);
|
||||||
print_Msg(F("MAPPER: "));
|
print_Msg(F("MAPPER: "));
|
||||||
println_Msg(mapper);
|
println_Msg(mapper);
|
||||||
@ -695,6 +699,10 @@ boolean getMapping() {
|
|||||||
#endif
|
#endif
|
||||||
display_Update();
|
display_Update();
|
||||||
|
|
||||||
|
#ifdef global_log
|
||||||
|
// Enable log again
|
||||||
|
dont_log = false;
|
||||||
|
#endif
|
||||||
int b = 0;
|
int b = 0;
|
||||||
while (1) {
|
while (1) {
|
||||||
// Check button input
|
// Check button input
|
||||||
@ -800,6 +808,12 @@ void selectMapping() {
|
|||||||
|
|
||||||
// Open database
|
// Open database
|
||||||
if (myFile.open("nes.txt", O_READ)) {
|
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
|
// Skip ahead to selected starting letter
|
||||||
if ((myLetter > 0) && (myLetter <= 26)) {
|
if ((myLetter > 0) && (myLetter <= 26)) {
|
||||||
while (myFile.available()) {
|
while (myFile.available()) {
|
||||||
@ -1049,6 +1063,10 @@ void selectMapping() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef global_log
|
||||||
|
// Enable log again
|
||||||
|
dont_log = false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print_Error(F("Database file not found"), true);
|
print_Error(F("Database file not found"), true);
|
||||||
|
@ -785,7 +785,7 @@ void getCartInfo_SNES() {
|
|||||||
print_Msg(F(" ("));
|
print_Msg(F(" ("));
|
||||||
print_Msg(numBanks);
|
print_Msg(numBanks);
|
||||||
println_Msg(F(" banks)"));
|
println_Msg(F(" banks)"));
|
||||||
|
|
||||||
//print_Msg(F("Chips: "));
|
//print_Msg(F("Chips: "));
|
||||||
//println_Msg(romChips);
|
//println_Msg(romChips);
|
||||||
|
|
||||||
@ -1253,7 +1253,7 @@ boolean compare_checksum() {
|
|||||||
char calcsumStr[5];
|
char calcsumStr[5];
|
||||||
sprintf(calcsumStr, "%04X", calc_checksum(fileName, folder));
|
sprintf(calcsumStr, "%04X", calc_checksum(fileName, folder));
|
||||||
print_Msg(calcsumStr);
|
print_Msg(calcsumStr);
|
||||||
|
|
||||||
if (strcmp(calcsumStr, checksumStr) == 0) {
|
if (strcmp(calcsumStr, checksumStr) == 0) {
|
||||||
println_Msg(F(" -> OK"));
|
println_Msg(F(" -> OK"));
|
||||||
display_Update();
|
display_Update();
|
||||||
|
Loading…
Reference in New Issue
Block a user