Merge pull request #529 from lesserkuma/master

Display full ROM title for GB and GBA and more mapper names for GB
This commit is contained in:
sanni 2022-09-23 22:27:32 +02:00 committed by GitHub
commit 3c5a1cc1ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 6 deletions

View File

@ -418,8 +418,14 @@ void showCartInfo_GB() {
print_Msg(F("MBC4")); print_Msg(F("MBC4"));
else if ((romType == 25) || (romType == 26) || (romType == 27) || (romType == 28) || (romType == 29) || (romType == 309)) else if ((romType == 25) || (romType == 26) || (romType == 27) || (romType == 28) || (romType == 29) || (romType == 309))
print_Msg(F("MBC5")); print_Msg(F("MBC5"));
if (romType == 252) else if (romType == 34)
print_Msg(F("MBC7"));
else if (romType == 252)
print_Msg(F("Camera")); print_Msg(F("Camera"));
else if (romType == 254)
print_Msg(F("HuC-3"));
else if (romType == 255)
print_Msg(F("HuC-1"));
println_Msg(F(" ")); println_Msg(F(" "));
print_Msg(F("Rom Size: ")); print_Msg(F("Rom Size: "));
@ -787,11 +793,17 @@ void getCartInfo_GB() {
// Get name // Get name
byte myLength = 0; byte myLength = 0;
byte x = 0;
for (int addr = 0x0134; addr <= 0x13C; addr++) { if (sdBuffer[0x143] == 0x80 || sdBuffer[0x143] == 0xC0) {
if (((char(sdBuffer[addr]) >= 48 && char(sdBuffer[addr]) <= 57) || (char(sdBuffer[addr]) >= 65 && char(sdBuffer[addr]) <= 122)) && myLength < 15) { 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]); romName[myLength] = char(sdBuffer[addr]);
myLength++; myLength++;
} else if (char(sdBuffer[addr]) != 0) {
romName[myLength] = 0x5F;
myLength++;
} }
} }
} }

View File

@ -895,9 +895,12 @@ void getCartInfo_GBA() {
byte myLength = 0; byte myLength = 0;
for (int addr = 0xA0; addr <= 0xAB; addr++) { for (int addr = 0xA0; addr <= 0xAB; addr++) {
myByte = sdBuffer[addr]; myByte = sdBuffer[addr];
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);
myLength++; myLength++;
} else if (char(sdBuffer[addr]) != 0) {
romName[myLength] = 0x5F;
myLength++;
} }
} }