Skip to content

Commit c6294eb

Browse files
committed
Added client warning if resource file is unexpectedly changed
1 parent bee6c7f commit c6294eb

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

Client/mods/deathmatch/logic/CResourceManager.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -263,22 +263,21 @@ void CResourceManager::ValidateResourceFile(const SString& strInFilename, const
263263
checksum = CChecksum::GenerateChecksumFromFile(strInFilename);
264264
if (checksum != pResourceFile->GetServerChecksum())
265265
{
266+
char szMd5[33];
267+
CMD5Hasher::ConvertToHex(checksum.md5, szMd5);
268+
char szMd5Wanted[33];
269+
CMD5Hasher::ConvertToHex(pResourceFile->GetServerChecksum().md5, szMd5Wanted);
270+
SString strMessage("%s [Expected Size:%d MD5:%s][Got Size:%d MD5:%s] ", *ConformResourcePath(strInFilename), pResourceFile->GetDownloadSize(),
271+
szMd5Wanted, (int)FileSize(strInFilename), szMd5);
266272
if (pResourceFile->IsDownloaded())
267273
{
268-
char szMd5[33];
269-
CMD5Hasher::ConvertToHex(checksum.md5, szMd5);
270-
char szMd5Wanted[33];
271-
CMD5Hasher::ConvertToHex(pResourceFile->GetServerChecksum().md5, szMd5Wanted);
272-
SString strMessage("Resource file checksum failed: %s [Size:%d MD5:%s][Wanted:%s][datasize:%d] ", *ConformResourcePath(strInFilename),
273-
(int)FileSize(strInFilename), szMd5, szMd5Wanted, fileData.GetSize());
274+
strMessage = "Resource file unexpected change: " + strMessage;
274275
g_pClientGame->TellServerSomethingImportant(1007, strMessage);
276+
g_pClientGame->GetScriptDebugging()->LogWarning(NULL, strMessage);
275277
}
276278
else if (pResourceFile->IsAutoDownload())
277279
{
278-
char szMd5[33];
279-
CMD5Hasher::ConvertToHex(checksum.md5, szMd5);
280-
SString strMessage("Attempt to load resource file before it is ready: %s [Size:%d MD5:%s] ", *ConformResourcePath(strInFilename),
281-
(int)FileSize(strInFilename), szMd5);
280+
strMessage = "Attempt to load resource file before it is ready: " + strMessage;
282281
g_pClientGame->TellServerSomethingImportant(1008, strMessage);
283282
}
284283
}

0 commit comments

Comments
 (0)