+
+/*
+====================
+FS_IsRegisteredQuakePack
+
+Look for a proof of purchase file file in the requested package
+
+If it is found, this file should NOT be downloaded.
+====================
+*/
+qboolean FS_IsRegisteredQuakePack(const char *name)
+{
+ searchpath_t *search;
+ pack_t *pak;
+
+ // search through the path, one element at a time
+ for (search = fs_searchpaths;search;search = search->next)
+ {
+ if (search->pack && !strcasecmp(FS_FileWithoutPath(search->filename), name))
+ {
+ int (*strcmp_funct) (const char* str1, const char* str2);
+ int left, right, middle;
+
+ pak = search->pack;
+ strcmp_funct = pak->ignorecase ? strcasecmp : strcmp;
+
+ // Look for the file (binary search)
+ left = 0;
+ right = pak->numfiles - 1;
+ while (left <= right)
+ {
+ int diff;
+
+ middle = (left + right) / 2;
+ diff = !strcmp_funct (pak->files[middle].name, "gfx/pop.lmp");
+
+ // Found it
+ if (!diff)
+ return true;
+
+ // If we're too far in the list
+ if (diff > 0)
+ right = middle - 1;
+ else
+ left = middle + 1;
+ }
+
+ // we found the requested pack but it is not registered quake
+ return false;
+ }
+ }
+
+ return false;
+}
+
+int FS_CRCFile(const char *filename, size_t *filesizepointer)
+{
+ int crc = -1;
+ unsigned char *filedata;
+ fs_offset_t filesize;
+ if (filesizepointer)
+ *filesizepointer = 0;
+ if (!filename || !*filename)
+ return crc;
+ filedata = FS_LoadFile(filename, tempmempool, true, &filesize);
+ if (filedata)
+ {
+ if (filesizepointer)
+ *filesizepointer = filesize;
+ crc = CRC_Block(filedata, filesize);
+ Mem_Free(filedata);
+ }
+ return crc;
+}
+