From 4bb5b8fa040f9aeb4ef4c6305bc514f37785f1d9 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 27 Oct 2025 22:24:08 +0100 Subject: [PATCH 1/3] add "Fake Seed" system allow sending a fake player to the ms and serverbrowser when your dedicated server is empty effectively functioning as a "seed" player without manual intervention and occupieng a server slot --- src/d_clisrv.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++- src/d_clisrv.h | 2 ++ src/d_netcmd.c | 3 +++ 3 files changed, 52 insertions(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index a88954867..714ff90c9 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -144,6 +144,10 @@ static CV_PossibleValue_t mindelay_cons_t[] = {{0, "MIN"}, {30, "MAX"}, {0, NULL consvar_t cv_mindelay = {"mindelay", "0", CV_SAVE, mindelay_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_gentlemens = {"gentlemensdelay", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, Lagless_OnChange, 0, NULL, NULL, 0, 0, NULL}; // this should be a netvar Zzz... +// allows a fake player to appear on the ms and serverlist when your dedi server is empty +consvar_t cv_usefakeseed = {"fakeseed", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_fakeseedname = {"fakeseedname", "Player 1", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; + SINT8 nodetoplayer[MAXNETNODES]; SINT8 nodetoplayer2[MAXNETNODES]; // say the numplayer for this node if any (splitscreen) SINT8 nodetoplayer3[MAXNETNODES]; // say the numplayer for this node if any (splitscreen == 2) @@ -1545,6 +1549,12 @@ static boolean CL_SendJoin(void) return HSendPacket(servernode, false, 0, sizeof(clientconfig_pak)); } +static boolean UseFakeSeed(void) +{ + // due to complexity this will disable the moment a real player joins + return (dedicated && cv_usefakeseed.value && D_NumPlayers() == 0); +} + static void SV_SendServerInfo(INT32 node, tic_t servertime) { UINT8 *p; @@ -1567,7 +1577,12 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime) netbuffer->u.serverinfo.time = (tic_t)LONG(servertime); netbuffer->u.serverinfo.leveltime = (tic_t)LONG(leveltime); - netbuffer->u.serverinfo.numberofplayer = (UINT8)D_NumPlayers(); + // force 1 player + if (UseFakeSeed()) + netbuffer->u.serverinfo.numberofplayer = (UINT8)1; + else + netbuffer->u.serverinfo.numberofplayer = (UINT8)D_NumPlayers(); + netbuffer->u.serverinfo.maxplayer = (UINT8)(min((dedicated ? MAXPLAYERS-1 : MAXPLAYERS), cv_maxplayers.value)); // SRB2Kart: Vanilla's gametype constants for MS support @@ -1646,6 +1661,37 @@ static void SV_SendPlayerInfo(INT32 node) netbuffer->packettype = PT_PLAYERINFO; + // send a fake player to trick ms and serverbrowser + if (UseFakeSeed()) + { + //printf("sending fake player lmao\n"); + netbuffer->u.playerinfo[0].node = 0; + + // fallback to smth, make sure this is always set + if (!cv_fakeseedname.string[0]) + CV_Set(&cv_fakeseedname, "Player 1"); + strlcpy(netbuffer->u.playerinfo[0].name, cv_fakeseedname.string, MAXPLAYERNAME+1); + + memset(netbuffer->u.playerinfo[0].address, 0, 4); + + // make it appear as spectator + netbuffer->u.playerinfo[0].team = 255; + + // doesent really matter what we put here lel + netbuffer->u.playerinfo[0].score = LONG(42069); + netbuffer->u.playerinfo[0].timeinserver = SHORT(42069); + netbuffer->u.playerinfo[0].skin = (UINT8)1; // no clue wtf skin 1 is, tails maybe? + + netbuffer->u.playerinfo[0].data = 0; + + // mark every other slot as empty + for (i = 1; i < MSCOMPAT_MAXPLAYERS; i++) + netbuffer->u.playerinfo[i].node = 255; + + HSendPacket(node, false, 0, sizeof(plrinfo) * MSCOMPAT_MAXPLAYERS); + return; + } + for (i = 0; i < MSCOMPAT_MAXPLAYERS; i++) { if ((i >= MAXPLAYERS) || !playeringame[i]) diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 74bed4cdb..4b5c3702a 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -582,6 +582,8 @@ extern tic_t simulated_lag; extern tic_t lowest_lag; extern consvar_t cv_mindelay, cv_gentlemens; +extern consvar_t cv_usefakeseed, cv_fakeseedname; + extern consvar_t cv_netticbuffer, cv_allownewplayer, #ifdef SATURNJOIN diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 92d9fb935..c07256985 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -756,6 +756,9 @@ void D_RegisterServerCommands(void) CV_RegisterVar(&cv_showping); CV_RegisterVar(&cv_pingmeasurement); + CV_RegisterVar(&cv_usefakeseed); + CV_RegisterVar(&cv_fakeseedname); + #ifdef SEENAMES CV_RegisterVar(&cv_allowseenames); #endif From e5c18ae1f1156a5f94cf6bb9b302beecfcaad1a2 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 27 Oct 2025 22:47:10 +0100 Subject: [PATCH 2/3] update ms listing if fakeseed was changed --- src/d_clisrv.c | 12 ++++++++++-- src/mserv.c | 9 ++++++++- src/mserv.h | 2 ++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 714ff90c9..c1ef6211a 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -145,8 +145,9 @@ consvar_t cv_mindelay = {"mindelay", "0", CV_SAVE, mindelay_cons_t, NULL, 0, NUL consvar_t cv_gentlemens = {"gentlemensdelay", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, Lagless_OnChange, 0, NULL, NULL, 0, 0, NULL}; // this should be a netvar Zzz... // allows a fake player to appear on the ms and serverlist when your dedi server is empty -consvar_t cv_usefakeseed = {"fakeseed", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_fakeseedname = {"fakeseedname", "Player 1", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; +static void FakeSeed_OnChange(void); +consvar_t cv_usefakeseed = {"fakeseed", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, FakeSeed_OnChange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_fakeseedname = {"fakeseedname", "Player 1", CV_SAVE|CV_CALL|CV_NOINIT, NULL, FakeSeed_OnChange, 0, NULL, NULL, 0, 0, NULL}; SINT8 nodetoplayer[MAXNETNODES]; SINT8 nodetoplayer2[MAXNETNODES]; // say the numplayer for this node if any (splitscreen) @@ -245,6 +246,13 @@ consvar_t cv_httpsource = {"http_source", "", CV_SAVE, NULL, NULL, 0, NULL, NULL consvar_t cv_kicktime = {"kicktime", "10", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL}; +static void FakeSeed_OnChange(void) +{ +#ifdef MASTERSERVER + Update_MS(); +#endif +} + static boolean UseLocalDelay(void) { if (dedicated || (server && server_lagless && !cv_mindelay.value) || modeattacking == ATTACKING_RECORD) diff --git a/src/mserv.c b/src/mserv.c index c7eb50442..e60d556e2 100644 --- a/src/mserv.c +++ b/src/mserv.c @@ -608,10 +608,17 @@ Update_parameters (void) } #endif/*MASTERSERVER*/ } + +#ifdef MASTERSERVER +void Update_MS(void) +{ + Update_parameters(); +} +#endif + #ifdef MASTERSERVER static void MasterServer_OnChange(void) { - UnregisterServer(); Set_api(cv_masterserver.string); diff --git a/src/mserv.h b/src/mserv.h index a8de2152f..c89ececd2 100644 --- a/src/mserv.h +++ b/src/mserv.h @@ -88,6 +88,8 @@ char *GetMODVersion(int id); #endif char *GetMasterServerRules(void); + +void Update_MS(void); #endif void AddMServCommands(void); From 76747b46778d9f327ae08be425f2f5176ebba76d Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 11 Nov 2025 14:48:59 +0100 Subject: [PATCH 3/3] git merge pls --- src/d_main.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/src/d_main.c b/src/d_main.c index 7a738288b..14b205418 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -166,6 +166,57 @@ UINT8 ctrldown = 0; // 0x1 left, 0x2 right UINT8 altdown = 0; // 0x1 left, 0x2 right boolean capslock = 0; // gee i wonder what this does. +static void D_PadMenuScrollInput(UINT8 input) +{ + event_t dpadev; + memset(&dpadev, 0, sizeof(event_t)); + dpadev.type = ev_keydown; + + switch (input) + { + case DPAD_UP: + dpadev.data1 = KEY_UPARROW; + break; + case DPAD_DOWN: + dpadev.data1 = KEY_DOWNARROW; + break; + case DPAD_LEFT: + dpadev.data1 = KEY_LEFTARROW; + break; + case DPAD_RIGHT: + dpadev.data1 = KEY_RIGHTARROW; + break; + } + + D_PostEvent(&dpadev); // put into eventlist +} + +#define SCROLLDELAY 19 + +// Check if any dpad button is held +// and pass it to the eventlist +static void D_GamePadMenuScrollTicker(void) +{ + UINT8 i; + static UINT8 menuInputDelayTimer = 0; + + for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) + { + if (dpadscrollstate[i]) + { + if (menuInputDelayTimer < SCROLLDELAY) + menuInputDelayTimer++; + else if (menuInputDelayTimer == SCROLLDELAY) + D_PadMenuScrollInput(i); + + return; + } + } + + menuInputDelayTimer = 0; +} +#undef SCROLLDELAY + static UINT16 curcolor[MAXSPLITSCREENPLAYERS] = {}; static void D_DeviceLEDTick(void)