Skip to content

Commit

Permalink
Fix bugus "wrong checksum" error after downloading pk3
Browse files Browse the repository at this point in the history
This commit also fixes bug in ignored downloads feature where ignored
file would get wrong checksum saved to dlblacklist.dat and not get
ignored in some cases
  • Loading branch information
aufau committed May 17, 2024
1 parent 3d0b200 commit 775ab47
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/qcommon/files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3273,13 +3273,15 @@ qboolean FS_ComparePaks( char *neededpaks, int len, int *chksums, size_t maxchks
searchpath_t *sp;
qboolean havepak, badchecksum, badname;
int i;
int paknum; // number of paks in neededpaks string (not counting dl_ duplicates)

if ( !fs_numServerReferencedPaks ) {
return qfalse; // Server didn't send any pack information along
}

*neededpaks = 0;
badname = qfalse;
paknum = 0;

for ( i = 0 ; i < fs_numServerReferencedPaks ; i++ ) {
// Ok, see if we have this pak file
Expand Down Expand Up @@ -3355,11 +3357,14 @@ qboolean FS_ComparePaks( char *neededpaks, int len, int *chksums, size_t maxchks
break;
}

Q_strcat( neededpaks, len, currentPak );

if (chksums && i < (int)maxchksums) {
chksums[i] = fs_serverReferencedPaks[i];
if (paknum + 1 >= (int)maxchksums) {
Com_Printf( S_COLOR_YELLOW "WARNING (FS_ComparePaks): referenced pk3 files cut off because there are too many\n" );
break;
}

Q_strcat( neededpaks, len, currentPak );
chksums[paknum] = fs_serverReferencedPaks[i];
paknum++;
} else {
char st[MAX_ZPATH];

Expand All @@ -3370,6 +3375,7 @@ qboolean FS_ComparePaks( char *neededpaks, int len, int *chksums, size_t maxchks
if ( FS_SV_FileExists(va("%s/dl_%s.pk3", moddir, filename)) ) {
Q_strcat( neededpaks, len, " (local file exists with wrong checksum)");
}

Q_strcat( neededpaks, len, "\n");
}
}
Expand Down

0 comments on commit 775ab47

Please sign in to comment.