Skip to content

Commit

Permalink
remove duplicate code in printing CRC
Browse files Browse the repository at this point in the history
  • Loading branch information
smesgr9000 committed May 1, 2024
1 parent d233387 commit 2826ded
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions Cart_Reader/Cart_Reader.ino
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ uint32_t calculateCRC(FsFile& infile) {
}

// Calculate rom's CRC32 from SD
uint32_t calculateCRC(char* fileName, char* folder, int offset) {
uint32_t calculateCRC(char* fileName, char* folder, unsigned long offset) {
FsFile infile;
uint32_t result;

Expand All @@ -458,13 +458,8 @@ uint32_t calculateCRC(char* fileName, char* folder, int offset) {
#if (defined(ENABLE_ODY2) || defined(ENABLE_ARC) || defined(ENABLE_FAIRCHILD) || defined(ENABLE_MSX) || defined(ENABLE_POKE) || defined(ENABLE_2600) || defined(ENABLE_5200) || defined(ENABLE_7800) || defined(ENABLE_C64) || defined(ENABLE_VECTREX) || defined(ENABLE_NES))

void printCRC(char* checkFile, uint32_t* crcCopy, unsigned long offset) {
uint32_t crc;
uint32_t crc = calculateCRC(checkFile, folder, offset);
char tempCRC[9];
FsFile crcFile = sd.open(checkFile);

crcFile.seek(offset);
crc = calculateCRC(crcFile);
crcFile.close();

if (crcCopy != NULL) {
*crcCopy = crc;
Expand Down

0 comments on commit 2826ded

Please sign in to comment.