mirror of
https://github.com/sanni/cartreader.git
synced 2024-11-14 08:55:06 +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]);
|
sprintf(checksumStr, "%02X%02X", eepbit[6], eepbit[7]);
|
||||||
|
|
||||||
// Get name
|
// Get name
|
||||||
|
byte myByte = 0;
|
||||||
byte myLength = 0;
|
byte myLength = 0;
|
||||||
byte x = 0;
|
byte x = 0;
|
||||||
if (sdBuffer[0x143] == 0x80 || sdBuffer[0x143] == 0xC0) {
|
if (sdBuffer[0x143] == 0x80 || sdBuffer[0x143] == 0xC0) {
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
for (int addr = 0x0134; addr <= 0x0143-x; addr++) {
|
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] != '*') {
|
myByte = sdBuffer[addr];
|
||||||
romName[myLength] = char(sdBuffer[addr]);
|
if (isprint(myByte) && myByte != '<' && myByte != '>' && myByte != ':' && myByte != '"' && myByte != '/' && myByte != '\\' && myByte != '|' && myByte != '?' && myByte != '*') {
|
||||||
myLength++;
|
romName[myLength] = char(myByte);
|
||||||
} else if (char(sdBuffer[addr]) != 0) {
|
} else {
|
||||||
|
if (romName[myLength-1] == 0x5F) myLength--;
|
||||||
romName[myLength] = 0x5F;
|
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,11 +897,18 @@ void getCartInfo_GBA() {
|
|||||||
myByte = sdBuffer[addr];
|
myByte = sdBuffer[addr];
|
||||||
if (isprint(myByte) && myByte != '<' && myByte != '>' && myByte != ':' && myByte != '"' && myByte != '/' && myByte != '\\' && myByte != '|' && myByte != '?' && myByte != '*') {
|
if (isprint(myByte) && myByte != '<' && myByte != '>' && myByte != ':' && myByte != '"' && myByte != '/' && myByte != '\\' && myByte != '|' && myByte != '?' && myByte != '*') {
|
||||||
romName[myLength] = char(myByte);
|
romName[myLength] = char(myByte);
|
||||||
myLength++;
|
} else {
|
||||||
} else if (char(sdBuffer[addr]) != 0) {
|
if (romName[myLength-1] == 0x5F) myLength--;
|
||||||
romName[myLength] = 0x5F;
|
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
|
// Get ROM version
|
||||||
|
@ -2711,12 +2711,24 @@ void idCart() {
|
|||||||
romVersion = sdBuffer[0x3F];
|
romVersion = sdBuffer[0x3F];
|
||||||
|
|
||||||
// Get name
|
// Get name
|
||||||
|
byte myByte = 0;
|
||||||
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]) <= 90) || (char(sdBuffer[0x20 + i]) >= 97 && char(sdBuffer[0x20 + i]) <= 122)) && (myLength < 15)) {
|
myByte = sdBuffer[0x20 + i];
|
||||||
romName[myLength] = char(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++;
|
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
|
// If name consists out of all japanese characters use cart id
|
||||||
|
@ -1009,11 +1009,22 @@ boolean checkcart_SNES() {
|
|||||||
byte myLength = 0;
|
byte myLength = 0;
|
||||||
for (unsigned int i = 0xFFC0; i < 0xFFD4; i++) {
|
for (unsigned int i = 0xFFC0; i < 0xFFD4; i++) {
|
||||||
myByte = snesHeader[i - headerStart];
|
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);
|
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--;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If name consists out of all japanese characters use game code
|
// If name consists out of all japanese characters use game code
|
||||||
if (myLength == 0) {
|
if (myLength == 0) {
|
||||||
// Get rom code
|
// Get rom code
|
||||||
@ -1225,7 +1236,7 @@ unsigned int calc_checksum (char* fileName, char* folder) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean compare_checksum() {
|
boolean compare_checksum() {
|
||||||
print_Msg(F("Chksum..."));
|
print_Msg(F("Checksum..."));
|
||||||
display_Update();
|
display_Update();
|
||||||
|
|
||||||
strcpy(fileName, romName);
|
strcpy(fileName, romName);
|
||||||
|
Loading…
Reference in New Issue
Block a user