mirror of
https://github.com/sanni/cartreader.git
synced 2024-12-28 14:01:52 +01:00
Update to displaying full ROM title on SNES, N64, GB, GBA
This commit is contained in:
parent
3c5a1cc1ac
commit
77c0daeb6a
@ -792,19 +792,28 @@ void getCartInfo_GB() {
|
||||
sprintf(checksumStr, "%02X%02X", eepbit[6], eepbit[7]);
|
||||
|
||||
// Get name
|
||||
byte myByte = 0;
|
||||
byte myLength = 0;
|
||||
byte x = 0;
|
||||
if (sdBuffer[0x143] == 0x80 || sdBuffer[0x143] == 0xC0) {
|
||||
x++;
|
||||
}
|
||||
for (int addr = 0x0134; addr <= 0x0143-x; addr++) {
|
||||
if (isprint(sdBuffer[addr]) && sdBuffer[addr] != '<' && sdBuffer[addr] != '>' && sdBuffer[addr] != ':' && sdBuffer[addr] != '"' && sdBuffer[addr] != '/' && sdBuffer[addr] != '\\' && sdBuffer[addr] != '|' && sdBuffer[addr] != '?' && sdBuffer[addr] != '*') {
|
||||
romName[myLength] = char(sdBuffer[addr]);
|
||||
myLength++;
|
||||
} else if (char(sdBuffer[addr]) != 0) {
|
||||
myByte = sdBuffer[addr];
|
||||
if (isprint(myByte) && myByte != '<' && myByte != '>' && myByte != ':' && myByte != '"' && myByte != '/' && myByte != '\\' && myByte != '|' && myByte != '?' && myByte != '*') {
|
||||
romName[myLength] = char(myByte);
|
||||
} else {
|
||||
if (romName[myLength-1] == 0x5F) myLength--;
|
||||
romName[myLength] = 0x5F;
|
||||
myLength++;
|
||||
}
|
||||
myLength++;
|
||||
}
|
||||
|
||||
// Strip trailing white space
|
||||
for (unsigned int i = myLength - 1; i > 0; i--) {
|
||||
if ((romName[i] != 0x5F) && (romName[i] != 0x20)) break;
|
||||
romName[i] = 0x00;
|
||||
myLength--;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -897,13 +897,20 @@ void getCartInfo_GBA() {
|
||||
myByte = sdBuffer[addr];
|
||||
if (isprint(myByte) && myByte != '<' && myByte != '>' && myByte != ':' && myByte != '"' && myByte != '/' && myByte != '\\' && myByte != '|' && myByte != '?' && myByte != '*') {
|
||||
romName[myLength] = char(myByte);
|
||||
myLength++;
|
||||
} else if (char(sdBuffer[addr]) != 0) {
|
||||
} else {
|
||||
if (romName[myLength-1] == 0x5F) myLength--;
|
||||
romName[myLength] = 0x5F;
|
||||
myLength++;
|
||||
}
|
||||
myLength++;
|
||||
}
|
||||
|
||||
|
||||
// Strip trailing white space
|
||||
for (unsigned int i = myLength - 1; i > 0; i--) {
|
||||
if ((romName[i] != 0x5F) && (romName[i] != 0x20)) break;
|
||||
romName[i] = 0x00;
|
||||
myLength--;
|
||||
}
|
||||
|
||||
// Get ROM version
|
||||
romVersion = sdBuffer[0xBC];
|
||||
|
||||
|
@ -2711,12 +2711,24 @@ void idCart() {
|
||||
romVersion = sdBuffer[0x3F];
|
||||
|
||||
// Get name
|
||||
byte myByte = 0;
|
||||
byte myLength = 0;
|
||||
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]) <= 90) || (char(sdBuffer[0x20 + i]) >= 97 && char(sdBuffer[0x20 + i]) <= 122)) && (myLength < 15)) {
|
||||
romName[myLength] = char(sdBuffer[0x20 + i]);
|
||||
myLength++;
|
||||
myByte = sdBuffer[0x20 + i];
|
||||
if (isprint(myByte) && myByte != '<' && myByte != '>' && myByte != ':' && myByte != '"' && myByte != '/' && myByte != '\\' && myByte != '|' && myByte != '?' && myByte != '*') {
|
||||
romName[myLength] = char(myByte);
|
||||
} else {
|
||||
if (romName[myLength-1] == 0x5F) myLength--;
|
||||
romName[myLength] = 0x5F;
|
||||
}
|
||||
myLength++;
|
||||
}
|
||||
|
||||
// Strip trailing white space
|
||||
for (unsigned int i = myLength - 1; i > 0; i--) {
|
||||
if ((romName[i] != 0x5F) && (romName[i] != 0x20)) break;
|
||||
romName[i] = 0x00;
|
||||
myLength--;
|
||||
}
|
||||
|
||||
// If name consists out of all japanese characters use cart id
|
||||
|
@ -1009,11 +1009,22 @@ boolean checkcart_SNES() {
|
||||
byte myLength = 0;
|
||||
for (unsigned int i = 0xFFC0; i < 0xFFD4; i++) {
|
||||
myByte = snesHeader[i - headerStart];
|
||||
if (((char(myByte) >= 48 && char(myByte) <= 57) || (char(myByte) >= 65 && char(myByte) <= 122)) && myLength < 15) {
|
||||
if (isprint(myByte) && myByte != '<' && myByte != '>' && myByte != ':' && myByte != '"' && myByte != '/' && myByte != '\\' && myByte != '|' && myByte != '?' && myByte != '*') {
|
||||
romName[myLength] = char(myByte);
|
||||
myLength++;
|
||||
} else {
|
||||
if (romName[myLength-1] == 0x5F) myLength--;
|
||||
romName[myLength] = 0x5F;
|
||||
}
|
||||
myLength++;
|
||||
}
|
||||
|
||||
// Strip trailing white space
|
||||
for (unsigned int i = myLength - 1; i > 0; i--) {
|
||||
if ((romName[i] != 0x5F) && (romName[i] != 0x20)) break;
|
||||
romName[i] = 0x00;
|
||||
myLength--;
|
||||
}
|
||||
|
||||
// If name consists out of all japanese characters use game code
|
||||
if (myLength == 0) {
|
||||
// Get rom code
|
||||
@ -1225,7 +1236,7 @@ unsigned int calc_checksum (char* fileName, char* folder) {
|
||||
}
|
||||
|
||||
boolean compare_checksum() {
|
||||
print_Msg(F("Chksum..."));
|
||||
print_Msg(F("Checksum..."));
|
||||
display_Update();
|
||||
|
||||
strcpy(fileName, romName);
|
||||
|
Loading…
Reference in New Issue
Block a user