mirror of
https://github.com/sanni/cartreader.git
synced 2024-11-27 15:04:15 +01:00
Fix iNES header stored as text if CRC is not found in database
This commit is contained in:
parent
812da38741
commit
560b24ccde
@ -748,7 +748,13 @@ static void readDatabaseEntry(FsFile& database, struct database_entry* entry) {
|
|||||||
entry->crc512_str = &entry->crc_str[8 + 1];
|
entry->crc512_str = &entry->crc_str[8 + 1];
|
||||||
entry->crc512_str[8] = 0;
|
entry->crc512_str[8] = 0;
|
||||||
entry->iNES_str = &entry->crc_str[8 + 1 + 8 + 1];
|
entry->iNES_str = &entry->crc_str[8 + 1 + 8 + 1];
|
||||||
memcpy(iNES_HEADER, entry->iNES_str, sizeof(iNES_HEADER));
|
|
||||||
|
// Convert "4E4553" to (0x4E, 0x45, 0x53)
|
||||||
|
unsigned int iNES_BUF;
|
||||||
|
for (byte j = 0; j < 16; j++) {
|
||||||
|
sscanf(entry->iNES_str + j * 2, "%2X", &iNES_BUF);
|
||||||
|
iNES_HEADER[j] = iNES_BUF;
|
||||||
|
}
|
||||||
|
|
||||||
entry->crc = strtoul(entry->crc_str, NULL, 16);
|
entry->crc = strtoul(entry->crc_str, NULL, 16);
|
||||||
entry->crc512 = strtoul(entry->crc512_str, NULL, 16);
|
entry->crc512 = strtoul(entry->crc512_str, NULL, 16);
|
||||||
|
Loading…
Reference in New Issue
Block a user