If name consists out of all japanese characters use cart id

This commit is contained in:
sanni 2022-02-12 13:15:53 +01:00
parent 8d9d85c901
commit 11b8493c92

View File

@ -2403,12 +2403,20 @@ void idCart() {
// Get name // Get name
byte myLength = 0; byte myLength = 0;
for (unsigned int i = 0; i < 20; i++) { for (unsigned int i = 0; i < 20; i++) {
if (((char(sdBuffer[0x20 + i]) >= 48 && char(sdBuffer[0x20 + i]) <= 57) || (char(sdBuffer[0x20 + i]) >= 65 && char(sdBuffer[0x20 + i]) <= 122)) && myLength < 15) { if (((char(sdBuffer[0x20 + i]) >= 48 && char(sdBuffer[0x20 + i]) <= 57) || (char(sdBuffer[0x20 + i]) >= 65 && char(sdBuffer[0x20 + i]) <= 90) || (char(sdBuffer[0x20 + i]) >= 97 && char(sdBuffer[0x20 + i]) <= 122)) && myLength < 15) {
romName[myLength] = char(sdBuffer[0x20 + i]); romName[myLength] = char(sdBuffer[0x20 + i]);
myLength++; myLength++;
} }
} }
// If name consists out of all japanese characters use cart id
if (myLength == 0) {
romName[0] = sdBuffer[0x3B];
romName[1] = sdBuffer[0x3C];
romName[2] = sdBuffer[0x3D];
romName[3] = sdBuffer[0x3E];
}
// Get CRC1 // Get CRC1
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
if (sdBuffer[0x10 + i] < 0x10) { if (sdBuffer[0x10 + i] < 0x10) {