make cheat database lookup based on crc instead of game ID, which locates the wrong file half the time when the cheat DB contains two entries with the same game ID (but differing crc). Left the serial check ADDITIONALLY as a backup in case of a crc collision
This commit is contained in:
parent
9836f56312
commit
21af401263
|
@ -1553,7 +1553,8 @@ bool CHEATSEXPORT::search()
|
||||||
|
|
||||||
}
|
}
|
||||||
//printf("serial: %s, offset %08X\n", fat.serial, fat.addr);
|
//printf("serial: %s, offset %08X\n", fat.serial, fat.addr);
|
||||||
if (memcmp(gameInfo.header.gameCode, &fat.serial[0], 4) == 0)
|
if (gameInfo.crcForCheatsDb == fat.CRC
|
||||||
|
&& !memcmp(gameInfo.header.gameCode, &fat.serial[0], 4))
|
||||||
{
|
{
|
||||||
dataSize = fat_tmp.addr?(fat_tmp.addr - fat.addr):0;
|
dataSize = fat_tmp.addr?(fat_tmp.addr - fat.addr):0;
|
||||||
if (encrypted)
|
if (encrypted)
|
||||||
|
|
|
@ -1564,8 +1564,6 @@ INT_PTR CALLBACK CheatsExportProc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lpa
|
||||||
lvi.pszText= tmp[i].description;
|
lvi.pszText= tmp[i].description;
|
||||||
SendMessage(exportListView, LVM_INSERTITEM, 0, (LPARAM)&lvi);
|
SendMessage(exportListView, LVM_INSERTITEM, 0, (LPARAM)&lvi);
|
||||||
}
|
}
|
||||||
if (gameInfo.crc && (gameInfo.crcForCheatsDb != cheatsExport->CRC))
|
|
||||||
msgbox->warn("Checksums not matching");
|
|
||||||
|
|
||||||
SendMessage(exportListView, WM_SETREDRAW, (WPARAM)TRUE,0);
|
SendMessage(exportListView, WM_SETREDRAW, (WPARAM)TRUE,0);
|
||||||
ListView_SetItemState(exportListView,0, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
|
ListView_SetItemState(exportListView,0, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
|
||||||
|
@ -1646,7 +1644,7 @@ bool CheatsExportDialog(HWND hwnd)
|
||||||
sprintf(buf2, "File \"%s\" is not R4 cheats database.\nWrong file format!", buf);
|
sprintf(buf2, "File \"%s\" is not R4 cheats database.\nWrong file format!", buf);
|
||||||
else
|
else
|
||||||
if (cheatsExport->getErrorCode() == 3)
|
if (cheatsExport->getErrorCode() == 3)
|
||||||
sprintf(buf2, "Serial \"%s\" not found in database.", gameInfo.ROMserial);
|
sprintf(buf2, "CRC %8X not found in database.", gameInfo.crcForCheatsDb);
|
||||||
else
|
else
|
||||||
if (cheatsExport->getErrorCode() == 4)
|
if (cheatsExport->getErrorCode() == 4)
|
||||||
sprintf(buf2, "Error export from database");
|
sprintf(buf2, "Error export from database");
|
||||||
|
|
Loading…
Reference in New Issue