From b432491d34fe552ce81d7183d5b5e62e73dc0e17 Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 17 Aug 2024 19:54:56 +0200 Subject: [PATCH] throw saturnpacket and join stuff behind "SATURNPAK" ifdef, disable it for now --- src/d_clisrv.c | 26 ++++++++++++++++++++++++++ src/d_clisrv.h | 10 +++++++++- src/d_net.c | 2 ++ src/d_netcmd.c | 2 ++ src/doomdef.h | 4 ++++ 5 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index a9d121997..ef1076b3b 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -146,8 +146,10 @@ static boolean cl_packetmissed; static UINT8 mynode; // my address pointofview server static boolean cl_redownloadinggamestate = false; +#ifdef SATURNPAK boolean is_client_saturn[MAXNETNODES]; #define ISSATURN 69 +#endif static UINT8 localtextcmd[MAXTEXTCMD]; static UINT8 localtextcmd2[MAXTEXTCMD]; // splitscreen @@ -1443,7 +1445,9 @@ static boolean CL_SendJoin(void) netbuffer->u.clientcfg.subversion = SUBVERSION; strncpy(netbuffer->u.clientcfg.application, SRB2APPLICATION, sizeof netbuffer->u.clientcfg.application); +#ifdef SATURNPAK netbuffer->u.clientcfg.issaturn = ISSATURN; +#endif return HSendPacket(servernode, false, 0, sizeof (clientconfig_pak)); } @@ -3201,7 +3205,9 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason) SV_InitResynchVars(node); // If a resynch was in progress, well, it no longer needs to be. nodeingame[node] = false; +#ifdef SATURNPAK is_client_saturn[node] = false; +#endif can_receive_gamestate[node] = false; Net_CloseConnection(node); ResetNode(node); @@ -3308,7 +3314,9 @@ void CL_Reset(void) if (servernode > 0 && servernode < MAXNETNODES) { nodeingame[(UINT8)servernode] = false; +#ifdef SATURNPAK is_client_saturn[(UINT8)servernode] = false; +#endif Net_CloseConnection(servernode); } D_CloseConnection(); // netgame = false @@ -4041,7 +4049,9 @@ consvar_t cv_joinrefusemessage = {"joinrefusemessage", "The server is not accept consvar_t cv_allownewplayer = {"allowjoin", "On", CV_SAVE|CV_CALL, CV_OnOff, Joinable_OnChange, 0, NULL, NULL, 0, 0, NULL}; +#ifdef SATURNPAK consvar_t cv_allownewsaturnplayer = {"allowsaturnjoin", "On", CV_SAVE|CV_HIDEN, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +#endif #ifdef VANILLAJOINNEXTROUND consvar_t cv_joinnextround = {"joinnextround", "Off", CV_SAVE|CV_NETVAR, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; /// \todo not done @@ -4088,11 +4098,13 @@ static void Joinable_OnChange(void) if (!server) return; +#ifdef SATURNPAK // disabling joins should also disable saturn joins unless its called with CV_StealthSet and vice versa to make life a bit easier if (!cv_allownewplayer.value) CV_Set(&cv_allownewsaturnplayer, "Off"); else if (cv_allownewplayer.value) CV_Set(&cv_allownewsaturnplayer, "On"); +#endif maxplayer = (UINT8)(min((dedicated ? MAXPLAYERS-1 : MAXPLAYERS), cv_maxplayers.value)); @@ -4175,7 +4187,9 @@ static void ResetNode(INT32 node) bannednode[node].timeleft = NO_BAN_TIME; // SATURN +#ifdef SATURNPAK is_client_saturn[node] = false; +#endif resendingsavegame[node] = false; can_receive_gamestate[node] = false; @@ -4510,11 +4524,13 @@ static boolean SV_AddWaitingPlayers(void) return newplayer; } +#ifdef SATURNPAK static inline void SendSaturnInfo(INT32 node) { netbuffer->packettype = PT_ISSATURN; HSendPacket(node, true, 0, 0); } +#endif void CL_AddSplitscreenPlayer(void) { @@ -4701,7 +4717,11 @@ static void HandleConnect(SINT8 node) { SV_SendRefuse(node, va(M_GetText("Different SRB2Kart versions cannot\nplay a netgame!\n(server version %d.%d)"), VERSION, SUBVERSION)); } +#ifdef SATURNPAK else if ((!cv_allownewplayer.value && node && netbuffer->u.clientcfg.issaturn != ISSATURN) || (!cv_allownewsaturnplayer.value && node && netbuffer->u.clientcfg.issaturn == ISSATURN)) +#else + else if (!cv_allownewplayer.value && node) +#endif { SV_SendRefuse(node, M_GetText(cv_joinrefusemessage.string)); } @@ -5062,7 +5082,9 @@ static void HandlePacketFromAwayNode(SINT8 node) #endif DEBFILE(va("Server accept join gametic=%u mynode=%d\n", gametic, mynode)); +#ifdef SATURNPAK SendSaturnInfo(node); +#endif memset(playeringame, 0, sizeof(playeringame)); for (j = 0; j < MAXPLAYERS; j++) @@ -5490,7 +5512,9 @@ static void HandlePacketFromPlayer(SINT8 node) } Net_CloseConnection(node); nodeingame[node] = false; +#ifdef SATURNPAK is_client_saturn[node] = false; +#endif can_receive_gamestate[node] = false; break; // -------------------------------------------- CLIENT RECEIVE ---------- @@ -5655,10 +5679,12 @@ static void HandlePacketFromPlayer(SINT8 node) if (client) Got_Filetxpak(); break; +#ifdef SATURNPAK case PT_ISSATURN: //CONS_Printf("hi im on saturn\n"); is_client_saturn[node] = true; break; +#endif case PT_CANRECEIVEGAMESTATE: can_receive_gamestate[node] = true; PT_CanReceiveGamestate(node); diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 535485672..37a828788 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -99,7 +99,9 @@ typedef enum PT_PING, // Packet sent to tell clients the other client's latency to server. +#ifdef SATURNPAK PT_ISSATURN, +#endif PT_WILLRESENDGAMESTATE, // Hey Client, I am about to resend you the gamestate! PT_CANRECEIVEGAMESTATE, // Okay Server, I'm ready to receive it, you can go ahead. PT_RECEIVEDGAMESTATE, // Thank you Server, I am ready to play again! @@ -369,7 +371,9 @@ typedef struct UINT8 subversion; // Contains build version UINT8 localplayers; // number of splitscreen players UINT8 mode; +#ifdef SATURNPAK UINT8 issaturn; +#endif } ATTRPACK clientconfig_pak; #define SV_SPEEDMASK 0x03 // used to send kartspeed @@ -574,7 +578,11 @@ extern consvar_t #ifdef VANILLAJOINNEXTROUND cv_joinnextround, #endif - cv_netticbuffer, cv_allownewplayer, cv_allownewsaturnplayer, cv_joinrefusemessage, cv_maxplayers, cv_resynchattempts, cv_resynchcooldown, cv_gamestateattempts, cv_blamecfail, cv_maxsend, cv_noticedownload, cv_downloadspeed; + cv_netticbuffer, cv_allownewplayer, +#ifdef SATURNPAK + cv_allownewsaturnplayer, +#endif + cv_joinrefusemessage, cv_maxplayers, cv_resynchattempts, cv_resynchcooldown, cv_gamestateattempts, cv_blamecfail, cv_maxsend, cv_noticedownload, cv_downloadspeed; extern consvar_t cv_connectawaittime; diff --git a/src/d_net.c b/src/d_net.c index 312e90caa..2f60eb3d4 100644 --- a/src/d_net.c +++ b/src/d_net.c @@ -834,7 +834,9 @@ const char *packettypename[NUMPACKETTYPE] = "PING", +#ifdef SATURNPAK "ISSATURN", +#endif "WILLRESENDGAMESTATE", "CANRECEIVEGAMESTATE", diff --git a/src/d_netcmd.c b/src/d_netcmd.c index b69a5b437..a81b6d1bf 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -795,7 +795,9 @@ void D_RegisterServerCommands(void) CV_RegisterVar(&cv_httpsource); #ifndef NONET CV_RegisterVar(&cv_allownewplayer); +#ifdef SATURNPAK CV_RegisterVar(&cv_allownewsaturnplayer); +#endif CV_RegisterVar(&cv_joinrefusemessage); CV_RegisterVar(&cv_chatlogsize); #ifdef VANILLAJOINNEXTROUND diff --git a/src/doomdef.h b/src/doomdef.h index 3540c3f4a..37e553816 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -568,6 +568,10 @@ extern const char *compdate, *comptime, *comprevision, *compbranch; // None of these that are disabled in the normal build are guaranteed to work perfectly // Compile them at your own risk! +/// Server detection for if a connecting client is on Saturn. +/// For stuff like extra synching, joinblock, etc. +//#define SATURNPAK + /// Undefine to use the new method of Gamma correction see colour cube in v_video.c #define BACKWARDSCOMPATCORRECTION