Update N64.ino

Added CRC 1 and 2 reading support for N64 ROMs.
Added RTC support for N64 ROM dumps.
This commit is contained in:
majorpbx 2021-10-02 01:25:44 -04:00 committed by GitHub
parent cc1668a2e3
commit f1c6d29824

View File

@ -6,6 +6,11 @@
#ifdef enable_N64 #ifdef enable_N64
#include "snes_clk.h" #include "snes_clk.h"
// Include Cart_Reader.ino to allow for calling istablished functions
#ifdef RTC_installed
#include "RTC.h"
#endif
/****************************************** /******************************************
Defines Defines
*****************************************/ *****************************************/
@ -1883,6 +1888,22 @@ void idCart() {
myLength++; myLength++;
} }
} }
// Get CRC1
for (int i = 0; i < 4; i++) {
if (sdBuffer[0x10 + i] < 0x10) {
CRC1 += '0';
}
CRC1 += String(sdBuffer[0x10 + i], HEX);
}
// Get CRC2
for (int i = 0; i < 4; i++) {
if (sdBuffer[0x14 + i] < 0x10) {
CRC2 += '0';
}
CRC2 += String(sdBuffer[0x14 + i], HEX);
}
} }
/****************************************** /******************************************
@ -3112,17 +3133,23 @@ void savesummary_N64(boolean checkfound, char crcStr[9], unsigned long timeElaps
} }
//Write the info //Write the info
myFile.print(F("Name: ")); myFile.print(F("Name\t: "));
myFile.println(romName); myFile.println(romName);
myFile.print(F("ID: ")); myFile.print(F("ID\t: "));
myFile.println(cartID); myFile.println(cartID);
myFile.print(F("Size: ")); myFile.print(F("ROM CRC1: "));
myFile.println(CRC1);
myFile.print(F("ROM CRC2: "));
myFile.println(CRC2);
myFile.print(F("Size\t: "));
myFile.print(cartSize); myFile.print(cartSize);
myFile.println(F("MB")); myFile.println(F("MB"));
myFile.print(F("Save: ")); myFile.print(F("Save\t: "));
switch (saveType) { switch (saveType) {
case 1: case 1:
@ -3142,23 +3169,31 @@ void savesummary_N64(boolean checkfound, char crcStr[9], unsigned long timeElaps
break; break;
} }
myFile.print(F("Version: 1.")); myFile.print(F("Version\t: 1."));
myFile.println(romVersion); myFile.println(romVersion);
myFile.print(F("Saved To: ")); myFile.print(F("Saved To: "));
myFile.println(folder); myFile.println(folder);
myFile.print(F("CRC: "));
myFile.println(crcStr);
#ifdef RTC_installed
myFile.print(F("Dumped\t: "));
myFile.println(RTCStamp());
#endif
myFile.print(F("CRC\t: "));
myFile.print(crcStr);
if (checkfound) { if (checkfound) {
// Dump was a known good rom // Dump was a known good rom
myFile.println(F("Checksum matches")); // myFile.println(F("Checksum matches"));
myFile.println(" [Match]");
} }
else { else {
myFile.println(F("Checksum not found")); // myFile.println(F("Checksum not found"));
myFile.println(" [No Match]");
} }
myFile.print(F("Time: ")); myFile.print(F("Time\t: "));
myFile.println(timeElapsed); myFile.println(timeElapsed);
myFile.println(F(" ")); myFile.println(F(" "));