Found a small checksum error bug in the compare_checksum(). Similar to the earlier checksum error bug in getCartInfo(). Need to make sure we compare 4 characters. The original sprintf code used "%X" which drops leading 0s resulting in an error.
void compare_checksum() {
...
char calcsumStr[5];
sprintf(calcsumStr, "%04X", calc_checksum(fileName, folder));
...
}
I discovered the bug dumping Super Power League 4 because it has checksum 0x01AA. I can now confirm that my SPC7110 code changes work with all 3 carts - FEOEZ, MDH, and SPL4.
The checksum verification code need to be tweaked for MDH - the checksum should be checksum*2. EDIT: Here's the calc_checksum code addition:
unsigned int calc_checksum (char* fileName, char* folder) {
...
else if (calcFilesize == 24 || calcFilesize == 28) {
// Momotarou Dentestu Happy Fix 3MB (24Mbit)
if ((calcFilesize == 24) && (romSizeExp = 0x0C)) {
for (unsigned long i = 0; i < myFile.fileSize(); i++) {
calcChecksum += myFile.read();
}
calcChecksum = 2 * calcChecksum;
}
else {
for (unsigned long i = 0; i < (calcFilesize / 16); i++ ) {
// Add all the bits in the 16Mbit chunks
for (unsigned long j = 0; j < 2097152; j++) {
calcChecksum += myFile.read();
}
// Add all the chunks together
calcChecksum += calcChecksumChunk;
calcChecksumChunk = 0;
}
// Add the 8Mbit rest
for (unsigned long j = 0; j < 1048576; j++) {
calcChecksumChunk += myFile.read();
}
calcChecksum += 2 * calcChecksumChunk;
}
}
...
}