+
+uint32_t GetFileDBIdentityFromZIP(const char * zipFile)
+{
+ FILE * zip = fopen(zipFile, "rb");
+
+ if (zip == NULL)
+ {
+ WriteLog("FILE: Could not open file '%s'!\n", zipFile);
+ return 0;
+ }
+
+ ZipFileEntry ze;
+
+ // Loop through all files in the zip file under consideration
+ while (GetZIPHeader(zip, ze))
+ {
+ // & loop through all known CRC32s in our file DB to see if it's there!
+ uint32_t index = 0;
+
+ while (romList[index].crc32 != 0xFFFFFF)
+ {
+ if (romList[index].crc32 == ze.crc32)
+ {
+ fclose(zip);
+ return index;
+ }
+
+ index++;
+ }
+
+ // We didn't find it, so skip the compressed data...
+ fseek(zip, ze.compressedSize, SEEK_CUR);
+ }
+
+ fclose(zip);
+ return -1;
+}
+
+
+bool FindFileInZIPWithCRC32(const char * zipFile, uint32_t crc)
+{
+ FILE * zip = fopen(zipFile, "rb");
+
+ if (zip == NULL)
+ {
+ WriteLog("FILE: Could not open file '%s'!\n", zipFile);
+ return 0;
+ }
+
+ ZipFileEntry ze;
+
+ // Loop through all files in the zip file under consideration
+ while (GetZIPHeader(zip, ze))
+ {
+ if (ze.crc32 == crc)
+ {
+ fclose(zip);
+ return true;
+ }
+
+ fseek(zip, ze.compressedSize, SEEK_CUR);
+ }
+
+ fclose(zip);
+ return false;
+}
+
+