Find Game Serial for Game Boy

This commit is contained in:
Lesserkuma 2022-09-28 21:31:49 +02:00
parent 786a8586fb
commit dab124def7
3 changed files with 28 additions and 11 deletions

View File

@ -410,7 +410,10 @@ void showCartInfo_GB() {
if (strcmp(checksumStr, "00") != 0) { if (strcmp(checksumStr, "00") != 0) {
print_Msg(F("Title: ")); print_Msg(F("Title: "));
println_Msg(romName); println_Msg(romName);
if (cartID[0] != 0) {
print_Msg(F("Serial: "));
println_Msg(cartID);
}
print_Msg(F("Revision: ")); print_Msg(F("Revision: "));
println_Msg(romVersion); println_Msg(romVersion);
@ -497,7 +500,7 @@ void showCartInfo_GB() {
print_Msg(F("512 Byte")); print_Msg(F("512 Byte"));
} }
else if (romType == 0x22) { else if (romType == 0x22) {
if (strncmp(romName, "CMASTER_KCEJ", 12) == 0) { if (strncmp(cartID, "KCEJ", 4) == 0) {
print_Msg(F("512 Byte")); print_Msg(F("512 Byte"));
} }
else { else {
@ -538,9 +541,9 @@ void showCartInfo_GB() {
default: print_Msg(F("None")); default: print_Msg(F("None"));
} }
println_Msg(F("")); println_Msg(F(""));
print_Msg(F("Checksum: ")); //print_Msg(F("Checksum: "));
println_Msg(checksumStr); //println_Msg(checksumStr);
display_Update(); //display_Update();
// Wait for user input // Wait for user input
println_Msg(F("")); println_Msg(F(""));
@ -860,6 +863,20 @@ void getCartInfo_GB() {
myLength++; myLength++;
} }
// Find Game Serial
cartID[0] = 0;
if (sdBuffer[0x143] == 0x80 || sdBuffer[0x143] == 0xC0) {
Serial.println(romName[myLength - 4]);
if ((romName[myLength - 4] == 'A' || romName[myLength - 4] == 'B' || romName[myLength - 4] == 'H' || romName[myLength - 4] == 'K' || romName[myLength - 4] == 'V') && (romName[myLength - 1] == 'A' || romName[myLength - 1] == 'B' || romName[myLength - 1] == 'D' || romName[myLength - 1] == 'E' || romName[myLength - 1] == 'F' || romName[myLength - 1] == 'I' || romName[myLength - 1] == 'J' || romName[myLength - 1] == 'K' || romName[myLength - 1] == 'P' || romName[myLength - 1] == 'S' || romName[myLength - 1] == 'U' || romName[myLength - 1] == 'X' || romName[myLength - 1] == 'Y')) {
cartID[0] = romName[myLength - 4];
cartID[1] = romName[myLength - 3];
cartID[2] = romName[myLength - 2];
cartID[3] = romName[myLength - 1];
myLength -= 4;
romName[myLength] = 0;
}
}
// Strip trailing white space // Strip trailing white space
for (unsigned int i = myLength - 1; i > 0; i--) { for (unsigned int i = myLength - 1; i > 0; i--) {
if ((romName[i] != 0x5F) && (romName[i] != 0x20)) break; if ((romName[i] != 0x5F) && (romName[i] != 0x20)) break;
@ -1274,7 +1291,7 @@ unsigned long verifySRAM_GB() {
} }
} }
// Read MBC6 (SRAM + FLASH) save data // Read SRAM + FLASH save data of MBC6
void readSRAMFLASH_MBC6_GB() { void readSRAMFLASH_MBC6_GB() {
// Get name, add extension and convert to char array for sd lib // Get name, add extension and convert to char array for sd lib
strcpy(fileName, romName); strcpy(fileName, romName);
@ -1369,7 +1386,7 @@ void readSRAMFLASH_MBC6_GB() {
display_Update(); display_Update();
} }
// Write MBC6 (SRAM + FLASH) save data // Write RAM
void writeSRAMFLASH_MBC6_GB() { void writeSRAMFLASH_MBC6_GB() {
// Create filepath // Create filepath
sprintf(filePath, "%s/%s", filePath, fileName); sprintf(filePath, "%s/%s", filePath, fileName);

View File

@ -545,7 +545,7 @@ void setup_GBA() {
// Print start page // Print start page
print_Msg(F("Title: ")); print_Msg(F("Title: "));
println_Msg(romName); println_Msg(romName);
print_Msg(F("Code: ")); print_Msg(F("Serial: "));
println_Msg(cartID); println_Msg(cartID);
print_Msg(F("Revision: ")); print_Msg(F("Revision: "));
println_Msg(romVersion); println_Msg(romVersion);
@ -921,12 +921,12 @@ void getCartInfo_GBA() {
// Print current database entry // Print current database entry
println_Msg(gamename); println_Msg(gamename);
print_Msg(F("Cart ID: ")); print_Msg(F("Serial: "));
println_Msg(tempStr); println_Msg(tempStr);
print_Msg(F("ROM Size: ")); print_Msg(F("ROM Size: "));
print_Msg(cartSize); print_Msg(cartSize);
println_Msg(F(" MB")); println_Msg(F(" MB"));
print_Msg(F("Save: ")); print_Msg(F("Save Lib: "));
println_Msg(saveTypeStr); println_Msg(saveTypeStr);
#if defined(enable_OLED) #if defined(enable_OLED)

View File

@ -2447,7 +2447,7 @@ void printCartInfo_N64() {
display_Clear(); display_Clear();
print_Msg(F("Title: ")); print_Msg(F("Title: "));
println_Msg(romName); println_Msg(romName);
print_Msg(F("Code: ")); print_Msg(F("Serial: "));
println_Msg(cartID); println_Msg(cartID);
print_Msg(F("Revision: ")); print_Msg(F("Revision: "));
println_Msg(romVersion); println_Msg(romVersion);