コード例 #1
0
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;
}
コード例 #2
0
ファイル: win_filecode.cpp プロジェクト: 3ddy/Jedi-Academy
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;
}