From 7253f0e499df39626a40e940e6206f99eeaaa47c Mon Sep 17 00:00:00 2001 From: fickleheart Date: Wed, 17 Apr 2019 23:09:10 -0500 Subject: [PATCH 1/9] 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 84d5a6f32..636356f74 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 08bf33185..7ac146678 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 99a058403..4e6e76a1d 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 0276e1c90..78917f738 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 01a528482..1a94aaa1b 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 3ad076ff7..7ecf8cd4c 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 915701840..da82a276d 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 // From 8aa719108dfa40d5f59a11a23cae5c7c4bebb239 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Wed, 17 Apr 2019 23:29:27 -0500 Subject: [PATCH 2/9] Paginate PutFileNeeded --- src/d_clisrv.c | 6 +----- src/d_clisrv.h | 2 ++ src/d_netfil.c | 33 ++++++++++++++++++++++++++++----- src/d_netfil.h | 3 ++- 4 files changed, 33 insertions(+), 11 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index e227ce2ed..86ebb3455 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1433,7 +1433,7 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime) netbuffer->u.serverinfo.actnum = 0; //mapheaderinfo[gamemap-1]->actnum - p = PutFileNeeded(); + p = PutFileNeeded(0); HSendPacket(node, false, 0, p - ((UINT8 *)&netbuffer->u)); } @@ -2022,10 +2022,6 @@ static boolean CL_ServerConnectionSearchTicker(boolean viams, tic_t *asksent) } cl_mode = CL_ASKDOWNLOADFILES; - - // no problem if can't send packet, we will retry later - //if (CL_SendRequestFile()) - // cl_mode = CL_DOWNLOADFILES; } } else diff --git a/src/d_clisrv.h b/src/d_clisrv.h index f3a9011eb..a4324d690 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -376,6 +376,8 @@ typedef struct #define MAXSERVERNAME 32 #define MAXFILENEEDED 915 +#define MAXFILENEEDEDPAGES MAX_WADFILES +#define FILENEEDED_MORE 0x80 // This packet is too large typedef struct { diff --git a/src/d_netfil.c b/src/d_netfil.c index 4e6e76a1d..efb0fb817 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -101,25 +101,49 @@ char downloaddir[512] = "DOWNLOAD"; INT32 lastfilenum = -1; #endif +UINT16 fileneededpages = 0; +static size_t fileneededpagestart[MAXFILENEEDEDPAGES]; + /** Fills a serverinfo packet with information about wad files loaded. * * \todo Give this function a better name since it is in global scope. * Used to have size limiting built in - now handed via W_LoadWadFile in w_wad.c * */ -UINT8 *PutFileNeeded(void) +UINT8 *PutFileNeeded(UINT16 page) { - size_t i, count = 0; + size_t i; + UINT8 count = 0; UINT8 *p = netbuffer->u.serverinfo.fileneeded; char wadfilename[MAX_WADPATH] = ""; UINT8 filestatus; - for (i = 0; i < numwadfiles; i++) + if (page > fileneededpages) + I_Error("Fileneeded page %d accessed before a prior page", page); + else if (page == 0) + { + fileneededpages = 0; + memset(fileneededpagestart, 0, sizeof(fileneededpagestart)); // ??? I guess. + fileneededpagestart[0] = mainwads; + } + + for (i = fileneededpagestart[page]; i < (fileneededpagestart[page+1] ?: numwadfiles); i++) { // If it has only music/sound lumps, don't put it in the list if (!wadfiles[i]->important) continue; + nameonly(strcpy(wadfilename, wadfiles[i]->filename)); + + if (p + 1 + 4 + strlen(wadfilename) + 16 > netbuffer->u.serverinfo.fileneeded + MAXFILENEEDED) + { + // Too many files for this page, so mark the next page to start here and finish up. + fileneededpagestart[page+1] = i; + fileneededpages = page+1; + count |= FILENEEDED_MORE; + break; + } + filestatus = 1; // Importance - not really used any more, holds 1 by default for backwards compat with MS // Store in the upper four bits @@ -134,11 +158,10 @@ UINT8 *PutFileNeeded(void) count++; WRITEUINT32(p, wadfiles[i]->filesize); - nameonly(strcpy(wadfilename, wadfiles[i]->filename)); WRITESTRINGN(p, wadfilename, MAX_WADPATH); WRITEMEM(p, wadfiles[i]->md5sum, 16); } - netbuffer->u.serverinfo.fileneedednum = (UINT8)count; + netbuffer->u.serverinfo.fileneedednum = count; return p; } diff --git a/src/d_netfil.h b/src/d_netfil.h index 3d7c2ed59..3a40c13af 100644 --- a/src/d_netfil.h +++ b/src/d_netfil.h @@ -53,7 +53,8 @@ extern char downloaddir[512]; extern INT32 lastfilenum; #endif -UINT8 *PutFileNeeded(void); +extern UINT16 fileneededpages; +UINT8 *PutFileNeeded(UINT16 page); void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr); void CL_PrepareDownloadSaveGame(const char *tmpsave); From ebf03678288e56d6c70996b9dae1ed9fb02ddd2a Mon Sep 17 00:00:00 2001 From: fickleheart Date: Wed, 17 Apr 2019 23:42:49 -0500 Subject: [PATCH 3/9] Some stuff toward reading those files --- src/d_clisrv.c | 120 +++++++++++++++++++++++++++---------------------- src/d_netfil.c | 10 ++--- src/d_netfil.h | 2 +- 3 files changed, 73 insertions(+), 59 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 86ebb3455..1543bf684 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1129,6 +1129,7 @@ typedef enum #endif CL_CONNECTED, CL_ABORTED, + CL_ASKFULLFILELIST, CL_ASKDOWNLOADFILES, CL_WAITDOWNLOADFILESRESPONSE, CL_CHALLENGE @@ -1924,6 +1925,66 @@ void CL_UpdateServerList(boolean internetsearch, INT32 room) #endif // ifndef NONET +static boolean CL_FinishedFileList(void) +{ + INT32 i; + CONS_Printf(M_GetText("Checking files...\n")); + i = CL_CheckFiles(); + if (i == 3) // too many files + { + D_QuitNetGame(); + CL_Reset(); + D_StartTitle(); + M_StartMessage(M_GetText( + "You have too many WAD files loaded\n" + "to add ones the server is using.\n" + "Please restart SRB2Kart before connecting.\n\n" + "Press ESC\n" + ), NULL, MM_NOTHING); + return false; + } + else if (i == 2) // cannot join for some reason + { + D_QuitNetGame(); + CL_Reset(); + D_StartTitle(); + M_StartMessage(M_GetText( + "You have WAD files loaded or have\n" + "modified the game in some way, and\n" + "your file list does not match\n" + "the server's file list.\n" + "Please restart SRB2Kart before connecting.\n\n" + "Press ESC\n" + ), NULL, MM_NOTHING); + return false; + } + else if (i == 1) + cl_mode = CL_ASKJOIN; + else + { + // must download something + // can we, though? + if (!CL_CheckDownloadable()) // nope! + { + D_QuitNetGame(); + CL_Reset(); + D_StartTitle(); + M_StartMessage(M_GetText( + "You cannot connect to this server\n" + "because you cannot download the files\n" + "that you are missing from the server.\n\n" + "See the console or log file for\n" + "more details.\n\n" + "Press ESC\n" + ), NULL, MM_NOTHING); + return false; + } + + cl_mode = CL_ASKDOWNLOADFILES; + } + return true; +} + /** Called by CL_ServerConnectionTicker * * \param viams ??? @@ -1967,62 +2028,15 @@ static boolean CL_ServerConnectionSearchTicker(boolean viams, tic_t *asksent) if (client) { - D_ParseFileneeded(serverlist[i].info.fileneedednum, - serverlist[i].info.fileneeded); - CONS_Printf(M_GetText("Checking files...\n")); - i = CL_CheckFiles(); - if (i == 3) // too many files + D_ParseFileneeded(serverlist[i].info.fileneedednum, serverlist[i].info.fileneeded, 0); + if (serverlist[i].info.fileneedednum & FILENEEDED_MORE) { - D_QuitNetGame(); - CL_Reset(); - D_StartTitle(); - M_StartMessage(M_GetText( - "You have too many WAD files loaded\n" - "to add ones the server is using.\n" - "Please restart SRB2Kart before connecting.\n\n" - "Press ESC\n" - ), NULL, MM_NOTHING); - return false; + cl_mode = CL_ASKFULLFILELIST; + return true; } - else if (i == 2) // cannot join for some reason - { - D_QuitNetGame(); - CL_Reset(); - D_StartTitle(); - M_StartMessage(M_GetText( - "You have WAD files loaded or have\n" - "modified the game in some way, and\n" - "your file list does not match\n" - "the server's file list.\n" - "Please restart SRB2Kart before connecting.\n\n" - "Press ESC\n" - ), NULL, MM_NOTHING); - return false; - } - else if (i == 1) - cl_mode = CL_ASKJOIN; - else - { - // must download something - // can we, though? - if (!CL_CheckDownloadable()) // nope! - { - D_QuitNetGame(); - CL_Reset(); - D_StartTitle(); - M_StartMessage(M_GetText( - "You cannot connect to this server\n" - "because you cannot download the files\n" - "that you are missing from the server.\n\n" - "See the console or log file for\n" - "more details.\n\n" - "Press ESC\n" - ), NULL, MM_NOTHING); - return false; - } - cl_mode = CL_ASKDOWNLOADFILES; - } + if (!CL_FinishedFileList()) + return false; } else cl_mode = CL_ASKJOIN; // files need not be checked for the server. diff --git a/src/d_netfil.c b/src/d_netfil.c index efb0fb817..7e8fe0b88 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -168,19 +168,19 @@ UINT8 *PutFileNeeded(UINT16 page) /** Parses the serverinfo packet and fills the fileneeded table on client * - * \param fileneedednum_parm The number of files needed to join the server + * \param fileneedednum_parm The number of files (sent in this page) needed to join the server * \param fileneededstr The memory block containing the list of needed files - * + * \param firstfile The first file index to read from */ -void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr) +void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr, UINT16 firstfile) { INT32 i; UINT8 *p; UINT8 filestatus; - fileneedednum = fileneedednum_parm; + fileneedednum = firstfile + (fileneedednum_parm & ~FILENEEDED_MORE); p = (UINT8 *)fileneededstr; - for (i = 0; i < fileneedednum; i++) + for (i = firstfile; i < fileneedednum; i++) { fileneeded[i].status = FS_NOTFOUND; // We haven't even started looking for the file yet filestatus = READUINT8(p); // The first byte is the file status diff --git a/src/d_netfil.h b/src/d_netfil.h index 3a40c13af..97a0d0fe6 100644 --- a/src/d_netfil.h +++ b/src/d_netfil.h @@ -55,7 +55,7 @@ extern INT32 lastfilenum; extern UINT16 fileneededpages; UINT8 *PutFileNeeded(UINT16 page); -void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr); +void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr, UINT16 firstfile); void CL_PrepareDownloadSaveGame(const char *tmpsave); INT32 CL_CheckFiles(void); From d7ed880e81659267fea6837a03540f4b124f21ce Mon Sep 17 00:00:00 2001 From: fickleheart Date: Wed, 17 Apr 2019 23:51:15 -0500 Subject: [PATCH 4/9] Wait, we don't need pages, just first file index... --- src/d_clisrv.c | 2 +- src/d_clisrv.h | 3 +-- src/d_netfil.c | 35 ++++++++++++++--------------------- src/d_netfil.h | 3 +-- 4 files changed, 17 insertions(+), 26 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 1543bf684..1ce6256be 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2029,7 +2029,7 @@ static boolean CL_ServerConnectionSearchTicker(boolean viams, tic_t *asksent) if (client) { D_ParseFileneeded(serverlist[i].info.fileneedednum, serverlist[i].info.fileneeded, 0); - if (serverlist[i].info.fileneedednum & FILENEEDED_MORE) + if (serverlist[i].info.kartvars & SV_LOTSOFADDONS) { cl_mode = CL_ASKFULLFILELIST; return true; diff --git a/src/d_clisrv.h b/src/d_clisrv.h index a4324d690..dff15f352 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -371,13 +371,12 @@ typedef struct } ATTRPACK joinchallenge_pak; #define SV_SPEEDMASK 0x03 +#define SV_LOTSOFADDONS 0x20 #define SV_DEDICATED 0x40 #define SV_PASSWORD 0x80 #define MAXSERVERNAME 32 #define MAXFILENEEDED 915 -#define MAXFILENEEDEDPAGES MAX_WADFILES -#define FILENEEDED_MORE 0x80 // This packet is too large typedef struct { diff --git a/src/d_netfil.c b/src/d_netfil.c index 7e8fe0b88..42f7621c4 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -101,46 +101,39 @@ char downloaddir[512] = "DOWNLOAD"; INT32 lastfilenum = -1; #endif -UINT16 fileneededpages = 0; -static size_t fileneededpagestart[MAXFILENEEDEDPAGES]; - /** Fills a serverinfo packet with information about wad files loaded. * * \todo Give this function a better name since it is in global scope. * Used to have size limiting built in - now handed via W_LoadWadFile in w_wad.c * */ -UINT8 *PutFileNeeded(UINT16 page) +UINT8 *PutFileNeeded(UINT16 firstfile) { size_t i; UINT8 count = 0; - UINT8 *p = netbuffer->u.serverinfo.fileneeded; + UINT8 *p_start = netbuffer->u.serverinfo.fileneeded; + UINT8 *p = p_start; char wadfilename[MAX_WADPATH] = ""; UINT8 filestatus; - if (page > fileneededpages) - I_Error("Fileneeded page %d accessed before a prior page", page); - else if (page == 0) - { - fileneededpages = 0; - memset(fileneededpagestart, 0, sizeof(fileneededpagestart)); // ??? I guess. - fileneededpagestart[0] = mainwads; - } - - for (i = fileneededpagestart[page]; i < (fileneededpagestart[page+1] ?: numwadfiles); i++) + for (i = mainwads; i < numwadfiles; i++) { // If it has only music/sound lumps, don't put it in the list if (!wadfiles[i]->important) continue; + if (firstfile) + { // Skip files until we reach the first file. + firstfile--; + continue; + } + nameonly(strcpy(wadfilename, wadfiles[i]->filename)); - if (p + 1 + 4 + strlen(wadfilename) + 16 > netbuffer->u.serverinfo.fileneeded + MAXFILENEEDED) + if (p + 1 + 4 + strlen(wadfilename) + 16 > p_start + MAXFILENEEDED) { - // Too many files for this page, so mark the next page to start here and finish up. - fileneededpagestart[page+1] = i; - fileneededpages = page+1; - count |= FILENEEDED_MORE; + // Too many files to send all at once + netbuffer->u.serverinfo.kartvars |= SV_LOTSOFADDONS; break; } @@ -178,7 +171,7 @@ void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr, UINT16 fi UINT8 *p; UINT8 filestatus; - fileneedednum = firstfile + (fileneedednum_parm & ~FILENEEDED_MORE); + fileneedednum = firstfile + fileneedednum_parm; p = (UINT8 *)fileneededstr; for (i = firstfile; i < fileneedednum; i++) { diff --git a/src/d_netfil.h b/src/d_netfil.h index 97a0d0fe6..2f0333311 100644 --- a/src/d_netfil.h +++ b/src/d_netfil.h @@ -53,8 +53,7 @@ extern char downloaddir[512]; extern INT32 lastfilenum; #endif -extern UINT16 fileneededpages; -UINT8 *PutFileNeeded(UINT16 page); +UINT8 *PutFileNeeded(UINT16 firstfile); void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr, UINT16 firstfile); void CL_PrepareDownloadSaveGame(const char *tmpsave); From a83f887cb38016c54c93fcab07e97ee79d3b8989 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Thu, 18 Apr 2019 00:30:28 -0500 Subject: [PATCH 5/9] Send the rest of the file list --- src/d_clisrv.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/d_clisrv.h | 13 +++++++++++ 2 files changed, 73 insertions(+) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 1ce6256be..08f28d176 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -21,6 +21,7 @@ #include "i_system.h" #include "i_video.h" #include "d_net.h" +#include "d_netfil.h" // fileneedednum #include "d_main.h" #include "d_event.h" #include "g_game.h" @@ -1140,6 +1141,7 @@ static void GetPackets(void); static cl_mode_t cl_mode = CL_SEARCHING; static boolean cl_needsdownload = false; +static UINT16 cl_lastcheckedfilecount = 0; static UINT8 cl_challengenum = 0; static UINT8 cl_challengequestion[MD5_LEN+1]; static char cl_challengepassword[65]; @@ -1316,6 +1318,14 @@ static inline void CL_DrawConnectionStatus(void) } #endif +static boolean CL_AskFileList(INT32 firstfile) +{ + netbuffer->packettype = PT_TELLFILESNEEDED; + netbuffer->u.filesneedednum = firstfile; + + return HSendPacket(servernode, true, 0, sizeof (INT32)); +} + /** Sends a special packet to declare how many players in local * Used only in arbitratrenetstart() * Sends a PT_CLIENTJOIN packet to the server @@ -2032,6 +2042,7 @@ static boolean CL_ServerConnectionSearchTicker(boolean viams, tic_t *asksent) if (serverlist[i].info.kartvars & SV_LOTSOFADDONS) { cl_mode = CL_ASKFULLFILELIST; + cl_lastcheckedfilecount = 0; return true; } @@ -2087,6 +2098,22 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic return false; break; + case CL_ASKFULLFILELIST: + if (cl_lastcheckedfilecount == UINT16_MAX) // All files retrieved + { + if (!CL_FinishedFileList()) + return false; + } + else if (fileneedednum != cl_lastcheckedfilecount || *asksent + NEWTICRATE < I_GetTime()) + { + if (CL_AskFileList(fileneedednum)) + { + cl_lastcheckedfilecount = fileneedednum; + *asksent = I_GetTime(); + } + } + break; + case CL_DOWNLOADFILES: waitmore = false; for (i = 0; i < fileneedednum; i++) @@ -3969,6 +3996,39 @@ static void HandlePacketFromAwayNode(SINT8 node) #endif break; + case PT_TELLFILESNEEDED: + if (server && serverrunning) + { + UINT8 *p; + INT32 firstfile = netbuffer->u.filesneedednum; + + netbuffer->packettype = PT_MOREFILESNEEDED; + netbuffer->u.filesneededcfg.first = firstfile; + netbuffer->u.filesneededcfg.more = 0; + + p = PutFileNeeded(firstfile); + + HSendPacket(node, false, 0, p - ((UINT8 *)&netbuffer->u)); + } + else // Shouldn't get this if you aren't the server...? + Net_CloseConnection(node); + break; + + case PT_MOREFILESNEEDED: + if (server && serverrunning) + { // But wait I thought I'm the server? + Net_CloseConnection(node); + break; + } + SERVERONLY + if (cl_mode == CL_ASKFULLFILELIST && netbuffer->u.filesneededcfg.first == fileneedednum) + { + D_ParseFileneeded(netbuffer->u.filesneededcfg.num, netbuffer->u.filesneededcfg.files, netbuffer->u.filesneededcfg.first); + if (!netbuffer->u.filesneededcfg.more) + cl_lastcheckedfilecount = UINT16_MAX; // Got the whole file list + } + break; + case PT_ASKINFO: if (server && serverrunning) { diff --git a/src/d_clisrv.h b/src/d_clisrv.h index dff15f352..5b68def21 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -93,6 +93,9 @@ typedef enum PT_NODETIMEOUT, // Packet sent to self if the connection times out. PT_RESYNCHING, // Packet sent to resync players. // Blocks game advance until synched. + + PT_TELLFILESNEEDED, // Client, to server: "what other files do I need starting from this number?" + PT_MOREFILESNEEDED, // Server, to client: "you need these (+ more on top of those)" #ifdef NEWPING PT_PING, // Packet sent to tell clients the other client's latency to server. #endif @@ -442,6 +445,14 @@ typedef struct UINT8 ctfteam; } ATTRPACK plrconfig; +typedef struct +{ + INT32 first; + UINT8 num; + UINT8 more; + UINT8 files[MAXFILENEEDED]; // is filled with writexxx (byteptr.h) +} ATTRPACK filesneededconfig_pak; + // // Network packet data // @@ -474,6 +485,8 @@ typedef struct msaskinfo_pak msaskinfo; // 22 bytes plrinfo playerinfo[MAXPLAYERS]; // 576 bytes(?) plrconfig playerconfig[MAXPLAYERS]; // (up to) 528 bytes(?) + INT32 filesneedednum; // 4 bytes + filesneededconfig_pak filesneededcfg; // ??? bytes #ifdef NEWPING UINT32 pingtable[MAXPLAYERS+1]; // 68 bytes #endif From 9c8e35794f1ef9284b2a522daf3b3bb030dfcf8f Mon Sep 17 00:00:00 2001 From: fickleheart Date: Thu, 18 Apr 2019 00:37:08 -0500 Subject: [PATCH 6/9] Read the file list properly --- src/d_netfil.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/d_netfil.c b/src/d_netfil.c index 42f7621c4..4dcd3da4a 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -111,7 +111,7 @@ UINT8 *PutFileNeeded(UINT16 firstfile) { size_t i; UINT8 count = 0; - UINT8 *p_start = netbuffer->u.serverinfo.fileneeded; + UINT8 *p_start = netbuffer->packettype == PT_MOREFILESNEEDED ? netbuffer->u.filesneededcfg.files : netbuffer->u.serverinfo.fileneeded; UINT8 *p = p_start; char wadfilename[MAX_WADPATH] = ""; UINT8 filestatus; @@ -133,7 +133,10 @@ UINT8 *PutFileNeeded(UINT16 firstfile) if (p + 1 + 4 + strlen(wadfilename) + 16 > p_start + MAXFILENEEDED) { // Too many files to send all at once - netbuffer->u.serverinfo.kartvars |= SV_LOTSOFADDONS; + if (netbuffer->packettype == PT_MOREFILESNEEDED) + netbuffer->u.filesneededcfg.more = 1; + else + netbuffer->u.serverinfo.kartvars |= SV_LOTSOFADDONS; break; } @@ -154,7 +157,10 @@ UINT8 *PutFileNeeded(UINT16 firstfile) WRITESTRINGN(p, wadfilename, MAX_WADPATH); WRITEMEM(p, wadfiles[i]->md5sum, 16); } - netbuffer->u.serverinfo.fileneedednum = count; + if (netbuffer->packettype == PT_MOREFILESNEEDED) + netbuffer->u.filesneededcfg.num = count; + else + netbuffer->u.serverinfo.fileneedednum = count; return p; } @@ -354,7 +360,8 @@ INT32 CL_CheckFiles(void) // the first is the iwad (the main wad file) // we don't care if it's called srb2.srb or srb2.wad. // Never download the IWAD, just assume it's there and identical - fileneeded[0].status = FS_OPEN; + // ...No! Why were we sending the base wads to begin with?? + //fileneeded[0].status = FS_OPEN; // Modified game handling -- check for an identical file list // must be identical in files loaded AND in order @@ -362,7 +369,7 @@ INT32 CL_CheckFiles(void) if (modifiedgame) { CONS_Debug(DBG_NETPLAY, "game is modified; only doing basic checks\n"); - for (i = 1, j = 1; i < fileneedednum || j < numwadfiles;) + for (i = 0, j = mainwads; i < fileneedednum || j < numwadfiles;) { if (j < numwadfiles && !wadfiles[j]->important) { @@ -389,12 +396,12 @@ INT32 CL_CheckFiles(void) return 1; } - for (i = 1; i < fileneedednum; i++) + for (i = 0; i < fileneedednum; i++) { CONS_Debug(DBG_NETPLAY, "searching for '%s' ", fileneeded[i].filename); // Check in already loaded files - for (j = 1; wadfiles[j]; j++) + for (j = mainwads; wadfiles[j]; j++) { nameonly(strcpy(wadfilename, wadfiles[j]->filename)); if (!stricmp(wadfilename, fileneeded[i].filename) && @@ -410,8 +417,7 @@ INT32 CL_CheckFiles(void) packetsize += nameonlylength(fileneeded[i].filename) + 22; - if ((numwadfiles+filestoget >= MAX_WADFILES) - || (packetsize > MAXFILENEEDED*sizeof(UINT8))) + if (mainwads+filestoget >= MAX_WADFILES) return 3; filestoget++; From cc7699a3710013b7198743a801e98827c3562674 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Thu, 18 Apr 2019 00:39:54 -0500 Subject: [PATCH 7/9] Show when we're waiting for the full wadlist --- src/d_clisrv.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 08f28d176..f534a60bd 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1259,6 +1259,9 @@ static inline void CL_DrawConnectionStatus(void) cltext = M_GetText("Waiting to download game state..."); break; #endif + case CL_ASKFULLFILELIST: + cltext = M_GetText("This server has a LOT of files!"); + break; case CL_ASKJOIN: case CL_WAITJOINRESPONSE: cltext = M_GetText("Requesting to join..."); From 1c1435aea718208993615b56ebc231bf4071c019 Mon Sep 17 00:00:00 2001 From: Sal Date: Mon, 6 May 2019 21:51:35 -0400 Subject: [PATCH 8/9] Merge branch 'version-prep' into 'master' Version prep See merge request KartKrew/Kart!148 (cherry picked from commit dfc4b22c911340e330a0f71fabb4a1461b5747ed) 2e221946 Final v1 colors 359d06f1 Modify the first shade of Byzantium 3a707c09 Add options for adjusting deadzone, increase default deadzone from 0.25 to 0.5 889ead78 Fix wheel animations 2d9ae1ab Dumbass typo e954f0b4 Missed a spot 5316e63a Merge branch 'next-colors' into 'v1' 55db2268 Merge branch 'anim-fix' into 'v1' 26159aae Merge branch 'deadzone-bullshit' into 'v1' 30c19caa Update version number 8f07ed77 Update patch.kart hash --- CMakeLists.txt | 2 +- appveyor.yml | 4 ++-- src/config.h.in | 4 ++-- src/doomdef.h | 15 ++++++++------- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e7c4de616..7995034d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0) # DO NOT CHANGE THIS SRB2 STRING! Some variable names depend on this string. # Version change is fine. project(SRB2 - VERSION 1.0.4 + VERSION 1.1.0 LANGUAGES C) if(${PROJECT_SOURCE_DIR} MATCHES ${PROJECT_BINARY_DIR}) diff --git a/appveyor.yml b/appveyor.yml index 10b658918..3d46cf6de 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 1.0.4.{branch}-{build} +version: 1.1.0.{branch}-{build} os: MinGW environment: @@ -29,7 +29,7 @@ environment: ############################## DPL_ENABLED: 0 DPL_TAG_ENABLED: 0 - DPL_INSTALLER_NAME: srb2kart-v104 + DPL_INSTALLER_NAME: srb2kart-v110 # Asset handling is barebones vs. Travis Deployer. We operate on 7z only. # Include the README files and the OpenGL batch in the main and patch archives. # The x86/x64 archives contain the DLL binaries. diff --git a/src/config.h.in b/src/config.h.in index bd7e78619..f3dd53ee1 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -37,7 +37,7 @@ * Last updated 2015 / 05 / 03 - SRB2 v2.1.15 - srb2.srb * Last updated 2018 / 12 / 23 - SRB2 v2.1.22 - patch.dta * Last updated 2019 / 01 / 18 - Kart v1.0.2 - Main assets - * Last updated 2019 / 03 / 11 - Kart v1.0.4 - patch.kart + * Last updated 2019 / 03 / 11 - Kart v1.1.0 - patch.kart */ // Base SRB2 hashes @@ -52,7 +52,7 @@ #define ASSET_HASH_CHARS_KART "e2c428347dde52858a3dacd29fc5b964" #define ASSET_HASH_MAPS_KART "1335cd064656aedca359cfbb5233ac4a" #ifdef USE_PATCH_KART -#define ASSET_HASH_PATCH_KART "b5f48e1abccfa47a5745199182e2fef4" +#define ASSET_HASH_PATCH_KART "6461b30bb20754a16a1b582120f55842" #endif #endif diff --git a/src/doomdef.h b/src/doomdef.h index b12c42b49..acd279776 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -149,12 +149,13 @@ extern FILE *logstream; // most interface strings are ignored in development mode. // we use comprevision and compbranch instead. #else -#define VERSION 100 // Game version -#define SUBVERSION 4 // more precise version number -#define VERSIONSTRING "v1.0.4" -#define VERSIONSTRINGW L"v1.0.4" -// Hey! If you change this, add 1 to the MODVERSION below! -// Otherwise we can't force updates! +#define VERSION 110 // Game version +#define SUBVERSION 0 // more precise version number +#define VERSIONSTRING "v1.1" +#define VERSIONSTRINGW L"v1.1" +// Hey! If you change this, add 1 to the MODVERSION below! Otherwise we can't force updates! +// And change CMakeLists.txt, for CMake users! +// AND appveyor.yml, for the build bots! #endif // Maintain compatibility with 1.0.x record attack replays? @@ -224,7 +225,7 @@ extern FILE *logstream; // it's only for detection of the version the player is using so the MS can alert them of an update. // Only set it higher, not lower, obviously. // Note that we use this to help keep internal testing in check; this is why v2.1.0 is not version "1". -#define MODVERSION 4 +#define MODVERSION 5 // Filter consvars by version // To version config.cfg, MAJOREXECVERSION is set equal to MODVERSION automatically. From 3e93180d3db25cc3e27819ca420035828c048e75 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 6 May 2019 22:39:20 -0400 Subject: [PATCH 9/9] Don't cover chat with pause effect --- src/d_main.c | 3 --- src/hu_stuff.c | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 08ae8af17..c2d1d2869 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -534,9 +534,6 @@ static void D_Display(void) if (demo.rewinding) V_DrawFadeScreen(TC_RAINBOW, (leveltime & 0x20) ? SKINCOLOR_PASTEL : SKINCOLOR_MOONSLAM); - if (cv_vhseffect.value && (paused || (demo.playback && cv_playbackspeed.value > 1))) - V_DrawVhsEffect(demo.rewinding); - // vid size change is now finished if it was on... vid.recalc = 0; diff --git a/src/hu_stuff.c b/src/hu_stuff.c index b7eb1e1f3..f343f12b7 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -2292,6 +2292,9 @@ void HU_DrawSongCredits(void) // void HU_Drawer(void) { + if (cv_vhseffect.value && (paused || (demo.playback && cv_playbackspeed.value > 1))) + V_DrawVhsEffect(demo.rewinding); + #ifndef NONET // draw chat string plus cursor if (chat_on)