Print checksum and header CRC32 when searching database

This commit is contained in:
sanni 2022-10-27 23:43:46 +02:00
parent 1a081eb6f6
commit 5357dea659
4 changed files with 124 additions and 131 deletions

View File

@ -4,7 +4,7 @@
This project represents a community-driven effort to provide
an easy to build and easy to modify cartridge dumper.
Date: 13.10.2022
Date: 27.10.2022
Version: 10.3
SD lib: https://github.com/greiman/SdFat

View File

@ -30,58 +30,58 @@
// Supported Mapper Array (iNES Mapper #s)
// Format = {mapper,prglo,prghi,chrlo,chrhi,ramlo,ramhi}
static const byte PROGMEM mapsize[] = {
0, 0, 1, 0, 1, 0, 2, // nrom [sram r/w]
1, 1, 5, 0, 5, 0, 3, // mmc1 [sram r/w]
2, 3, 4, 0, 0, 0, 0, // uxrom
3, 0, 1, 0, 3, 0, 0, // cnrom
4, 1, 5, 0, 6, 0, 1, // mmc3/mmc6 [sram/prgram r/w]
5, 3, 5, 5, 7, 0, 3, // mmc5 [sram r/w]
7, 2, 4, 0, 0, 0, 0, // axrom
9, 3, 3, 5, 5, 0, 0, // mmc2 (punch out)
10, 3, 4, 4, 5, 1, 1, // mmc4 [sram r/w]
11, 1, 3, 1, 5, 0, 0, // Color Dreams [UNLICENSED]
13, 1, 1, 0, 0, 0, 0, // cprom (videomation)
15, 6, 6, 0, 0, 0, 0, // K-1029/K-1030P [UNLICENSED]
16, 3, 4, 5, 6, 0, 1, // bandai x24c02 [eep r/w]
18, 3, 4, 5, 6, 0, 1, // jaleco ss8806 [sram r/w]
19, 3, 4, 5, 6, 0, 1, // namco 106/163 [sram/prgram r/w]
21, 4, 4, 5, 6, 0, 1, // vrc4a/vrc4c [sram r/w]
22, 3, 3, 5, 5, 0, 0, // vrc2a
23, 3, 3, 5, 6, 0, 0, // vrc2b/vrc4e
24, 4, 4, 5, 5, 0, 0, // vrc6a (akumajou densetsu)
25, 3, 4, 5, 6, 0, 1, // vrc2c/vrc4b/vrc4d [sram r/w]
26, 4, 4, 5, 6, 1, 1, // vrc6b [sram r/w]
30, 4, 5, 0, 0, 0, 0, // unrom 512 (NESmaker) [UNLICENSED]
32, 3, 4, 5, 5, 0, 0, // irem g-101
33, 3, 4, 5, 6, 0, 0, // taito tc0190
34, 3, 3, 0, 0, 0, 0, // bnrom [nina-1 NOT SUPPORTED]
37, 4, 4, 6, 6, 0, 0, // (super mario bros + tetris + world cup)
45, 3, 6, 0, 8, 0, 0, // ga23c asic multicart [UNLICENSED]
47, 4, 4, 6, 6, 0, 0, // (super spike vball + world cup)
48, 3, 4, 6, 6, 0, 0, // taito tc0690
58, 1, 6, 1, 6, 0, 0, // BMC-GKB (C)NROM-based multicarts, duplicate of mapper 213 [UNLICENSED]
60, 2, 2, 3, 3, 0, 0, // Reset-based NROM-128 4-in-1 multicarts [UNLICENSED]
62, 7, 7, 8, 8, 0, 0, // K-1017P [UNLICENSED]
64, 2, 3, 4, 5, 0, 0, // tengen rambo-1 [UNLICENSED]
65, 3, 4, 5, 6, 0, 0, // irem h-3001
66, 2, 3, 2, 3, 0, 0, // gxrom/mhrom
67, 3, 3, 5, 5, 0, 0, // sunsoft 3
68, 3, 3, 5, 6, 0, 1, // sunsoft 4 [sram r/w]
69, 3, 4, 5, 6, 0, 1, // sunsoft fme-7/5a/5b [sram r/w]
70, 3, 3, 5, 5, 0, 0, // bandai
71, 2, 4, 0, 0, 0, 0, // camerica/codemasters [UNLICENSED]
72, 3, 3, 5, 5, 0, 0, // jaleco jf-17
73, 3, 3, 0, 0, 0, 0, // vrc3 (salamander)
75, 3, 3, 5, 5, 0, 0, // vrc1
76, 3, 3, 5, 5, 0, 0, // namco 109 variant (megami tensei: digital devil story)
77, 3, 3, 3, 3, 0, 0, // (napoleon senki)
78, 3, 3, 5, 5, 0, 0, // irem 74hc161/32
79, 1, 2, 2, 3, 0, 0, // NINA-03/06 by AVE [UNLICENSED]
80, 3, 3, 5, 6, 0, 1, // taito x1-005 [prgram r/w]
82, 3, 3, 5, 6, 0, 1, // taito x1-017 [prgram r/w]
85, 3, 5, 0, 5, 0, 1, // vrc7 [sram r/w]
86, 3, 3, 4, 4, 0, 0, // jaleco jf-13 (moero pro yakyuu)
87, 0, 1, 2, 3, 0, 0, // Jaleco/Konami CNROM (DIS_74X139X74)
0, 0, 1, 0, 1, 0, 2, // nrom [sram r/w]
1, 1, 5, 0, 5, 0, 3, // mmc1 [sram r/w]
2, 3, 4, 0, 0, 0, 0, // uxrom
3, 0, 1, 0, 3, 0, 0, // cnrom
4, 1, 5, 0, 6, 0, 1, // mmc3/mmc6 [sram/prgram r/w]
5, 3, 5, 5, 7, 0, 3, // mmc5 [sram r/w]
7, 2, 4, 0, 0, 0, 0, // axrom
9, 3, 3, 5, 5, 0, 0, // mmc2 (punch out)
10, 3, 4, 4, 5, 1, 1, // mmc4 [sram r/w]
11, 1, 3, 1, 5, 0, 0, // Color Dreams [UNLICENSED]
13, 1, 1, 0, 0, 0, 0, // cprom (videomation)
15, 6, 6, 0, 0, 0, 0, // K-1029/K-1030P [UNLICENSED]
16, 3, 4, 5, 6, 0, 1, // bandai x24c02 [eep r/w]
18, 3, 4, 5, 6, 0, 1, // jaleco ss8806 [sram r/w]
19, 3, 4, 5, 6, 0, 1, // namco 106/163 [sram/prgram r/w]
21, 4, 4, 5, 6, 0, 1, // vrc4a/vrc4c [sram r/w]
22, 3, 3, 5, 5, 0, 0, // vrc2a
23, 3, 3, 5, 6, 0, 0, // vrc2b/vrc4e
24, 4, 4, 5, 5, 0, 0, // vrc6a (akumajou densetsu)
25, 3, 4, 5, 6, 0, 1, // vrc2c/vrc4b/vrc4d [sram r/w]
26, 4, 4, 5, 6, 1, 1, // vrc6b [sram r/w]
30, 4, 5, 0, 0, 0, 0, // unrom 512 (NESmaker) [UNLICENSED]
32, 3, 4, 5, 5, 0, 0, // irem g-101
33, 3, 4, 5, 6, 0, 0, // taito tc0190
34, 3, 3, 0, 0, 0, 0, // bnrom [nina-1 NOT SUPPORTED]
37, 4, 4, 6, 6, 0, 0, // (super mario bros + tetris + world cup)
45, 3, 6, 0, 8, 0, 0, // ga23c asic multicart [UNLICENSED]
47, 4, 4, 6, 6, 0, 0, // (super spike vball + world cup)
48, 3, 4, 6, 6, 0, 0, // taito tc0690
58, 1, 6, 1, 6, 0, 0, // BMC-GKB (C)NROM-based multicarts, duplicate of mapper 213 [UNLICENSED]
60, 2, 2, 3, 3, 0, 0, // Reset-based NROM-128 4-in-1 multicarts [UNLICENSED]
62, 7, 7, 8, 8, 0, 0, // K-1017P [UNLICENSED]
64, 2, 3, 4, 5, 0, 0, // tengen rambo-1 [UNLICENSED]
65, 3, 4, 5, 6, 0, 0, // irem h-3001
66, 2, 3, 2, 3, 0, 0, // gxrom/mhrom
67, 3, 3, 5, 5, 0, 0, // sunsoft 3
68, 3, 3, 5, 6, 0, 1, // sunsoft 4 [sram r/w]
69, 3, 4, 5, 6, 0, 1, // sunsoft fme-7/5a/5b [sram r/w]
70, 3, 3, 5, 5, 0, 0, // bandai
71, 2, 4, 0, 0, 0, 0, // camerica/codemasters [UNLICENSED]
72, 3, 3, 5, 5, 0, 0, // jaleco jf-17
73, 3, 3, 0, 0, 0, 0, // vrc3 (salamander)
75, 3, 3, 5, 5, 0, 0, // vrc1
76, 3, 3, 5, 5, 0, 0, // namco 109 variant (megami tensei: digital devil story)
77, 3, 3, 3, 3, 0, 0, // (napoleon senki)
78, 3, 3, 5, 5, 0, 0, // irem 74hc161/32
79, 1, 2, 2, 3, 0, 0, // NINA-03/06 by AVE [UNLICENSED]
80, 3, 3, 5, 6, 0, 1, // taito x1-005 [prgram r/w]
82, 3, 3, 5, 6, 0, 1, // taito x1-017 [prgram r/w]
85, 3, 5, 0, 5, 0, 1, // vrc7 [sram r/w]
86, 3, 3, 4, 4, 0, 0, // jaleco jf-13 (moero pro yakyuu)
87, 0, 1, 2, 3, 0, 0, // Jaleco/Konami CNROM (DIS_74X139X74)
88, 3, 3, 5, 5, 0, 0, // namco (dxrom variant)
89, 3, 3, 5, 5, 0, 0, // sunsoft 2 variant (tenka no goikenban: mito koumon)
92, 4, 4, 5, 5, 0, 0, // jaleco jf-19/jf-21
@ -3060,16 +3060,16 @@ void readPRG(boolean readrom) {
}
}
break;
case 15:
banks = int_pow(2, prgsize);
for(int i = 0; i < banks; i += 2){
for (int i = 0; i < banks; i += 2) {
write_prg_byte(0x8000, i);
for (word address = 0x0; address < 0x8000; address += 512) {
dumpPRG(base, address);
}
}
break;
break;
case 16:
case 159: // 128K/256K
@ -3235,7 +3235,7 @@ void readPRG(boolean readrom) {
dumpPRG(base, address);
}
break;
case 62:
banks = int_pow(2, prgsize) / 2;
for (int i = 0; i < banks; i++) {
@ -3245,7 +3245,7 @@ void readPRG(boolean readrom) {
}
}
break;
case 58:
case 213:
banks = int_pow(2, prgsize) / 2;
@ -3256,7 +3256,7 @@ void readPRG(boolean readrom) {
}
}
break;
case 60:
for (word address = 0; address < 0x4000; address += 512) {
dumpPRG(base, address);
@ -3269,7 +3269,7 @@ void readPRG(boolean readrom) {
}
}
break;
case 66: // 64K/128K
banks = int_pow(2, prgsize) / 2;
for (int i = 0; i < banks; i++) { // 64K/128K
@ -3496,7 +3496,7 @@ void readPRG(boolean readrom) {
}
}
break;
case 200:
banks = int_pow(2, prgsize);
for (int i = 0; i < banks; i++) {
@ -3516,7 +3516,7 @@ void readPRG(boolean readrom) {
}
}
break;
case 202:
banks = int_pow(2, prgsize);
for (int i = 0; i < banks; i++) {
@ -3547,7 +3547,7 @@ void readPRG(boolean readrom) {
}
}
break;
case 225:
case 255:
banks = int_pow(2, prgsize) / 2;
@ -3557,21 +3557,21 @@ void readPRG(boolean readrom) {
dumpPRG(base, address);
}
}
break;
break;
case 229:
write_prg_byte(0x8000, 0);
for (word address = 0x0; address < 0x8000; address += 512) {
dumpPRG(base, address);
}
dumpPRG(base, address);
}
for (int i = 2; i < 32; i++) {
write_prg_byte(0x8000+i, i);
write_prg_byte(0x8000 + i, i);
for (word address = 0; address < 0x4000; address += 512) {
dumpPRG(base, address);
}
}
break;
case 232:
banks = int_pow(2, prgsize) / 4;
for (int outerbank = 0; outerbank < 4; outerbank++) {
@ -3583,39 +3583,39 @@ void readPRG(boolean readrom) {
}
}
}
break;
break;
case 235:
for (int i = 0; i < 32; i++) {
write_prg_byte(0x8000+i, 0);
write_prg_byte(0x8000 + i, 0);
for (word address = 0x0; address < 0x8000; address += 512) {
dumpPRG(base, address);
dumpPRG(base, address);
}
}
if (prgsize > 6) {
for (int i = 32; i < 64; i++) {
write_prg_byte(0x80E0+i, 0);
write_prg_byte(0x80E0 + i, 0);
for (word address = 0x0; address < 0x8000; address += 512) {
dumpPRG(base, address);
dumpPRG(base, address);
}
}
if (prgsize > 7) {
for (int i = 64; i < 96; i++) {
write_prg_byte(0x81E0+i, 0);
write_prg_byte(0x81E0 + i, 0);
for (word address = 0x0; address < 0x8000; address += 512) {
dumpPRG(base, address);
dumpPRG(base, address);
}
}
for (int i = 96; i < 128; i++) {
write_prg_byte(0x82E0+i, 0);
write_prg_byte(0x82E0 + i, 0);
for (word address = 0x0; address < 0x8000; address += 512) {
dumpPRG(base, address);
dumpPRG(base, address);
}
}
}
}
break;
break;
case 240:
banks = int_pow(2, prgsize) / 2;
for (int i = 0; i < banks; i++) {
@ -3624,30 +3624,30 @@ void readPRG(boolean readrom) {
dumpPRG(base, address);
}
}
break;
case 242: // total size is 640k THIS IS NORMAL
for (int i = 0; i < 32; i++) { // dump 1st chip of 512k
break;
case 242: // total size is 640k THIS IS NORMAL
for (int i = 0; i < 32; i++) { // dump 1st chip of 512k
write_prg_byte(0x8400 + (i * 4), 0);
for (word address = 0x0; address < 0x4000; address += 512) {
dumpPRG(base, address);
}
}
for (int i = 0; i < 8; i++) { // dump 2nd chip of 128k
for (int i = 0; i < 8; i++) { // dump 2nd chip of 128k
write_prg_byte(0x8000 + (i * 4), 0);
for (word address = 0x0; address < 0x4000; address += 512) {
dumpPRG(base, address);
}
}
break;
break;
case 246:
banks = int_pow(2, prgsize) / 2;
for (int i = 0; i < banks; i += 4) {
write_prg_byte(0x6000, (i | 0));
write_prg_byte(0x6001, (i | 1));
write_prg_byte(0x6002, (i | 2));
write_prg_byte(0x6003, (i | 3));
write_prg_byte(0x6000, (i | 0));
write_prg_byte(0x6001, (i | 1));
write_prg_byte(0x6002, (i | 2));
write_prg_byte(0x6003, (i | 3));
for (word address = 0x0; address < 0x8000; address += 512) {
dumpPRG(base, address);
}
@ -4004,7 +4004,7 @@ void readCHR(boolean readrom) {
}
}
break;
case 58:
case 213:
banks = int_pow(2, chrsize) / 2;
@ -4015,7 +4015,7 @@ void readCHR(boolean readrom) {
}
}
break;
case 60:
for (int i = 0; i < 4; i++) {
write_prg_byte(0x8D8D, i);
@ -4025,7 +4025,7 @@ void readCHR(boolean readrom) {
}
}
break;
case 62:
banks = int_pow(2, chrsize) / 2;
for (int i = 0; i < banks; i++) {
@ -4034,7 +4034,7 @@ void readCHR(boolean readrom) {
dumpCHR(address);
}
}
break;
break;
case 67: // 128K
banks = int_pow(2, chrsize) * 2;
@ -4277,7 +4277,7 @@ void readCHR(boolean readrom) {
}
}
break;
case 200:
banks = int_pow(2, chrsize) / 2;
for (int i = 0; i < banks; i++) {
@ -4289,15 +4289,15 @@ void readCHR(boolean readrom) {
break;
case 201:
banks = int_pow(2, chrsize) / 2;
for (int i = 0; i < banks; i++) {
write_prg_byte(0x8000 + (i & 0xFF), 0);
for (word address = 0x0; address < 0x2000; address += 512) {
dumpCHR(address);
banks = int_pow(2, chrsize) / 2;
for (int i = 0; i < banks; i++) {
write_prg_byte(0x8000 + (i & 0xFF), 0);
for (word address = 0x0; address < 0x2000; address += 512) {
dumpCHR(address);
}
}
}
break;
break;
case 202:
banks = int_pow(2, chrsize) / 2;
for (int i = 0; i < banks; i++) {
@ -4316,7 +4316,7 @@ void readCHR(boolean readrom) {
dumpCHR(address);
}
}
break;
break;
case 210: // 128K/256K
banks = int_pow(2, chrsize) * 4;
@ -4335,9 +4335,9 @@ void readCHR(boolean readrom) {
}
}
break;
case 225:
case 255:
case 225:
case 255:
banks = int_pow(2, chrsize) / 2;
for (int i = 0; i < banks; i++) {
write_prg_byte(0x8000 + i, i);
@ -4345,21 +4345,21 @@ void readCHR(boolean readrom) {
dumpCHR(address);
}
}
break;
break;
case 229: // BMC 31-IN-1
case 229: // BMC 31-IN-1
for (int i = 0; i < 32; i++) {
write_prg_byte(0x8000+i, i);
write_prg_byte(0x8000 + i, i);
for (word address = 0; address < 0x2000; address += 512) {
dumpCHR(address);
}
}
break;
case 240:
banks = int_pow(2, chrsize) / 2;
for (int i = 0; i < banks; i++) {
write_prg_byte(0x5FFF, (i & 0xF));
write_prg_byte(0x5FFF, (i & 0xF));
for (word address = 0x0; address < 0x2000; address += 512) {
dumpCHR(address);
}
@ -4378,7 +4378,6 @@ void readCHR(boolean readrom) {
}
}
break;
}
if (!readrom) {
myFile.flush();
@ -5171,4 +5170,4 @@ void writeFLASH() {
#endif
//******************************************
// End of File
//******************************************
//******************************************

View File

@ -69,11 +69,9 @@ void _smsMenu() {
readROM_SMS();
if ((retrode_mode && !retrode_mode_sms) || retron_mode) {
compareCRC("gg.txt", 0, 1, 0);
}
else if (raphnet_mode_sg1000) {
} else if (raphnet_mode_sg1000) {
compareCRC("sg1000.txt", 0, 1, 0);
}
else {
} else {
compareCRC("sms.txt", 0, 1, 0);
}
#ifdef global_log
@ -568,12 +566,10 @@ void readROM_SMS() {
if ((retrode_mode && !retrode_mode_sms) || retron_mode) {
strcat(fileName, ".gg");
sprintf(folder, "GG/ROM/%s/%d", romName, foldern);
}
else if (raphnet_mode_sg1000) {
} else if (raphnet_mode_sg1000) {
strcat(fileName, ".sg");
sprintf(folder, "SG1000/ROM/%s/%d", romName, foldern);
}
else {
} else {
strcat(fileName, ".sms");
sprintf(folder, "SMS/ROM/%s/%d", romName, foldern);
}
@ -762,4 +758,4 @@ void writeSRAM_SMS() {
//******************************************
// End of File
//******************************************
//******************************************

View File

@ -862,7 +862,9 @@ void checkAltConf(char crcStr[9]) {
if (myFile.open("snes.txt", O_READ)) {
// Get cart info
display_Clear();
print_Msg(F("Searching database..."));
println_Msg(F("Searching database..."));
print_Msg(F("Checksum: "));
println_Msg(checksumStr);
display_Update();
while (myFile.available()) {
@ -880,7 +882,8 @@ void checkAltConf(char crcStr[9]) {
// Check if checksum string is a match else go to next entry in database
if (strcmp(tempStr2, checksumStr) == 0) {
print_Msg(F("..."));
print_Msg(F("Header CRC32: "));
println_Msg(crcStr);
display_Update();
// Skip the , in the file
@ -906,7 +909,6 @@ void checkAltConf(char crcStr[9]) {
// Some games have the same checksum, so compare CRC32 of header area with database too
if (strcmp(tempStr3, crcStr) == 0) {
println_Msg(F(""));
println_Msg(F("Found"));
display_Update();
// Game found, check if ROM sizes differ but only change ROM size if non- standard size found in database, else trust the header to be right and the database to be wrong
@ -922,10 +924,6 @@ void checkAltConf(char crcStr[9]) {
print_Msg(numBanks);
print_Msg(F(" -> "));
println_Msg(numBanks2);
println_Msg(F(""));
println_Msg(F(""));
print_Msg(F("Header CRC: "));
println_Msg(crcStr);
display_Update();
delay(1000);
romSize = romSize2;