diff --git a/desmume/src/NDSSystem.cpp b/desmume/src/NDSSystem.cpp index 9f0c25fba..a7920ab3e 100755 --- a/desmume/src/NDSSystem.cpp +++ b/desmume/src/NDSSystem.cpp @@ -698,10 +698,14 @@ int NDS_LoadROM(const char *filename, const char *physicalName, const char *logi //run crc over the whole buffer (chunk at a time, to avoid coding a streaming crc gameInfo.reader->Seek(gameInfo.fROM, 0, SEEK_SET); gameInfo.crc = 0; + bool first = true; for(;;) { u8 buf[4096]; int read = gameInfo.reader->Read(gameInfo.fROM,buf,4096); if(read == 0) break; + if(first && read >= 512) + gameInfo.crcForCheatsDb = ~crc32(0, buf, 512); + first = false; gameInfo.crc = crc32(gameInfo.crc, buf, read); } diff --git a/desmume/src/NDSSystem.h b/desmume/src/NDSSystem.h index 7169a7a43..ca6029907 100755 --- a/desmume/src/NDSSystem.h +++ b/desmume/src/NDSSystem.h @@ -339,6 +339,7 @@ struct GameInfo u32 cardSize; u32 mask; u32 crc; + u32 crcForCheatsDb; u32 chipID; u32 romType; u32 headerOffset; diff --git a/desmume/src/frontend/windows/cheatsWin.cpp b/desmume/src/frontend/windows/cheatsWin.cpp index fa9bbdb5d..b97353364 100644 --- a/desmume/src/frontend/windows/cheatsWin.cpp +++ b/desmume/src/frontend/windows/cheatsWin.cpp @@ -1564,7 +1564,7 @@ INT_PTR CALLBACK CheatsExportProc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lpa lvi.pszText= tmp[i].description; SendMessage(exportListView, LVM_INSERTITEM, 0, (LPARAM)&lvi); } - if (gameInfo.crc && (gameInfo.crc != cheatsExport->CRC)) + if (gameInfo.crc && (gameInfo.crcForCheatsDb != cheatsExport->CRC)) msgbox->warn("Checksums not matching"); SendMessage(exportListView, WM_SETREDRAW, (WPARAM)TRUE,0);