fix crc calculation method for cheats DB
This commit is contained in:
parent
9e6b4f128f
commit
46980d7732
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -339,6 +339,7 @@ struct GameInfo
|
|||
u32 cardSize;
|
||||
u32 mask;
|
||||
u32 crc;
|
||||
u32 crcForCheatsDb;
|
||||
u32 chipID;
|
||||
u32 romType;
|
||||
u32 headerOffset;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue