mirror of
https://github.com/sanni/cartreader.git
synced 2024-11-15 01:15:06 +01:00
Update MD.ino
- Moved code to retrieve the cart name earlier and possibly rely on it to identify a game instead of game ID + CRC - Moved code to regroup the different game checks - Some comments and conditions get reduced
This commit is contained in:
parent
d5252f2211
commit
1d2a016d3c
@ -760,13 +760,26 @@ void getCartInfo_MD() {
|
|||||||
id[c + 1] = loByte;
|
id[c + 1] = loByte;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get cart name
|
||||||
|
for (byte c = 0; c < 48; c += 2) {
|
||||||
|
// split word
|
||||||
|
word myWord = readWord_MD((0x150 + c) / 2);
|
||||||
|
byte loByte = myWord & 0xFF;
|
||||||
|
byte hiByte = myWord >> 8;
|
||||||
|
|
||||||
|
// write to buffer
|
||||||
|
sdBuffer[c] = hiByte;
|
||||||
|
sdBuffer[c + 1] = loByte;
|
||||||
|
}
|
||||||
|
romName[copyToRomName_MD(romName, sdBuffer, sizeof(romName) - 1)] = 0;
|
||||||
|
|
||||||
// Identify games using SVP chip
|
// Identify games using SVP chip
|
||||||
if (!strncmp("GM MK-1229 ", id, 11) || !strncmp("GM G-7001 ", id, 11)) // Virtua Racing (E/U/J)
|
if (!strncmp("GM MK-1229 ", id, 11) || !strncmp("GM G-7001 ", id, 11)) // Virtua Racing (E/U/J)
|
||||||
isSVP = 1;
|
isSVP = 1;
|
||||||
else
|
else
|
||||||
isSVP = 0;
|
isSVP = 0;
|
||||||
|
|
||||||
// Fix cartridge sizes according to no-intro database
|
// Fix cartridge sizes and checksums according to no-intro database
|
||||||
if (cartSize == 0x400000) {
|
if (cartSize == 0x400000) {
|
||||||
switch (chksum) {
|
switch (chksum) {
|
||||||
case 0xCE25: // Super Street Fighter 2 (J) 40Mbit
|
case 0xCE25: // Super Street Fighter 2 (J) 40Mbit
|
||||||
@ -893,115 +906,108 @@ void getCartInfo_MD() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fatman (Japan).md
|
// Fatman (Japan)
|
||||||
if (!strncmp("GM T-44013 ", id, 11) && (chksum == 0xFFFF)) {
|
if (!strncmp("GM T-44013 ", id, 11) && (chksum == 0xFFFF)) {
|
||||||
chksum = 0xC560;
|
chksum = 0xC560;
|
||||||
cartSize = 0xA0000;
|
cartSize = 0xA0000;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Beggar Prince (Rev 1)(Aftermarket)
|
// Slaughter Sport (USA)
|
||||||
|
if (!strncmp("GMT5604600jJ", romName, 12) && (chksum == 0xFFFF)) {
|
||||||
|
strcpy(romName, "SLAUGHTERSPORT");
|
||||||
|
chksum = 0x6BAE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fixes aftermarket cartridges
|
||||||
|
// Beggar Prince (Rev 1)
|
||||||
if (!strncmp("SF-001", id, 6) && (chksum == 0x3E08)) {
|
if (!strncmp("SF-001", id, 6) && (chksum == 0x3E08)) {
|
||||||
cartSize = 0x400000;
|
cartSize = 0x400000;
|
||||||
}
|
}
|
||||||
|
// Legend of Wukong
|
||||||
// Legend of Wukong (Aftermarket)
|
|
||||||
if (!strncmp("SF-002", id, 6) && (chksum == 0x12B0)) {
|
if (!strncmp("SF-002", id, 6) && (chksum == 0x12B0)) {
|
||||||
chksum = 0x45C6;
|
chksum = 0x45C6;
|
||||||
}
|
}
|
||||||
|
// YM2612 Instrument Editor
|
||||||
// YM2612 Instrument Editor (Aftermarket)
|
|
||||||
if (!strncmp("GM 10101010", id, 11) && (chksum == 0xC439)) {
|
if (!strncmp("GM 10101010", id, 11) && (chksum == 0xC439)) {
|
||||||
chksum = 0x21B0;
|
chksum = 0x21B0;
|
||||||
cartSize = 0x100000;
|
cartSize = 0x100000;
|
||||||
}
|
}
|
||||||
|
// Technoptimistic
|
||||||
// Technoptimistic (Aftermarket)
|
|
||||||
if (!strncmp("MU REMUTE01", id, 11) && (chksum == 0x0000)) {
|
if (!strncmp("MU REMUTE01", id, 11) && (chksum == 0x0000)) {
|
||||||
chksum = 0xB55C;
|
chksum = 0xB55C;
|
||||||
cartSize = 0x400000;
|
cartSize = 0x400000;
|
||||||
}
|
}
|
||||||
|
// Decoder
|
||||||
// Decoder (Aftermarket)
|
|
||||||
if (!strncmp("GM REMUTE02", id, 11) && (chksum == 0x0000)) {
|
if (!strncmp("GM REMUTE02", id, 11) && (chksum == 0x0000)) {
|
||||||
chksum = 0x5426;
|
chksum = 0x5426;
|
||||||
cartSize = 0x400000;
|
cartSize = 0x400000;
|
||||||
}
|
}
|
||||||
|
// Handy Harvy
|
||||||
// Handy Harvy (Aftermarket)
|
|
||||||
if (!strncmp("GM HHARVYSG", id, 11) && (chksum == 0x0000)) {
|
if (!strncmp("GM HHARVYSG", id, 11) && (chksum == 0x0000)) {
|
||||||
chksum = 0xD9D2;
|
chksum = 0xD9D2;
|
||||||
cartSize = 0x100000;
|
cartSize = 0x100000;
|
||||||
}
|
}
|
||||||
|
// Jim Power - The Lost Dimension in 3D
|
||||||
// Jim Power - The Lost Dimension in 3D (Aftermarket)
|
|
||||||
if (!strncmp("GM T-107036", id, 11) && (chksum == 0x0000)) {
|
if (!strncmp("GM T-107036", id, 11) && (chksum == 0x0000)) {
|
||||||
chksum = 0xAA28;
|
chksum = 0xAA28;
|
||||||
}
|
}
|
||||||
|
// mikeyeldey95
|
||||||
// mikeyeldey95 (Aftermarket)
|
|
||||||
if (!strncmp("GM 00000000-43", id, 14) && (chksum == 0x0000)) {
|
if (!strncmp("GM 00000000-43", id, 14) && (chksum == 0x0000)) {
|
||||||
chksum = 0x921B;
|
chksum = 0x921B;
|
||||||
cartSize = 0x400000;
|
cartSize = 0x400000;
|
||||||
}
|
}
|
||||||
|
// Enryuu Seiken Xiao-Mei
|
||||||
// Enryuu Seiken Xiao-Mei (Aftermarket)
|
|
||||||
if (!strncmp("GM 00000000-00", id, 14) && (chksum == 0x1E0C)) {
|
if (!strncmp("GM 00000000-00", id, 14) && (chksum == 0x1E0C)) {
|
||||||
chksum = 0xE7E5;
|
chksum = 0xE7E5;
|
||||||
cartSize = 0x400000;
|
cartSize = 0x400000;
|
||||||
}
|
}
|
||||||
|
// Life on Earth - Reimagined
|
||||||
// Life on Earth - Reimagined (Aftermarket)
|
|
||||||
if (!strncmp("GM 00000000-00", id, 14) && (chksum == 0x6BD5)) {
|
if (!strncmp("GM 00000000-00", id, 14) && (chksum == 0x6BD5)) {
|
||||||
chksum = 0x1FEA;
|
chksum = 0x1FEA;
|
||||||
cartSize = 0x400000;
|
cartSize = 0x400000;
|
||||||
}
|
}
|
||||||
|
// Sasha Darko's Sacred Line I
|
||||||
// Sasha Darko's Sacred Line I (Aftermarket)
|
|
||||||
if (!strncmp("GM 00000005-00", id, 14) && (chksum == 0x9F34)) {
|
if (!strncmp("GM 00000005-00", id, 14) && (chksum == 0x9F34)) {
|
||||||
chksum = 0xA094;
|
chksum = 0xA094;
|
||||||
cartSize = 0x400000;
|
cartSize = 0x400000;
|
||||||
}
|
}
|
||||||
|
// Sasha Darko's Sacred Line II
|
||||||
// Sasha Darko's Sacred Line II (Aftermarket)
|
|
||||||
if (!strncmp("GM 00000005-00", id, 14) && (chksum == 0x0E9B)) {
|
if (!strncmp("GM 00000005-00", id, 14) && (chksum == 0x0E9B)) {
|
||||||
chksum = 0x6B4B;
|
chksum = 0x6B4B;
|
||||||
cartSize = 0x400000;
|
cartSize = 0x400000;
|
||||||
}
|
}
|
||||||
|
// Sasha Darko's Sacred Line (Watermelon Release)
|
||||||
// Sasha Darko's Sacred Line (Watermelon Release) (Aftermarket)
|
|
||||||
if (!strncmp("GM T-574323-00", id, 14) && (chksum == 0xAEDD)) {
|
if (!strncmp("GM T-574323-00", id, 14) && (chksum == 0xAEDD)) {
|
||||||
cartSize = 0x400000;
|
cartSize = 0x400000;
|
||||||
}
|
}
|
||||||
|
// Kromasphere
|
||||||
// Kromasphere (Aftermarket)
|
|
||||||
if (!strncmp("GM MK-0000 -00", id, 14) && (chksum == 0xC536)) {
|
if (!strncmp("GM MK-0000 -00", id, 14) && (chksum == 0xC536)) {
|
||||||
chksum = 0xFAB1;
|
chksum = 0xFAB1;
|
||||||
cartSize = 0x200000;
|
cartSize = 0x200000;
|
||||||
}
|
}
|
||||||
|
// YM2017
|
||||||
// YM2017 (Aftermarket)
|
|
||||||
if (!strncmp("GM CSET0001-02", id, 14) && (chksum == 0x0000)) {
|
if (!strncmp("GM CSET0001-02", id, 14) && (chksum == 0x0000)) {
|
||||||
chksum = 0xE3A9;
|
chksum = 0xE3A9;
|
||||||
}
|
}
|
||||||
|
// The Curse of Illmore Bay
|
||||||
// The Curse of Illmore Bay (Aftermarket)
|
|
||||||
if (!strncmp("1774 ", id, 14) && (chksum == 0x0000)) {
|
if (!strncmp("1774 ", id, 14) && (chksum == 0x0000)) {
|
||||||
chksum = 0x6E34;
|
chksum = 0x6E34;
|
||||||
cartSize = 0x400000;
|
cartSize = 0x400000;
|
||||||
}
|
}
|
||||||
|
// Coffee Crisis
|
||||||
// Coffee Crisis (Aftermarket)
|
|
||||||
if (!strncmp("JN-20160131-03", id, 14) && (chksum == 0x0000)) {
|
if (!strncmp("JN-20160131-03", id, 14) && (chksum == 0x0000)) {
|
||||||
chksum = 0x8040;
|
chksum = 0x8040;
|
||||||
cartSize = 0x400000;
|
cartSize = 0x400000;
|
||||||
}
|
}
|
||||||
|
// Romeow & Julicat
|
||||||
|
if (!strncmp("ROMEOWJULICAT", romName, 13) && (chksum == 0x0000)) {
|
||||||
|
chksum = 0xB094;
|
||||||
|
cartSize = 0x200000;
|
||||||
|
}
|
||||||
|
|
||||||
// Sonic & Knuckles Check
|
// Sonic & Knuckles checks
|
||||||
SnKmode = 0;
|
SnKmode = 0;
|
||||||
if (chksum == 0xDFB3) {
|
if (!strcmp("GM MK-1563 -00", id) && (chksum == 0xDFB3)) {
|
||||||
|
|
||||||
//Sonic & Knuckles ID:GM MK-1563 -00
|
|
||||||
if (!strcmp("GM MK-1563 -00", id)) {
|
|
||||||
char labelLockon[17];
|
char labelLockon[17];
|
||||||
memset(labelLockon, 0, 17);
|
memset(labelLockon, 0, 17);
|
||||||
|
|
||||||
@ -1039,21 +1045,15 @@ void getCartInfo_MD() {
|
|||||||
idLockon[c + 1] = loByte;
|
idLockon[c + 1] = loByte;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strncmp("GM 00001009-0", idLockon, 13) || !strncmp("GM 00004049-0", idLockon, 13)) {
|
if (!strncmp("GM 00001009-0", idLockon, 13) || !strncmp("GM 00004049-0", idLockon, 13)) { // Sonic1 ID:GM 00001009-0? or GM 00004049-0?
|
||||||
//Sonic1 ID:GM 00001009-0? or GM 00004049-0?
|
|
||||||
SnKmode = 2;
|
SnKmode = 2;
|
||||||
} else if (!strcmp("GM 00001051-00", idLockon) || !strcmp("GM 00001051-01", idLockon) || !strcmp("GM 00001051-02", idLockon)) {
|
} else if (!strcmp("GM 00001051-00", idLockon) || !strcmp("GM 00001051-01", idLockon) || !strcmp("GM 00001051-02", idLockon)) { // Sonic2 ID:GM 00001051-00 or GM 00001051-01 or GM 00001051-02
|
||||||
//Sonic2 ID:GM 00001051-00 or GM 00001051-01 or GM 00001051-02
|
|
||||||
SnKmode = 3;
|
SnKmode = 3;
|
||||||
|
|
||||||
// Prepare Sonic2 Banks
|
// Prepare Sonic2 Banks
|
||||||
writeSSF2Map(0x509878, 1); // 0xA130F1
|
writeSSF2Map(0x509878, 1); // 0xA130F1
|
||||||
|
} else if (!strcmp("GM MK-1079 -00", idLockon)) { // Sonic3 ID:GM MK-1079 -00
|
||||||
} else if (!strcmp("GM MK-1079 -00", idLockon)) {
|
|
||||||
//Sonic3 ID:GM MK-1079 -00
|
|
||||||
SnKmode = 4;
|
SnKmode = 4;
|
||||||
} else {
|
} else { // Other game
|
||||||
//Other game
|
|
||||||
SnKmode = 5;
|
SnKmode = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1061,7 +1061,6 @@ void getCartInfo_MD() {
|
|||||||
SnKmode = 1;
|
SnKmode = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Serial EEPROM Check
|
// Serial EEPROM Check
|
||||||
for (int i = 0; i < eepcount; i++) {
|
for (int i = 0; i < eepcount; i++) {
|
||||||
@ -1234,25 +1233,6 @@ void getCartInfo_MD() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get name
|
|
||||||
for (byte c = 0; c < 48; c += 2) {
|
|
||||||
// split word
|
|
||||||
word myWord = readWord_MD((0x150 + c) / 2);
|
|
||||||
byte loByte = myWord & 0xFF;
|
|
||||||
byte hiByte = myWord >> 8;
|
|
||||||
|
|
||||||
// write to buffer
|
|
||||||
sdBuffer[c] = hiByte;
|
|
||||||
sdBuffer[c + 1] = loByte;
|
|
||||||
}
|
|
||||||
romName[copyToRomName_MD(romName, sdBuffer, sizeof(romName) - 1)] = 0;
|
|
||||||
|
|
||||||
//Check for Slaughter Sport
|
|
||||||
if (!strncmp("GMT5604600jJ", romName, 12) && (chksum == 0xFFFF)) {
|
|
||||||
strcpy(romName, "SLAUGHTERSPORT");
|
|
||||||
chksum = 0x6BAE;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Get Lock-on cart name
|
//Get Lock-on cart name
|
||||||
if (SnKmode >= 2) {
|
if (SnKmode >= 2) {
|
||||||
char romNameLockon[12];
|
char romNameLockon[12];
|
||||||
|
Loading…
Reference in New Issue
Block a user