- uint32 crc = crc32_calcCheckSum(buffer, size);
- uint32 index = FindCRCIndexInFileList(crc);
-// These two are NOT interchangeable!
-// delete[] buffer;
- free(buffer);
+ if (foundUniversalHeader)
+ crc = crc32_calcCheckSum(buffer + 8192, fileSize - 8192);
+ else
+ crc = crc32_calcCheckSum(buffer, fileSize);
+
+ uint32 index = FindCRCIndexInFileList(crc);
+ delete[] buffer;
+
+ // Here we filter out files that are *not* in the DB and of unknown type,
+ // and BIOS files. If desired, this can be overriden with a config option.
+ if ((index == 0xFFFFFFFF) && (fileType == JST_NONE))
+ {
+ // If we allow unknown software, we pass the (-1) index on, otherwise...
+ if (!allowUnknownSoftware)
+ return; // CRC wasn't found, so bail...
+ }
+ else if ((index != 0xFFFFFFFF) && romList[index].flags & FF_BIOS)
+ return;