unsigned int Sys_GetSoundFileCode(const char* name) { // Get system level path char* osname = FS_BuildOSPathUnMapped(name); // Generate hash for file name strlwr(osname); unsigned int code = crc32(0, (const byte *)osname, strlen(osname)); return code; }
int Sys_GetFileCode(const char* name) { WaitForSingleObject(s_Mutex, INFINITE); // Get system level path char* osname = FS_BuildOSPathUnMapped(name); // Generate hash for file name strlwr(osname); unsigned int code = crc32(0, (const byte *)osname, strlen(osname)); // Check if the file exists if (!s_Files->Find(code)) { ReleaseMutex(s_Mutex); return -1; } ReleaseMutex(s_Mutex); return code; }