Strip out things that limit wad files added by filename

This commit is contained in:
fickleheart 2019-04-17 23:09:10 -05:00
parent b128f44986
commit 430831423c
7 changed files with 4 additions and 44 deletions

View File

@ -74,7 +74,7 @@ int snprintf(char *str, size_t n, const char *fmt, ...);
#include "m_cond.h" // condition initialization
#include "fastcmp.h"
#include "keys.h"
#include "filesrch.h" // refreshdirmenu, mainwadstally
#include "filesrch.h" // refreshdirmenu
#ifdef CMAKECONFIG
#include "config.h"
@ -1257,8 +1257,6 @@ void D_SRB2Main(void)
#endif //ifndef DEVELOP
mainwadstally = packetsizetally;
//
// search for maps
//

View File

@ -4045,14 +4045,6 @@ static void Command_Addfile(void)
if (*p == '\\' || *p == '/' || *p == ':')
break;
++p;
// check total packet size and no of files currently loaded
// See W_LoadWadFile in w_wad.c
if ((numwadfiles >= MAX_WADFILES)
|| ((packetsizetally + nameonlylength(fn) + 22) > MAXFILENEEDED*sizeof(UINT8)))
{
CONS_Alert(CONS_ERROR, M_GetText("Too many files loaded to add %s\n"), fn);
return;
}
WRITESTRINGN(buf_p,p,240);
@ -4167,8 +4159,7 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
}
// See W_LoadWadFile in w_wad.c
if ((numwadfiles >= MAX_WADFILES)
|| ((packetsizetally + nameonlylength(filename) + 22) > MAXFILENEEDED*sizeof(UINT8)))
if (numwadfiles >= MAX_WADFILES)
toomany = true;
else
ncs = findfile(filename,md5sum,true);

View File

@ -373,9 +373,6 @@ INT32 CL_CheckFiles(void)
return 1;
}
// See W_LoadWadFile in w_wad.c
packetsize = packetsizetally;
for (i = 1; i < fileneedednum; i++)
{
CONS_Debug(DBG_NETPLAY, "searching for '%s' ", fileneeded[i].filename);

View File

@ -341,8 +341,6 @@ size_t dir_on[menudepth];
UINT8 refreshdirmenu = 0;
char *refreshdirname = NULL;
size_t packetsizetally = 0;
size_t mainwadstally = 0;
#if defined (_XBOX) && defined (_MSC_VER)
filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *wantedmd5sum,

View File

@ -42,9 +42,6 @@ extern size_t dir_on[menudepth];
extern UINT8 refreshdirmenu;
extern char *refreshdirname;
extern size_t packetsizetally;
extern size_t mainwadstally;
typedef enum
{
EXT_FOLDER = 0,

View File

@ -4664,10 +4664,7 @@ static void M_DrawAddons(void)
y = FRACUNIT;
else
{
x = FixedDiv(((ssize_t)(numwadfiles) - (ssize_t)(mainwads+1))<<FRACBITS, ((ssize_t)MAX_WADFILES - (ssize_t)(mainwads+1))<<FRACBITS);
y = FixedDiv((((ssize_t)packetsizetally-(ssize_t)mainwadstally)<<FRACBITS), ((((ssize_t)MAXFILENEEDED*sizeof(UINT8)-(ssize_t)mainwadstally)-(5+22))<<FRACBITS)); // 5+22 = (a.ext + checksum length) is minimum addition to packet size tally
if (x > y)
y = x;
y = FixedDiv(((ssize_t)(numwadfiles) - (ssize_t)(mainwads+1))<<FRACBITS, ((ssize_t)MAX_WADFILES - (ssize_t)(mainwads+1))<<FRACBITS);
if (y > FRACUNIT) // happens because of how we're shrinkin' it a little
y = FRACUNIT;
}

View File

@ -652,7 +652,6 @@ UINT16 W_InitFile(const char *filename)
restype_t type;
UINT16 numlumps = 0;
size_t i;
size_t packetsize;
UINT8 md5sum[16];
boolean important;
@ -684,24 +683,7 @@ UINT16 W_InitFile(const char *filename)
if ((handle = W_OpenWadFile(&filename, true)) == NULL)
return INT16_MAX;
// Check if wad files will overflow fileneededbuffer. Only the filename part
// is send in the packet; cf.
// see PutFileNeeded in d_netfil.c
if ((important = !W_VerifyNMUSlumps(filename)))
{
packetsize = packetsizetally + nameonlylength(filename) + 22;
if (packetsize > MAXFILENEEDED*sizeof(UINT8))
{
CONS_Alert(CONS_ERROR, M_GetText("Maximum wad files reached\n"));
refreshdirmenu |= REFRESHDIR_MAX;
if (handle)
fclose(handle);
return INT16_MAX;
}
packetsizetally = packetsize;
}
important = !W_VerifyNMUSlumps(filename);
#ifndef NOMD5
//