From 6e7f38475ff6ac4275c95542a3fab0cc2fca9e33 Mon Sep 17 00:00:00 2001 From: Hannu Hanhi Date: Sat, 13 Jun 2020 17:07:05 +0300 Subject: [PATCH 1/7] Add missing inflateEnd to fix memory leak in W_ReadLumpHeaderPwad --- src/w_wad.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/w_wad.c b/src/w_wad.c index 54ae7fb26..d68af8f20 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -1314,6 +1314,7 @@ size_t W_ReadLumpHeaderPwad(UINT16 wad, UINT16 lump, void *dest, size_t size, si if (zErr == Z_STREAM_END) { M_Memcpy(dest, decData, size); + inflateEnd(&strm); } else { From fb1dae197fa73277627b01761d5c7b82fe5bba8f Mon Sep 17 00:00:00 2001 From: Hannu Hanhi Date: Sat, 13 Jun 2020 21:37:33 +0300 Subject: [PATCH 2/7] Cleaner version of the W_ReadLumpHeaderPwad memory leak fix --- src/w_wad.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/w_wad.c b/src/w_wad.c index d68af8f20..7fd7ac125 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -1314,14 +1314,13 @@ size_t W_ReadLumpHeaderPwad(UINT16 wad, UINT16 lump, void *dest, size_t size, si if (zErr == Z_STREAM_END) { M_Memcpy(dest, decData, size); - inflateEnd(&strm); } else { size = 0; zerr(zErr); - (void)inflateEnd(&strm); } + (void)inflateEnd(&strm); } else { From 137788b0c9736970c1dc6b357ce34c01ca001e05 Mon Sep 17 00:00:00 2001 From: Hannu Hanhi Date: Sat, 13 Jun 2020 23:34:13 +0300 Subject: [PATCH 3/7] Fix uninitialized alpha when reading colormaps --- src/p_setup.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/p_setup.c b/src/p_setup.c index c0254bf4a..37bd77b5f 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1494,6 +1494,7 @@ static void P_LoadRawSideDefs2(void *data) color.s.red = (HEX2INT(col[1]) << 4) + HEX2INT(col[2]); color.s.green = (HEX2INT(col[3]) << 4) + HEX2INT(col[4]); color.s.blue = (HEX2INT(col[5]) << 4) + HEX2INT(col[6]); + color.s.alpha = 0; #ifdef GLENCORE if (encoremap) @@ -1535,6 +1536,7 @@ static void P_LoadRawSideDefs2(void *data) color.s.red = (HEX2INT(col[1]) << 4) + HEX2INT(col[2]); color.s.green = (HEX2INT(col[3]) << 4) + HEX2INT(col[4]); color.s.blue = (HEX2INT(col[5]) << 4) + HEX2INT(col[6]); + color.s.alpha = 0; #ifdef GLENCORE if (encoremap) From 169c3cae4399d1ec52bf88d217ce4deaffbca8d2 Mon Sep 17 00:00:00 2001 From: Hannu Hanhi Date: Sun, 14 Jun 2020 14:53:53 +0300 Subject: [PATCH 4/7] Colormap alpha handling was still wrong, hopefully it's correct now --- src/p_setup.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index 37bd77b5f..85243d504 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1494,17 +1494,16 @@ static void P_LoadRawSideDefs2(void *data) color.s.red = (HEX2INT(col[1]) << 4) + HEX2INT(col[2]); color.s.green = (HEX2INT(col[3]) << 4) + HEX2INT(col[4]); color.s.blue = (HEX2INT(col[5]) << 4) + HEX2INT(col[6]); - color.s.alpha = 0; #ifdef GLENCORE if (encoremap) { j = encoremap[NearestColor(color.s.red, color.s.green, color.s.blue)]; //CONS_Printf("R_CreateColormap: encoremap[%d] = %d\n", j, encoremap[j]); -- moved encoremap upwards for optimisation - color = pLocalPalette[j]; + color = pLocalPalette[j]; // note: this sets alpha to 255, we will reset it below } #endif - + color.s.alpha = 0; // reset/init the alpha, so the addition below will work correctly sec->extra_colormap->rgba = color.rgba; // alpha @@ -1536,17 +1535,16 @@ static void P_LoadRawSideDefs2(void *data) color.s.red = (HEX2INT(col[1]) << 4) + HEX2INT(col[2]); color.s.green = (HEX2INT(col[3]) << 4) + HEX2INT(col[4]); color.s.blue = (HEX2INT(col[5]) << 4) + HEX2INT(col[6]); - color.s.alpha = 0; #ifdef GLENCORE if (encoremap) { j = encoremap[NearestColor(color.s.red, color.s.green, color.s.blue)]; //CONS_Printf("R_CreateColormap: encoremap[%d] = %d\n", j, encoremap[j]); -- moved encoremap upwards for optimisation - color = pLocalPalette[j]; + color = pLocalPalette[j]; // note: this sets alpha to 255, we will reset it below } #endif - + color.s.alpha = 0; // reset/init the alpha, so the addition below will work correctly sec->extra_colormap->fadergba = color.rgba; // alpha From 6714d9b614a92ffdd6be2bdbb7fef2a401adf1e0 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Tue, 23 Jun 2020 18:39:02 -0400 Subject: [PATCH 5/7] Fix user agent for HTTP downloads being set as SRB2Kart/v1.1.2 --- src/d_netfil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_netfil.c b/src/d_netfil.c index 3dc9da68c..f5550c060 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -1088,7 +1088,7 @@ void CURLPrepareFile(const char* url, int dfilenum) // Only allow HTTP and HTTPS curl_easy_setopt(http_handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS); - curl_easy_setopt(http_handle, CURLOPT_USERAGENT, va("SRB2Kart/v%d.%d.%d", VERSION/100, VERSION%100, SUBVERSION)); // Set user agent as some servers won't accept invalid user agents. + curl_easy_setopt(http_handle, CURLOPT_USERAGENT, va("SRB2Kart/v%d.%d", VERSION, SUBVERSION)); // Set user agent as some servers won't accept invalid user agents. // Follow a redirect request, if sent by the server. curl_easy_setopt(http_handle, CURLOPT_FOLLOWLOCATION, 1L); From f0fac04dfd7ee0bfc3fd30d0ebdb4f26a2af8e71 Mon Sep 17 00:00:00 2001 From: Ashnal Date: Sat, 23 May 2020 17:59:31 -0400 Subject: [PATCH 6/7] Experiemntal clientside ack fix Stops the client from using reliable packets before joining a server Clients can time out during addon loading sending reliable packets before then can cause out of order acks This causes joinbug, chatbug, and chatspam, as well as general server instability due to unnecesary packetspam --- src/d_clisrv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 251f413ab..d5c4006e6 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1270,7 +1270,7 @@ static boolean CL_AskFileList(INT32 firstfile) netbuffer->packettype = PT_TELLFILESNEEDED; netbuffer->u.filesneedednum = firstfile; - return HSendPacket(servernode, true, 0, sizeof (INT32)); + return HSendPacket(servernode, false, 0, sizeof (INT32)); } /** Sends a special packet to declare how many players in local From 4f1642bbced7fdcf7b0d5aa191390f6d508124d7 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Wed, 5 Aug 2020 00:40:56 -0500 Subject: [PATCH 7/7] Clarify addon-related messages --- src/d_clisrv.c | 21 +++++++++++---------- src/m_menu.c | 4 ++-- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 79a8e8291..7f335182e 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1923,11 +1923,11 @@ static boolean CL_FinishedFileList(void) 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" + "You have the wrong addons loaded.\n\n" + "To play on this server, restart\n" + "the game and don't load any addons.\n" + "SRB2Kart will automatically add\n" + "everything you need when you join.\n\n" "Press ESC\n" ), NULL, MM_NOTHING); return false; @@ -1948,11 +1948,12 @@ static boolean CL_FinishedFileList(void) 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" + "An error occured when trying to\n" + "download missing addons.\n" + "(This is almost always a problem\n" + "with the server, not your game.)\n\n" + "See the console or log file\n" + "for additional details.\n\n" "Press ESC\n" ), NULL, MM_NOTHING); return false; diff --git a/src/m_menu.c b/src/m_menu.c index e08a53c56..eb19ecef3 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -4833,7 +4833,7 @@ static boolean M_AddonsRefresh(void) else if (majormods && !prevmajormods) { S_StartSound(NULL, sfx_s221); - message = va("%c%s\x80\nGameplay has now been modified.\nIf you wish to play Record Attack mode, restart the game to clear existing addons.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname); + message = va("%c%s\x80\nYou've loaded a gameplay-modifying addon.\n\nRecord Attack has been disabled, but you\ncan still play alone in local Multiplayer.\n\nIf you wish to play Record Attack mode, restart the game to disable loaded addons.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname); prevmajormods = majormods; } @@ -8538,7 +8538,7 @@ static void M_ConnectMenuModChecks(INT32 choice) if (modifiedgame) { - M_StartMessage(M_GetText("Addons are currently loaded.\n\nYou will only be able to join a server if\nit has the same ones loaded in the same order, which may be unlikely.\n\nIf you wish to play on other servers,\nrestart the game to clear existing addons.\n\n(Press a key)\n"),M_ConnectMenu,MM_EVENTHANDLER); + M_StartMessage(M_GetText("You have addons loaded.\nYou won't be able to join netgames!\n\nTo play online, restart the game\nand don't load any addons.\nSRB2Kart will automatically add\neverything you need when you join.\n\n(Press a key)\n"),M_ConnectMenu,MM_EVENTHANDLER); return; }