From f9949a3026a7ac965c036a2e7c12bbc9f5627a4b Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Mon, 14 Mar 2016 12:24:51 -0400 Subject: [PATCH 1/9] dropping NOVERSION, you will not build SRB2 without a SCM --- src/Makefile | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/Makefile b/src/Makefile index d4cc64a4..8520d8d5 100644 --- a/src/Makefile +++ b/src/Makefile @@ -262,9 +262,7 @@ else OBJS+=$(OBJDIR)/hw3sound.o endif -ifndef NOVERSION OPTS += -DCOMPVERSION -endif ifndef NONX86 ifndef GCC29 @@ -550,9 +548,6 @@ cleandep: $(REMOVE) comptime.h pre-build: -ifdef NOVERSION - -@touch comptime.c -else ifdef WINDOWSHELL -..\comptime.bat . else From f5b56f2a076e89a59ad6fdcdb6e4c2e26f02c3e1 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Mon, 14 Mar 2016 12:28:22 -0400 Subject: [PATCH 2/9] fixup --- src/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index 8520d8d5..701cdcfb 100644 --- a/src/Makefile +++ b/src/Makefile @@ -553,7 +553,6 @@ ifdef WINDOWSHELL else -@../comptime.sh . endif -endif clean: $(REMOVE) *~ *.flc From 2ecdd9e6f9ea891c7cead7f3331b1b626df2681b Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Thu, 14 Jan 2016 04:31:48 -0800 Subject: [PATCH 3/9] Branch and revision information in builds Also makes comptime.bat work with git if able. Development builds will now show the branch and the SHA1 hash of the revision. Also been tested to work with subversion, where it displays "Subversion r####". You know, just in case. --- comptime.bat | 28 ++++++++++++++++++++++++---- comptime.sh | 10 +++++++--- src/comptime.c | 2 ++ src/d_netcmd.c | 4 ++++ src/doomdef.h | 7 +++++-- src/m_menu.c | 9 ++++++--- src/m_misc.c | 10 ++++------ 7 files changed, 52 insertions(+), 18 deletions(-) diff --git a/comptime.bat b/comptime.bat index 23ee7ea5..b8450ff6 100644 --- a/comptime.bat +++ b/comptime.bat @@ -1,10 +1,30 @@ @ECHO OFF -set REV=Unknown +set BRA=Unknown +set REV=illegal + copy nul: /b +%1\comptime.c tmp.$$$ > nul move tmp.$$$ %1\comptime.c > nul -SET REV=illegal -FOR /F "usebackq" %%s IN (`svnversion %1`) DO @SET REV=%%s + +if exist .git goto gitrev +if exist .svn goto svnrev +goto filwri + +:gitrev +set GIT=%2 +if "%GIT%"=="" set GIT=git +FOR /F "usebackq" %%s IN (`%GIT% rev-parse --abbrev-ref HEAD`) DO @SET BRA=%%s +FOR /F "usebackq" %%s IN (`%GIT% rev-parse HEAD`) DO @SET REV=%%s +set REV=%REV:~0,8% +goto filwri + +:svnrev +set BRA=Subversion +FOR /F "usebackq" %%s IN (`svnversion .`) DO @SET REV=%%s +goto filwri + +:filwri ECHO // Do not edit! This file was autogenerated > %1\comptime.h ECHO // by the %0 batch file >> %1\comptime.h ECHO // >> %1\comptime.h -ECHO const char* comprevision = "r%REV%"; >> %1\comptime.h +ECHO const char* compbranch = "%BRA%"; >> %1\comptime.h +ECHO const char* comprevision = "%REV%"; >> %1\comptime.h diff --git a/comptime.sh b/comptime.sh index 703bb2d3..71c5f08a 100755 --- a/comptime.sh +++ b/comptime.sh @@ -5,13 +5,15 @@ if [ x"$1" != x ]; then fi versiongit() { - gitversion=`git describe` + gitbranch=`git rev-parse --abbrev-ref HEAD` + gitversion=`git rev-parse HEAD` cat < $path/comptime.h // Do not edit! This file was autogenerated -// by the $0 script with git svn +// by the $0 script with git // -const char* comprevision = "$gitversion"; +const char* compbranch = "$gitbranch"; +const char* comprevision = "${gitversion:0:8}"; EOF exit 0 } @@ -23,6 +25,7 @@ versionsvn() { // Do not edit! This file was autogenerated // by the $0 script with subversion // +const char* compbranch = "Subversion"; const char* comprevision = "r$svnrevision"; EOF exit 0 @@ -34,6 +37,7 @@ versionfake() { // Do not edit! This file was autogenerated // by the $0 script with an unknown or nonexist SCM // +const char* compbranch = "Unknown"; const char* comprevision = "illegal"; EOF } diff --git a/src/comptime.c b/src/comptime.c index a4dc5b0f..9f1fe2f7 100644 --- a/src/comptime.c +++ b/src/comptime.c @@ -9,12 +9,14 @@ #if (defined(CMAKECONFIG)) #include "config.h" +const char *compbranch = ""; // hell if I know what to do with cmake const char *comprevision = SRB2_COMP_REVISION; #elif (defined(COMPVERSION)) #include "comptime.h" #else +const char *compbranch = "Unknown"; const char *comprevision = "illegal"; #endif diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 266161c7..30208422 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3179,7 +3179,11 @@ static void Command_ListWADS_f(void) */ static void Command_Version_f(void) { +#ifdef DEVELOP + CONS_Printf("Sonic Robo Blast 2 %s-%s (%s %s)\n", compbranch, comprevision, compdate, comptime); +#else CONS_Printf("Sonic Robo Blast 2 %s (%s %s %s)\n", VERSIONSTRING, compdate, comptime, comprevision); +#endif } #ifdef UPDATE_ALERT diff --git a/src/doomdef.h b/src/doomdef.h index e4b426eb..fe7fad8a 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -141,7 +141,10 @@ extern FILE *logstream; #if 0 #define VERSION 0 // Game version #define SUBVERSION 0 // more precise version number -#define VERSIONSTRING "Trunk" +#define VERSIONSTRING "Development EXE" +#define VERSIONSTRINGW L"Development EXE" +// most interface strings are ignored in development mode. +// we use comprevision and compbranch instead. #else #define VERSION 201 // Game version #define SUBVERSION 14 // more precise version number @@ -413,7 +416,7 @@ INT32 I_GetKey(void); #endif // Compile date and time and revision. -extern const char *compdate, *comptime, *comprevision; +extern const char *compdate, *comptime, *comprevision, *compbranch; // Disabled code and code under testing // None of these that are disabled in the normal build are guaranteed to work perfectly diff --git a/src/m_menu.c b/src/m_menu.c index 1e774553..780de7ad 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2463,11 +2463,14 @@ void M_Drawer(void) V_DrawThinString(vid.dupx, vid.height - 9*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, customversionstring); } else -#if VERSION > 0 || SUBVERSION > 0 + { +#ifdef DEVELOP // Development -- show revision / branch info + V_DrawThinString(vid.dupx, vid.height - 17*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, compbranch); + V_DrawThinString(vid.dupx, vid.height - 9*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, comprevision); +#else // Regular build V_DrawThinString(vid.dupx, vid.height - 9*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, va("%s", VERSIONSTRING)); -#else // Trunk build, show revision info - V_DrawThinString(vid.dupx, vid.height - 9*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, va("%s (%s)", VERSIONSTRING, comprevision)); #endif + } } } diff --git a/src/m_misc.c b/src/m_misc.c index 21728792..22effddd 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -1800,16 +1800,14 @@ UINT8 M_HighestBit(UINT32 num) const char *GetRevisionString(void) { - INT32 vinfo; - static char rev[8] = {0}; + static char rev[9] = {0}; if (rev[0]) return rev; - vinfo = atoi(&comprevision[1]); - if (vinfo) - snprintf(rev, 7, "r%d", vinfo); + if (comprevision[0] == 'r') + strncpy(rev, comprevision, 7); else - strcpy(rev, "rNULL"); + snprintf(rev, 7, "r%s", comprevision); rev[7] = '\0'; return rev; From 7e174290d7e2ade1a3dde14a77e9ab6e6a48bec0 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Thu, 14 Jan 2016 04:36:27 -0800 Subject: [PATCH 4/9] SVN needs the revision prefixed with 'r' --- comptime.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/comptime.bat b/comptime.bat index b8450ff6..119b3bb5 100644 --- a/comptime.bat +++ b/comptime.bat @@ -20,6 +20,7 @@ goto filwri :svnrev set BRA=Subversion FOR /F "usebackq" %%s IN (`svnversion .`) DO @SET REV=%%s +set REV=r%REV% goto filwri :filwri From 2f21c24d7703732a3e9a209991240d3850300484 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Sat, 16 Jan 2016 11:35:34 -0800 Subject: [PATCH 5/9] Makefile can run comptime.bat from src\ too --- comptime.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/comptime.bat b/comptime.bat index 119b3bb5..9e127f00 100644 --- a/comptime.bat +++ b/comptime.bat @@ -6,6 +6,7 @@ copy nul: /b +%1\comptime.c tmp.$$$ > nul move tmp.$$$ %1\comptime.c > nul if exist .git goto gitrev +if exist ..\.git goto gitrev if exist .svn goto svnrev goto filwri From 873fa10fe192ffc4a545b4fa129153f13ca311c4 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Mon, 14 Mar 2016 17:47:02 -0400 Subject: [PATCH 6/9] comptime.bat: Windows 8.1 sucks --- comptime.bat | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/comptime.bat b/comptime.bat index 9e127f00..9028e288 100644 --- a/comptime.bat +++ b/comptime.bat @@ -1,4 +1,3 @@ -@ECHO OFF set BRA=Unknown set REV=illegal @@ -13,20 +12,20 @@ goto filwri :gitrev set GIT=%2 if "%GIT%"=="" set GIT=git -FOR /F "usebackq" %%s IN (`%GIT% rev-parse --abbrev-ref HEAD`) DO @SET BRA=%%s -FOR /F "usebackq" %%s IN (`%GIT% rev-parse HEAD`) DO @SET REV=%%s +for /f "usebackq" %%s in (`%GIT% rev-parse --abbrev-ref HEAD`) do @set BRA=%%s +for /f "usebackq" %%s in (`%GIT% rev-parse HEAD`) do @set REV=%%s set REV=%REV:~0,8% goto filwri :svnrev set BRA=Subversion -FOR /F "usebackq" %%s IN (`svnversion .`) DO @SET REV=%%s +for /f "usebackq" %%s in (`svnversion .`) do @set REV=%%s set REV=r%REV% goto filwri :filwri -ECHO // Do not edit! This file was autogenerated > %1\comptime.h -ECHO // by the %0 batch file >> %1\comptime.h -ECHO // >> %1\comptime.h -ECHO const char* compbranch = "%BRA%"; >> %1\comptime.h -ECHO const char* comprevision = "%REV%"; >> %1\comptime.h +echo // Do not edit! This file was autogenerated > %1\comptime.h +echo // by the %0 batch file >> %1\comptime.h +echo // >> %1\comptime.h +echo const char* compbranch = "%BRA%"; >> %1\comptime.h +echo const char* comprevision = "%REV%"; >> %1\comptime.h From bbe93a6d31d9d9f7ac1c77c60800e9c2f2f5d810 Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Mon, 14 Mar 2016 20:36:37 -0500 Subject: [PATCH 7/9] comptime.bat: Put @echo off back in --- comptime.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/comptime.bat b/comptime.bat index 9028e288..0c7ea06d 100644 --- a/comptime.bat +++ b/comptime.bat @@ -1,3 +1,4 @@ +@echo off set BRA=Unknown set REV=illegal From c4e54d52e704ae16835237b039253c3428295547 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Mon, 14 Mar 2016 21:54:53 -0400 Subject: [PATCH 8/9] comptime.bat: restore echo off --- comptime.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/comptime.bat b/comptime.bat index 9028e288..0c7ea06d 100644 --- a/comptime.bat +++ b/comptime.bat @@ -1,3 +1,4 @@ +@echo off set BRA=Unknown set REV=illegal From 5dd0e533b37e980c273901d137f17061c70ec6dd Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 15 Mar 2016 21:18:25 +0000 Subject: [PATCH 9/9] Removed unused "supdate" variable --- src/d_main.c | 2 -- src/d_main.h | 1 - 2 files changed, 3 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index a959a863..0a3fae3b 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -509,7 +509,6 @@ static void D_Display(void) // ========================================================================= tic_t rendergametic; -boolean supdate; void D_SRB2Loop(void) { @@ -600,7 +599,6 @@ void D_SRB2Loop(void) // Update display, next frame, with current state. D_Display(); - supdate = false; if (moviemode) M_SaveFrame(); diff --git a/src/d_main.h b/src/d_main.h index 800b61f5..c5ce19ef 100644 --- a/src/d_main.h +++ b/src/d_main.h @@ -17,7 +17,6 @@ #include "d_event.h" #include "w_wad.h" // for MAX_WADFILES -extern boolean supdate; extern boolean advancedemo; // make sure not to write back the config until it's been correctly loaded