From 430831423ca42c7369e573dddabc634a86a7714d Mon Sep 17 00:00:00 2001 From: fickleheart Date: Wed, 17 Apr 2019 23:09:10 -0500 Subject: [PATCH] Strip out things that limit wad files added by filename --- src/d_main.c | 4 +--- src/d_netcmd.c | 11 +---------- src/d_netfil.c | 3 --- src/filesrch.c | 2 -- src/filesrch.h | 3 --- src/m_menu.c | 5 +---- src/w_wad.c | 20 +------------------- 7 files changed, 4 insertions(+), 44 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 84d5a6f3..636356f7 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -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 // diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 08bf3318..7ac14667 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -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); diff --git a/src/d_netfil.c b/src/d_netfil.c index 99a05840..4e6e76a1 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -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); diff --git a/src/filesrch.c b/src/filesrch.c index 0276e1c9..78917f73 100644 --- a/src/filesrch.c +++ b/src/filesrch.c @@ -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, diff --git a/src/filesrch.h b/src/filesrch.h index 01a52848..1a94aaa1 100644 --- a/src/filesrch.h +++ b/src/filesrch.h @@ -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, diff --git a/src/m_menu.c b/src/m_menu.c index 3ad076ff..7ecf8cd4 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -4664,10 +4664,7 @@ static void M_DrawAddons(void) y = FRACUNIT; else { - x = FixedDiv(((ssize_t)(numwadfiles) - (ssize_t)(mainwads+1))< y) - y = x; + y = FixedDiv(((ssize_t)(numwadfiles) - (ssize_t)(mainwads+1))< FRACUNIT) // happens because of how we're shrinkin' it a little y = FRACUNIT; } diff --git a/src/w_wad.c b/src/w_wad.c index 91570184..da82a276 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -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 //