public: expose commit and branch as global variables instead of functions
This commit is contained in:
parent
3532a77643
commit
69341e36a3
13 changed files with 29 additions and 52 deletions
|
@ -1761,8 +1761,8 @@ static size_t NONNULL CL_BuildMasterServerScanRequest( char *buf, size_t size, u
|
||||||
// let master know about client version
|
// let master know about client version
|
||||||
Info_SetValueForKey( info, "clver", XASH_VERSION, remaining );
|
Info_SetValueForKey( info, "clver", XASH_VERSION, remaining );
|
||||||
Info_SetValueForKey( info, "nat", nat ? "1" : "0", remaining );
|
Info_SetValueForKey( info, "nat", nat ? "1" : "0", remaining );
|
||||||
Info_SetValueForKey( info, "commit", Q_buildcommit(), remaining );
|
Info_SetValueForKey( info, "commit", g_buildcommit, remaining );
|
||||||
Info_SetValueForKey( info, "branch", Q_buildbranch(), remaining );
|
Info_SetValueForKey( info, "branch", g_buildbranch, remaining );
|
||||||
Info_SetValueForKey( info, "os", Q_buildos(), remaining );
|
Info_SetValueForKey( info, "os", Q_buildos(), remaining );
|
||||||
Info_SetValueForKey( info, "arch", Q_buildarch(), remaining );
|
Info_SetValueForKey( info, "arch", Q_buildarch(), remaining );
|
||||||
|
|
||||||
|
|
|
@ -266,7 +266,7 @@ static qboolean Touch_DumpConfig( const char *name, const char *profilename )
|
||||||
}
|
}
|
||||||
|
|
||||||
FS_Printf( f, "//=======================================================================\n");
|
FS_Printf( f, "//=======================================================================\n");
|
||||||
FS_Printf( f, "//\tGenerated by "XASH_ENGINE_NAME" (%i, %s, %s, %s-%s)\n", Q_buildnum(), Q_buildcommit(), Q_buildbranch(), Q_buildos(), Q_buildarch());
|
FS_Printf( f, "//\tGenerated by "XASH_ENGINE_NAME" (%i, %s, %s, %s-%s)\n", Q_buildnum(), g_buildcommit, g_buildbranch, Q_buildos(), Q_buildarch());
|
||||||
FS_Printf( f, "//\t\t\ttouchscreen config\n" );
|
FS_Printf( f, "//\t\t\ttouchscreen config\n" );
|
||||||
FS_Printf( f, "//=======================================================================\n" );
|
FS_Printf( f, "//=======================================================================\n" );
|
||||||
FS_Printf( f, "\ntouch_config_file \"%s\"\n", profilename );
|
FS_Printf( f, "\ntouch_config_file \"%s\"\n", profilename );
|
||||||
|
|
|
@ -1395,7 +1395,7 @@ void Host_WriteConfig( void )
|
||||||
{
|
{
|
||||||
Con_Reportf( "%s()\n", __func__ );
|
Con_Reportf( "%s()\n", __func__ );
|
||||||
FS_Printf( f, "//=======================================================================\n");
|
FS_Printf( f, "//=======================================================================\n");
|
||||||
FS_Printf( f, "//\tGenerated by "XASH_ENGINE_NAME" (%i, %s, %s, %s-%s)\n", Q_buildnum(), Q_buildcommit(), Q_buildbranch(), Q_buildos(), Q_buildarch());
|
FS_Printf( f, "//\tGenerated by "XASH_ENGINE_NAME" (%i, %s, %s, %s-%s)\n", Q_buildnum(), g_buildcommit, g_buildbranch, Q_buildos(), Q_buildarch());
|
||||||
FS_Printf( f, "//\t\tconfig.cfg - archive of cvars\n" );
|
FS_Printf( f, "//\t\tconfig.cfg - archive of cvars\n" );
|
||||||
FS_Printf( f, "//=======================================================================\n" );
|
FS_Printf( f, "//=======================================================================\n" );
|
||||||
Key_WriteBindings( f );
|
Key_WriteBindings( f );
|
||||||
|
@ -1443,7 +1443,7 @@ void GAME_EXPORT Host_WriteServerConfig( const char *name )
|
||||||
if(( f = FS_Open( newconfigfile, "w", false )) != NULL )
|
if(( f = FS_Open( newconfigfile, "w", false )) != NULL )
|
||||||
{
|
{
|
||||||
FS_Printf( f, "//=======================================================================\n" );
|
FS_Printf( f, "//=======================================================================\n" );
|
||||||
FS_Printf( f, "//\tGenerated by "XASH_ENGINE_NAME" (%i, %s, %s, %s-%s)\n", Q_buildnum(), Q_buildcommit(), Q_buildbranch(), Q_buildos(), Q_buildarch());
|
FS_Printf( f, "//\tGenerated by "XASH_ENGINE_NAME" (%i, %s, %s, %s-%s)\n", Q_buildnum(), g_buildcommit, g_buildbranch, Q_buildos(), Q_buildarch());
|
||||||
FS_Printf( f, "//\t\tgame.cfg - multiplayer server temporare config\n" );
|
FS_Printf( f, "//\t\tgame.cfg - multiplayer server temporare config\n" );
|
||||||
FS_Printf( f, "//=======================================================================\n" );
|
FS_Printf( f, "//=======================================================================\n" );
|
||||||
|
|
||||||
|
@ -1478,7 +1478,7 @@ void Host_WriteOpenGLConfig( void )
|
||||||
{
|
{
|
||||||
Con_Reportf( "%s()\n", __func__ );
|
Con_Reportf( "%s()\n", __func__ );
|
||||||
FS_Printf( f, "//=======================================================================\n" );
|
FS_Printf( f, "//=======================================================================\n" );
|
||||||
FS_Printf( f, "//\tGenerated by "XASH_ENGINE_NAME" (%i, %s, %s, %s-%s)\n", Q_buildnum(), Q_buildcommit(), Q_buildbranch(), Q_buildos(), Q_buildarch());
|
FS_Printf( f, "//\tGenerated by "XASH_ENGINE_NAME" (%i, %s, %s, %s-%s)\n", Q_buildnum(), g_buildcommit, g_buildbranch, Q_buildos(), Q_buildarch());
|
||||||
FS_Printf( f, "//\t\t%s - archive of renderer implementation cvars\n", name );
|
FS_Printf( f, "//\t\t%s - archive of renderer implementation cvars\n", name );
|
||||||
FS_Printf( f, "//=======================================================================\n" );
|
FS_Printf( f, "//=======================================================================\n" );
|
||||||
FS_Printf( f, "\n" );
|
FS_Printf( f, "\n" );
|
||||||
|
@ -1508,7 +1508,7 @@ void Host_WriteVideoConfig( void )
|
||||||
{
|
{
|
||||||
Con_Reportf( "%s()\n", __func__ );
|
Con_Reportf( "%s()\n", __func__ );
|
||||||
FS_Printf( f, "//=======================================================================\n" );
|
FS_Printf( f, "//=======================================================================\n" );
|
||||||
FS_Printf( f, "//\tGenerated by "XASH_ENGINE_NAME" (%i, %s, %s, %s-%s)\n", Q_buildnum(), Q_buildcommit(), Q_buildbranch(), Q_buildos(), Q_buildarch());
|
FS_Printf( f, "//\tGenerated by "XASH_ENGINE_NAME" (%i, %s, %s, %s-%s)\n", Q_buildnum(), g_buildcommit, g_buildbranch, Q_buildos(), Q_buildarch());
|
||||||
FS_Printf( f, "//\t\tvideo.cfg - archive of renderer variables\n");
|
FS_Printf( f, "//\t\tvideo.cfg - archive of renderer variables\n");
|
||||||
FS_Printf( f, "//=======================================================================\n" );
|
FS_Printf( f, "//=======================================================================\n" );
|
||||||
Cvar_WriteVariables( f, FCVAR_RENDERINFO );
|
Cvar_WriteVariables( f, FCVAR_RENDERINFO );
|
||||||
|
@ -1534,7 +1534,7 @@ void Key_EnumCmds_f( void )
|
||||||
if( f )
|
if( f )
|
||||||
{
|
{
|
||||||
FS_Printf( f, "//=======================================================================\n");
|
FS_Printf( f, "//=======================================================================\n");
|
||||||
FS_Printf( f, "//\tGenerated by "XASH_ENGINE_NAME" (%i, %s, %s, %s-%s)\n", Q_buildnum(), Q_buildcommit(), Q_buildbranch(), Q_buildos(), Q_buildarch());
|
FS_Printf( f, "//\tGenerated by "XASH_ENGINE_NAME" (%i, %s, %s, %s-%s)\n", Q_buildnum(), g_buildcommit, g_buildbranch, Q_buildos(), Q_buildarch());
|
||||||
FS_Printf( f, "//\t\thelp.txt - xash commands and console variables\n");
|
FS_Printf( f, "//\t\thelp.txt - xash commands and console variables\n");
|
||||||
FS_Printf( f, "//=======================================================================\n");
|
FS_Printf( f, "//=======================================================================\n");
|
||||||
|
|
||||||
|
|
|
@ -1233,7 +1233,7 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa
|
||||||
|
|
||||||
Cvar_Getf( "buildnum", FCVAR_READ_ONLY, "returns a current build number", "%i", Q_buildnum_compat());
|
Cvar_Getf( "buildnum", FCVAR_READ_ONLY, "returns a current build number", "%i", Q_buildnum_compat());
|
||||||
Cvar_Getf( "ver", FCVAR_READ_ONLY, "shows an engine version", "%i/%s (hw build %i)", PROTOCOL_VERSION, XASH_COMPAT_VERSION, Q_buildnum_compat());
|
Cvar_Getf( "ver", FCVAR_READ_ONLY, "shows an engine version", "%i/%s (hw build %i)", PROTOCOL_VERSION, XASH_COMPAT_VERSION, Q_buildnum_compat());
|
||||||
Cvar_Getf( "host_ver", FCVAR_READ_ONLY, "detailed info about this build", "%i " XASH_VERSION " %s %s %s", Q_buildnum(), Q_buildos(), Q_buildarch(), Q_buildcommit());
|
Cvar_Getf( "host_ver", FCVAR_READ_ONLY, "detailed info about this build", "%i " XASH_VERSION " %s %s %s", Q_buildnum(), Q_buildos(), Q_buildarch(), g_buildcommit);
|
||||||
Cvar_Getf( "host_lowmemorymode", FCVAR_READ_ONLY, "indicates if engine compiled for low RAM consumption (0 - normal, 1 - low engine limits, 2 - low protocol limits)", "%i", XASH_LOW_MEMORY );
|
Cvar_Getf( "host_lowmemorymode", FCVAR_READ_ONLY, "indicates if engine compiled for low RAM consumption (0 - normal, 1 - low engine limits, 2 - low protocol limits)", "%i", XASH_LOW_MEMORY );
|
||||||
|
|
||||||
Mod_Init();
|
Mod_Init();
|
||||||
|
|
|
@ -326,7 +326,7 @@ static int HTTP_FileConnect( httpfile_t *file )
|
||||||
if( !COM_CheckStringEmpty( http_useragent.string ) || !Q_strcmp( http_useragent.string, "xash3d" ))
|
if( !COM_CheckStringEmpty( http_useragent.string ) || !Q_strcmp( http_useragent.string, "xash3d" ))
|
||||||
{
|
{
|
||||||
Q_snprintf( useragent, sizeof( useragent ), "%s/%s (%s-%s; build %d; %s)",
|
Q_snprintf( useragent, sizeof( useragent ), "%s/%s (%s-%s; build %d; %s)",
|
||||||
XASH_ENGINE_NAME, XASH_VERSION, Q_buildos( ), Q_buildarch( ), Q_buildnum( ), Q_buildcommit( ));
|
XASH_ENGINE_NAME, XASH_VERSION, Q_buildos( ), Q_buildarch( ), Q_buildnum( ), g_buildcommit );
|
||||||
}
|
}
|
||||||
else Q_strncpy( useragent, http_useragent.string, sizeof( useragent ));
|
else Q_strncpy( useragent, http_useragent.string, sizeof( useragent ));
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ void Sys_InitLog( void )
|
||||||
|
|
||||||
// fit to 80 columns for easier read on standard terminal
|
// fit to 80 columns for easier read on standard terminal
|
||||||
fputs( "================================================================================\n", s_ld.logfile );
|
fputs( "================================================================================\n", s_ld.logfile );
|
||||||
fprintf( s_ld.logfile, "%s (%i, %s, %s, %s-%s)\n", s_ld.title, Q_buildnum(), Q_buildcommit(), Q_buildbranch(), Q_buildos(), Q_buildarch());
|
fprintf( s_ld.logfile, "%s (%i, %s, %s, %s-%s)\n", s_ld.title, Q_buildnum(), g_buildcommit, g_buildbranch, Q_buildos(), Q_buildarch());
|
||||||
fprintf( s_ld.logfile, "Game started at %s\n", Q_timestamp( TIME_FULL ));
|
fprintf( s_ld.logfile, "Game started at %s\n", Q_timestamp( TIME_FULL ));
|
||||||
fputs( "================================================================================\n", s_ld.logfile );
|
fputs( "================================================================================\n", s_ld.logfile );
|
||||||
fflush( s_ld.logfile );
|
fflush( s_ld.logfile );
|
||||||
|
@ -142,7 +142,7 @@ void Sys_CloseLog( const char *finalmsg )
|
||||||
|
|
||||||
fputc( '\n', s_ld.logfile );
|
fputc( '\n', s_ld.logfile );
|
||||||
fputs( "================================================================================\n", s_ld.logfile );
|
fputs( "================================================================================\n", s_ld.logfile );
|
||||||
fprintf( s_ld.logfile, "%s (%i, %s, %s, %s-%s)\n", s_ld.title, Q_buildnum(), Q_buildcommit(), Q_buildbranch(), Q_buildos(), Q_buildarch());
|
fprintf( s_ld.logfile, "%s (%i, %s, %s, %s-%s)\n", s_ld.title, Q_buildnum(), g_buildcommit, g_buildbranch, Q_buildos(), Q_buildarch());
|
||||||
fprintf( s_ld.logfile, "Stopped with reason \"%s\" at %s\n", finalmsg, Q_timestamp( TIME_FULL ));
|
fprintf( s_ld.logfile, "Stopped with reason \"%s\" at %s\n", finalmsg, Q_timestamp( TIME_FULL ));
|
||||||
fputs( "================================================================================\n", s_ld.logfile );
|
fputs( "================================================================================\n", s_ld.logfile );
|
||||||
fclose( s_ld.logfile );
|
fclose( s_ld.logfile );
|
||||||
|
|
|
@ -113,7 +113,7 @@ static void Sys_Crash( int signal, siginfo_t *si, void *context)
|
||||||
|
|
||||||
// safe actions first, stack and memory may be corrupted
|
// safe actions first, stack and memory may be corrupted
|
||||||
len = Q_snprintf( message, sizeof( message ), "Ver: " XASH_ENGINE_NAME " " XASH_VERSION " (build %i-%s, %s-%s)\n",
|
len = Q_snprintf( message, sizeof( message ), "Ver: " XASH_ENGINE_NAME " " XASH_VERSION " (build %i-%s, %s-%s)\n",
|
||||||
Q_buildnum(), Q_buildcommit(), Q_buildos(), Q_buildarch() );
|
Q_buildnum(), g_buildcommit, Q_buildos(), Q_buildarch() );
|
||||||
|
|
||||||
#if !XASH_FREEBSD && !XASH_NETBSD && !XASH_OPENBSD
|
#if !XASH_FREEBSD && !XASH_NETBSD && !XASH_OPENBSD
|
||||||
len += Q_snprintf( message + len, sizeof( message ) - len, "Crash: signal %d errno %d with code %d at %p %p\n", signal, si->si_errno, si->si_code, si->si_addr, si->si_ptr );
|
len += Q_snprintf( message + len, sizeof( message ) - len, "Crash: signal %d errno %d with code %d at %p %p\n", signal, si->si_errno, si->si_code, si->si_addr, si->si_ptr );
|
||||||
|
|
|
@ -138,7 +138,7 @@ static void Sys_StackTrace( PEXCEPTION_POINTERS pInfo )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
len = Q_snprintf( message, sizeof( message ), "Ver: " XASH_ENGINE_NAME " " XASH_VERSION " (build %i-%s, %s-%s)\n",
|
len = Q_snprintf( message, sizeof( message ), "Ver: " XASH_ENGINE_NAME " " XASH_VERSION " (build %i-%s, %s-%s)\n",
|
||||||
Q_buildnum(), Q_buildcommit(), Q_buildos(), Q_buildarch() );
|
Q_buildnum(), g_buildcommit, Q_buildos(), Q_buildarch() );
|
||||||
|
|
||||||
len += Q_snprintf( message + len, 1024 - len, "Sys_Crash: address %p, code %p\n",
|
len += Q_snprintf( message + len, 1024 - len, "Sys_Crash: address %p, code %p\n",
|
||||||
pInfo->ExceptionRecord->ExceptionAddress, (void*)pInfo->ExceptionRecord->ExceptionCode );
|
pInfo->ExceptionRecord->ExceptionAddress, (void*)pInfo->ExceptionRecord->ExceptionCode );
|
||||||
|
@ -214,7 +214,7 @@ static void Sys_GetMinidumpFileName( const char *processName, char *mdmpFileName
|
||||||
|
|
||||||
Q_snprintf( mdmpFileName, bufferSize, "%s_%s_crash_%d%.2d%.2d_%.2d%.2d%.2d.mdmp",
|
Q_snprintf( mdmpFileName, bufferSize, "%s_%s_crash_%d%.2d%.2d_%.2d%.2d%.2d.mdmp",
|
||||||
processName,
|
processName,
|
||||||
Q_buildcommit(),
|
g_buildcommit,
|
||||||
currentLocalTime->tm_year + 1900,
|
currentLocalTime->tm_year + 1900,
|
||||||
currentLocalTime->tm_mon + 1,
|
currentLocalTime->tm_mon + 1,
|
||||||
currentLocalTime->tm_mday,
|
currentLocalTime->tm_mday,
|
||||||
|
|
|
@ -2226,7 +2226,7 @@ SV_SendBuildInfo_f
|
||||||
static qboolean SV_SendBuildInfo_f( sv_client_t *cl )
|
static qboolean SV_SendBuildInfo_f( sv_client_t *cl )
|
||||||
{
|
{
|
||||||
SV_ClientPrintf( cl, "Server running " XASH_ENGINE_NAME " " XASH_VERSION " (build %i-%s, %s-%s)\n",
|
SV_ClientPrintf( cl, "Server running " XASH_ENGINE_NAME " " XASH_VERSION " (build %i-%s, %s-%s)\n",
|
||||||
Q_buildnum(), Q_buildcommit(), Q_buildos(), Q_buildarch() );
|
Q_buildnum(), g_buildcommit, Q_buildos(), Q_buildarch() );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -970,7 +970,7 @@ void SV_Init( void )
|
||||||
MSG_Init( &net_message, "NetMessage", net_message_buffer, sizeof( net_message_buffer ));
|
MSG_Init( &net_message, "NetMessage", net_message_buffer, sizeof( net_message_buffer ));
|
||||||
|
|
||||||
Q_snprintf( versionString, sizeof( versionString ), XASH_ENGINE_NAME ": " XASH_VERSION "-%s(%s-%s),%i,%i",
|
Q_snprintf( versionString, sizeof( versionString ), XASH_ENGINE_NAME ": " XASH_VERSION "-%s(%s-%s),%i,%i",
|
||||||
Q_buildcommit(), Q_buildos(), Q_buildarch(), PROTOCOL_VERSION, Q_buildnum() );
|
g_buildcommit, Q_buildos(), Q_buildarch(), PROTOCOL_VERSION, Q_buildnum() );
|
||||||
|
|
||||||
Cvar_FullSet( "sv_version", versionString, FCVAR_READ_ONLY );
|
Cvar_FullSet( "sv_version", versionString, FCVAR_READ_ONLY );
|
||||||
|
|
||||||
|
|
|
@ -529,7 +529,7 @@ static qboolean FS_WriteGameInfo( const char *filepath, gameinfo_t *GameInfo )
|
||||||
if( !f )
|
if( !f )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
FS_Printf( f, "// generated by " XASH_ENGINE_NAME " " XASH_VERSION "-%s (%s-%s)\n\n\n", Q_buildcommit(), Q_buildos(), Q_buildarch() );
|
FS_Printf( f, "// generated by " XASH_ENGINE_NAME " " XASH_VERSION "-%s (%s-%s)\n\n\n", g_buildcommit, Q_buildos(), Q_buildarch() );
|
||||||
|
|
||||||
if( COM_CheckStringEmpty( GameInfo->basedir ) )
|
if( COM_CheckStringEmpty( GameInfo->basedir ) )
|
||||||
FS_Printf( f, "basedir\t\t\"%s\"\n", GameInfo->basedir );
|
FS_Printf( f, "basedir\t\t\"%s\"\n", GameInfo->basedir );
|
||||||
|
|
|
@ -239,29 +239,6 @@ const char *Q_buildarch( void )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
const char *g_buildcommit = XASH_BUILD_COMMIT;
|
||||||
=============
|
const char *g_buildbranch = XASH_BUILD_BRANCH;
|
||||||
Q_buildcommit
|
|
||||||
|
|
||||||
Returns a short hash of current commit in VCS as string
|
|
||||||
XASH_BUILD_COMMIT must be passed in quotes
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
const char *Q_buildcommit( void )
|
|
||||||
{
|
|
||||||
return XASH_BUILD_COMMIT;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
Q_buildbranch
|
|
||||||
|
|
||||||
Returns current branch name in VCS as string
|
|
||||||
XASH_BUILD_BRANCH must be passed in quotes
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
const char *Q_buildbranch( void )
|
|
||||||
{
|
|
||||||
return XASH_BUILD_BRANCH;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -62,8 +62,8 @@ const char *Q_PlatformStringByID( const int platform );
|
||||||
const char *Q_buildos( void );
|
const char *Q_buildos( void );
|
||||||
const char *Q_ArchitectureStringByID( const int arch, const uint abi, const int endianness, const qboolean is64 );
|
const char *Q_ArchitectureStringByID( const int arch, const uint abi, const int endianness, const qboolean is64 );
|
||||||
const char *Q_buildarch( void );
|
const char *Q_buildarch( void );
|
||||||
const char *Q_buildcommit( void );
|
extern const char *g_buildcommit;
|
||||||
const char *Q_buildbranch( void );
|
extern const char *g_buildbranch;
|
||||||
|
|
||||||
//
|
//
|
||||||
// crtlib.c
|
// crtlib.c
|
||||||
|
|
Loading…
Add table
Reference in a new issue