From 790f2d2488928f4a8e9dd28a811eeab9cf1c714a Mon Sep 17 00:00:00 2001 From: NepDisk Date: Sat, 13 Dec 2025 23:43:48 -0500 Subject: [PATCH] Fix commit SHA blocking and make it more obvious this is an indev project --- src/d_clisrv.c | 11 +++++++++-- src/d_clisrv.h | 5 ++++- src/d_main.cpp | 19 +++++++++++++++++++ src/d_netcmd.c | 6 +++--- src/doomdef.h | 3 +++ src/m_menu.c | 6 ++---- src/sdl/i_video.cpp | 11 ++++++++++- 7 files changed, 50 insertions(+), 11 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 51803d714..0a0ebb379 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -977,10 +977,13 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime) netbuffer->packettype = PT_SERVERINFO; netbuffer->u.serverinfo._255 = 255; netbuffer->u.serverinfo.packetversion = PACKETVERSION; - netbuffer->u.serverinfo.version = VERSION; - netbuffer->u.serverinfo.subversion = SUBVERSION; +#ifdef COMMITVERSION memcpy(netbuffer->u.serverinfo.commit, comprevision_abbrev_bin, GIT_SHA_ABBREV); +#else + netbuffer->u.serverinfo.version = VERSION; + netbuffer->u.serverinfo.subversion = SUBVERSION; +#endif strncpy(netbuffer->u.serverinfo.application, SRB2APPLICATION, sizeof netbuffer->u.serverinfo.application); // return back the time value so client can compute their ping @@ -1524,11 +1527,13 @@ static void SL_InsertServer(serverinfo_pak* info, SINT8 node) if (info->packetversion != PACKETVERSION) return;/* old new packet format */ +#ifndef COMMITVERSION if (info->version != VERSION) return; // Not same version. if (info->subversion != SUBVERSION) return; // Close, but no cigar. +#endif if (!fastcmp(info->application, SRB2APPLICATION)) return;/* that's a different mod */ @@ -2246,8 +2251,10 @@ static void CL_ConnectToServer(void) CONS_Printf(M_GetText("Connecting to: %s\n"), serverlist[i].info.servername); gametypestr[sizeof serverlist[i].info.gametypename - 1] = '\0'; CONS_Printf(M_GetText("Gametype: %s\n"), gametypestr); +#ifndef COMMITVERSION CONS_Printf(M_GetText("Version: %d.%d\n"), serverlist[i].info.version, serverlist[i].info.subversion); +#endif } SL_ClearServerList(servernode); diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 6818d49f4..d8f51c061 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -304,9 +304,12 @@ struct serverinfo_pak UINT8 _255; UINT8 packetversion; char application[MAXAPPLICATION]; +#ifdef COMMITVERSION + UINT8 commit[GIT_SHA_ABBREV]; +#else UINT8 version; UINT8 subversion; - UINT8 commit[GIT_SHA_ABBREV]; +#endif UINT8 numberofplayer; UINT8 maxplayer; UINT8 refusereason; // 0: joinable, 1: joins disabled, 2: full diff --git a/src/d_main.cpp b/src/d_main.cpp index b0392ef37..9f35f3bd2 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -119,7 +119,9 @@ // Version numbers for netplay :upside_down_face: int VERSION; int SUBVERSION; +#ifdef COMMITVERSION UINT8 comprevision_abbrev_bin[GIT_SHA_ABBREV]; +#endif #ifdef HAVE_DISCORDRPC #include "discord.h" @@ -1389,6 +1391,19 @@ static void IdentifyVersion(void) #endif } +#ifdef COMMITVERSION +static void D_AbbrevCommit (void) +{ + UINT8 i; + + for (i = 0; i < GIT_SHA_ABBREV; ++i) + { + sscanf(&comprevision[i * 2], "%2hhx", + &comprevision_abbrev_bin[i]); + } +} +#endif + static void D_ConvertVersionNumbers (void) { @@ -1438,6 +1453,10 @@ void D_SRB2Main(void) /* break the version string into version numbers, for netplay */ D_ConvertVersionNumbers(); +#ifdef COMMITVERSION + D_AbbrevCommit(); +#endif + // Print GPL notice for our console users (Linux) CONS_Printf( "\n\nSonic Robo Blast 2 Kart\n" diff --git a/src/d_netcmd.c b/src/d_netcmd.c index ebcb487c0..b16c4fe28 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -5590,10 +5590,10 @@ static void Command_ListDoomednums_f(void) */ static void Command_Version_f(void) { -#ifdef DEVELOP - CONS_Printf("SRB2Kart %s-%s (%s %s)\n", D_GetFancyBranchName(), comprevision, compdate, comptime); +#if (defined DEVELOP) || (defined COMMITVERSION) + CONS_Printf("BlanKart %s-%s (%s %s)\n", D_GetFancyBranchName(), comprevision, compdate, comptime); #else - CONS_Printf("SRB2Kart %s (%s %s %s %s) ", VERSIONSTRING, compdate, comptime, comprevision, D_GetFancyBranchName()); + CONS_Printf("BlanKart %s (%s %s %s %s) ", VERSIONSTRING, compdate, comptime, comprevision, D_GetFancyBranchName()); #endif // Base library diff --git a/src/doomdef.h b/src/doomdef.h index 44e275781..9eafbfd29 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -348,8 +348,10 @@ extern int SUBVERSION; // abbreviation. Maybe in another 20k commits, more than 8 // characters will be required! =P // P.S. 8 is also what comptime generates +#ifdef COMMITVERSION #define GIT_SHA_ABBREV (4) extern UINT8 comprevision_abbrev_bin[GIT_SHA_ABBREV]; +#endif extern boolean devparm; // development mode (-debug) @@ -544,6 +546,7 @@ extern int compuncommitted; #ifdef DEVELOP // Easily make it so that overtime works offline #define TESTOVERTIMEINFREEPLAY +#define COMMITVERSION #endif /// FINALLY some real clipping that doesn't make walls dissappear AND speeds the game up diff --git a/src/m_menu.c b/src/m_menu.c index 8d6952e84..5e8e8768c 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2921,10 +2921,8 @@ texty -= 10*vid.dupy;\ else { // Development -- show revision / branch info -#if defined(DEVELOP) - addtext(V_ALLOWLOWERCASE|V_GREENMAP|V_TRANSLUCENT, comprevision); - addtext(V_ALLOWLOWERCASE|V_YELLOWMAP|V_TRANSLUCENT, compbranch); - addtext(0, D_GetFancyBranchName()); +#if defined(DEVELOP) || defined(COMMITVERSION) + addtext(V_ALLOWLOWERCASE|V_YELLOWMAP|V_TRANSLUCENT, D_GetFancyBranchName()); V_DrawThinString(0, 0, V_ALLOWLOWERCASE|V_ORANGEMAP|V_TRANSLUCENT|V_SNAPTOTOP, va("%s", complast)); #else // Regular build addtext(V_ALLOWLOWERCASE|V_TRANSLUCENT, va("%s", VERSIONSTRING)); diff --git a/src/sdl/i_video.cpp b/src/sdl/i_video.cpp index 0a50e98e2..3b7caafa4 100644 --- a/src/sdl/i_video.cpp +++ b/src/sdl/i_video.cpp @@ -1576,7 +1576,16 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen) #endif // Create a window - window = SDL_CreateWindow("SRB2Kart " VERSIONSTRING, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, realwidth, realheight, flags); +#ifdef COMMITVERSION + { + char versionstring[256]; + sprintf(versionstring, "BlanKart Indev %s", comprevision); + + window = SDL_CreateWindow(versionstring, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, realwidth, realheight, flags); + } +#else + window = SDL_CreateWindow("BlanKart " VERSIONSTRING, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, realwidth, realheight, flags); +#endif if (window == NULL) {