Fix commit SHA blocking and make it more obvious this is an indev project

This commit is contained in:
NepDisk 2025-12-13 23:43:48 -05:00
parent 9324812dd0
commit 790f2d2488
7 changed files with 50 additions and 11 deletions

View file

@ -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);

View file

@ -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

View file

@ -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"

View file

@ -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

View file

@ -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

View file

@ -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));

View file

@ -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)
{