V6.1: Add support for exFAT SD cards (>32GB)

This commit is contained in:
sanni 2021-04-26 18:20:30 +02:00
parent f6e8d23110
commit e78d6e99e0
4 changed files with 18 additions and 18 deletions

View File

@ -2,7 +2,7 @@
Cartridge Reader for Arduino Mega2560 Cartridge Reader for Arduino Mega2560
Date: 26.04.2021 Date: 26.04.2021
Version: 6.0 Version: 6.1
SD lib: https://github.com/greiman/SdFat SD lib: https://github.com/greiman/SdFat
LCD lib: https://github.com/adafruit/Adafruit_SSD1306 LCD lib: https://github.com/adafruit/Adafruit_SSD1306
@ -39,10 +39,11 @@
Modman - N64 checksum comparison fix Modman - N64 checksum comparison fix
splash5 - EMS GB Smart cart, Wonderswan and NGP module splash5 - EMS GB Smart cart, Wonderswan and NGP module
jiyunomegami - Retrode Game Gear adapter support and code improvements jiyunomegami - Retrode Game Gear adapter support and code improvements
Kreeblah - NES database
**********************************************************************************/ **********************************************************************************/
char ver[5] = "6.0"; char ver[5] = "6.1";
/****************************************** /******************************************
Libraries Libraries
@ -52,10 +53,9 @@ char ver[5] = "6.0";
// SD Card // SD Card
#include "SdFat.h" #include "SdFat.h"
#define SD_FAT_TYPE 0 SdFs sd;
SdFat sd; FsFile myDir;
SdFile myFile; FsFile myFile;
SdFile myDir;
// Basic Libs // Basic Libs
#include <SPI.h> #include <SPI.h>
@ -433,7 +433,7 @@ void aboutScreen() {
display.drawBitmap(0, 0, sig, 128, 64, 1); display.drawBitmap(0, 0, sig, 128, 64, 1);
println_Msg(F("Cartridge Reader")); println_Msg(F("Cartridge Reader"));
println_Msg(F("github.com/sanni")); println_Msg(F("github.com/sanni"));
print_Msg(F("2020 Version ")); print_Msg(F("2021 Version "));
println_Msg(ver); println_Msg(ver);
println_Msg(F("")); println_Msg(F(""));
println_Msg(F("")); println_Msg(F(""));
@ -691,7 +691,7 @@ void setup() {
// Serial Begin // Serial Begin
Serial.begin(9600); Serial.begin(9600);
Serial.println(F("Cartridge Reader")); Serial.println(F("Cartridge Reader"));
Serial.println(F("2020 sanni")); Serial.println(F("2021 sanni"));
Serial.println(""); Serial.println("");
// LED Error // LED Error
rgb.setColor(0, 0, 255); rgb.setColor(0, 0, 255);

View File

@ -168,9 +168,9 @@ char flashID[5];
boolean flashfound = false; // NESmaker 39SF040 Flash Cart boolean flashfound = false; // NESmaker 39SF040 Flash Cart
// Files // Files
File sdFile; FsFile sdFile;
char fileCount[3]; char fileCount[3];
File nesFile; FsFile nesFile;
uint32_t prg_crc32; uint32_t prg_crc32;
uint32_t chr_crc32; uint32_t chr_crc32;
char filePRG[] = "PRG.bin"; char filePRG[] = "PRG.bin";
@ -589,7 +589,7 @@ int int_pow(int base, int exp) { // Power for int
/****************************************** /******************************************
CRC Functions CRC Functions
*****************************************/ *****************************************/
File crcFile; FsFile crcFile;
char tempCRC[9]; char tempCRC[9];
inline uint32_t updateCRC32(uint8_t ch, uint32_t crc) { inline uint32_t updateCRC32(uint8_t ch, uint32_t crc) {
@ -598,7 +598,7 @@ inline uint32_t updateCRC32(uint8_t ch, uint32_t crc) {
return tab_value ^ ((crc) >> 8); return tab_value ^ ((crc) >> 8);
} }
uint32_t crc32(File &file, uint32_t &charcnt) { uint32_t crc32(FsFile &file, uint32_t &charcnt) {
uint32_t oldcrc32 = 0xFFFFFFFF; uint32_t oldcrc32 = 0xFFFFFFFF;
charcnt = 0; charcnt = 0;
while (file.available()) { while (file.available()) {
@ -612,7 +612,7 @@ uint32_t crc32(File &file, uint32_t &charcnt) {
return ~oldcrc32; return ~oldcrc32;
} }
uint32_t crc32EEP(File &file, uint32_t &charcnt) { uint32_t crc32EEP(FsFile &file, uint32_t &charcnt) {
uint32_t oldcrc32 = 0xFFFFFFFF; uint32_t oldcrc32 = 0xFFFFFFFF;
charcnt = 0; charcnt = 0;
while (file.available()) { while (file.available()) {

View File

@ -425,7 +425,7 @@ void read_bank_PCE_RAM(uint32_t address_start, int block_index)
} }
//Get line from file and convert upper case to lower case //Get line from file and convert upper case to lower case
void skip_line(SdFile* readfile) void skip_line(FsFile* readfile)
{ {
int i = 0; int i = 0;
char str_buf; char str_buf;
@ -446,7 +446,7 @@ void skip_line(SdFile* readfile)
} }
//Get line from file and convert upper case to lower case //Get line from file and convert upper case to lower case
void get_line(char* str_buf, SdFile* readfile, uint8_t maxi) void get_line(char* str_buf, FsFile* readfile, uint8_t maxi)
{ {
int i = 0; int i = 0;
@ -487,7 +487,7 @@ uint32_t calculate_crc32(int n, unsigned char c[], uint32_t r)
void crc_search(char *file_p, char *folder_p, uint32_t rom_size, uint32_t crc) void crc_search(char *file_p, char *folder_p, uint32_t rom_size, uint32_t crc)
{ {
SdFile rom, script; FsFile rom, script;
uint32_t r, processedsize; uint32_t r, processedsize;
char gamename[100]; char gamename[100];
char crc_file[9], crc_search[9]; char crc_file[9], crc_search[9];

View File

@ -482,7 +482,7 @@ byte readBank_SNES(byte myBank, word myAddress) {
return tempByte; return tempByte;
} }
void readLoRomBanks( unsigned int start, unsigned int total, SdFile *file) void readLoRomBanks( unsigned int start, unsigned int total, FsFile *file)
{ {
byte buffer[1024] = { 0 }; byte buffer[1024] = { 0 };
@ -529,7 +529,7 @@ void readLoRomBanks( unsigned int start, unsigned int total, SdFile *file)
} }
} }
void readHiRomBanks( unsigned int start, unsigned int total, SdFile *file) void readHiRomBanks( unsigned int start, unsigned int total, FsFile *file)
{ {
byte buffer[1024] = { 0 }; byte buffer[1024] = { 0 };