fix md5checks breaking for pk3s
This commit is contained in:
1 parent
a193604d0f
commit
af1507b530
2 files changed
+15
-21
No files matched your search
+12
-18
@@ -4413,18 +4413,15 @@ static void Command_Addfile(void)
|
||||
if (!isprint(fn[i]) || fn[i] == ';')
|
||||
return;
|
||||
|
||||
if (fhandle)
|
||||
{
|
||||
fclose(fhandle);
|
||||
fhandle = NULL;
|
||||
}
|
||||
|
||||
if ((fhandle = W_OpenWadFile(&fn, true)) != NULL)
|
||||
{
|
||||
musiconly = W_VerifyNMUSlumps(fn, fhandle, false);
|
||||
}
|
||||
|
||||
if (musiconly == -1)
|
||||
return; // file not found
|
||||
|
||||
if (!musiconly)
|
||||
{
|
||||
// ... But only so long as they contain nothing more then music and sprites.
|
||||
if (netgame && !(server || IsPlayerAdmin(consoleplayer)))
|
||||
@@ -4452,7 +4449,7 @@ static void Command_Addfile(void)
|
||||
{
|
||||
UINT8 md5sum[16];
|
||||
#ifdef NOMD5
|
||||
memset(md5sum,0,16);
|
||||
memset(md5sum, 0, 16);
|
||||
#else
|
||||
|
||||
{
|
||||
@@ -4460,30 +4457,27 @@ static void Command_Addfile(void)
|
||||
CONS_Debug(DBG_SETUP, "Making MD5 for %s\n",fn);
|
||||
md5_stream(fhandle, md5sum);
|
||||
CONS_Debug(DBG_SETUP, "MD5 calc for %s took %f second\n", fn, (float)(I_GetTime() - t)/TICRATE);
|
||||
fclose(fhandle);
|
||||
}
|
||||
|
||||
for (i = 0; i < numwadfiles; i++)
|
||||
{
|
||||
if (memcmp(wadfiles[i]->md5sum, md5sum, 16))
|
||||
continue;
|
||||
|
||||
CONS_Alert(CONS_ERROR, M_GetText("%s is already loaded\n"), fn);
|
||||
goto addfile_finally;
|
||||
if (!memcmp(wadfiles[i]->md5sum, md5sum, 16))
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, M_GetText("%s is already loaded\n"), fn);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// Finally okay to write this important data
|
||||
WRITESTRINGN(buf_p,p,240);
|
||||
WRITESTRINGN(buf_p, p, 240);
|
||||
WRITEMEM(buf_p, md5sum, 16);
|
||||
}
|
||||
|
||||
if (IsPlayerAdmin(consoleplayer) && (!server)) // Request to add file
|
||||
SendNetXCmd(XD_REQADDFILE, buf, buf_p - buf);
|
||||
else
|
||||
SendNetXCmd(XD_ADDFILE, buf, buf_p - buf);
|
||||
|
||||
addfile_finally:
|
||||
if (fhandle)
|
||||
fclose(fhandle);
|
||||
SendNetXCmd(XD_ADDFILE, buf, buf_p - buf);;
|
||||
}
|
||||
|
||||
/** Adds something at runtime.
|
||||
|
||||
+3
-3
@@ -2359,12 +2359,12 @@ int W_VerifyNMUSlumps(const char *filename, FILE *handle, boolean exit_on_error)
|
||||
&& stricmp(&filename[len], ".lua"))
|
||||
{
|
||||
status = W_VerifyWAD(handle, NMUSlist, false);
|
||||
|
||||
// repair file handle in this specific case
|
||||
fseek(handle, 0, SEEK_SET);
|
||||
}
|
||||
}
|
||||
|
||||
// repair file handle
|
||||
fseek(handle, 0, SEEK_SET);
|
||||
|
||||
if (status == -1)
|
||||
W_InitFileError(filename, exit_on_error);
|
||||
|
||||
|
||||
Reference in new issue
Block a user