diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d53304936..9436154bb 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -483,12 +483,12 @@ if( BACKPATCH )
add_definitions( -DBACKPATCH )
endif( BACKPATCH )
-# Update svnrevision.h
+# Update gitinfo.h
get_target_property( UPDATEREVISION_EXE updaterevision LOCATION )
add_custom_target( revision_check ALL
- COMMAND ${UPDATEREVISION_EXE} . src/svnrevision.h
+ COMMAND ${UPDATEREVISION_EXE} . src/gitinfo.h
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
DEPENDS updaterevision )
diff --git a/src/c_cmds.cpp b/src/c_cmds.cpp
index 87f63ead4..c3ffe0a5f 100644
--- a/src/c_cmds.cpp
+++ b/src/c_cmds.cpp
@@ -395,7 +395,7 @@ CCMD (take)
CCMD (gameversion)
{
- Printf ("%s : " __DATE__ "\n", DOTVERSIONSTR);
+ Printf ("%s @ %s\nCommit %s", GetVersionString(), GetGitTime(), GetGitHash());
}
CCMD (print)
diff --git a/src/c_console.cpp b/src/c_console.cpp
index 3f4ae9e5f..170cc97d4 100644
--- a/src/c_console.cpp
+++ b/src/c_console.cpp
@@ -1167,9 +1167,9 @@ void C_DrawConsole (bool hw2d)
if (ConBottom >= 12)
{
screen->DrawText (ConFont, CR_ORANGE, SCREENWIDTH - 8 -
- ConFont->StringWidth ("v" DOTVERSIONSTR),
+ ConFont->StringWidth (GetVersionString()),
ConBottom - ConFont->GetHeight() - 4,
- "v" DOTVERSIONSTR, TAG_DONE);
+ GetVersionString(), TAG_DONE);
if (TickerMax)
{
char tickstr[256];
diff --git a/src/g_game.cpp b/src/g_game.cpp
index 356bd5967..3305fb0b4 100644
--- a/src/g_game.cpp
+++ b/src/g_game.cpp
@@ -2058,6 +2058,8 @@ static void PutSavePic (FILE *file, int width, int height)
void G_DoSaveGame (bool okForQuicksave, FString filename, const char *description)
{
+ char buf[100];
+
// Do not even try, if we're not in a level. (Can happen after
// a demo finishes playback.)
if (lines == NULL || sectors == NULL)
@@ -2084,7 +2086,8 @@ void G_DoSaveGame (bool okForQuicksave, FString filename, const char *descriptio
SaveVersion = SAVEVER;
PutSavePic (stdfile, SAVEPICWIDTH, SAVEPICHEIGHT);
- M_AppendPNGText (stdfile, "Software", "ZDoom " DOTVERSIONSTR);
+ mysnprintf(buf, countof(buf), GAMENAME " %s", GetVersionString());
+ M_AppendPNGText (stdfile, "Software", buf);
M_AppendPNGText (stdfile, "Engine", GAMESIG);
M_AppendPNGText (stdfile, "ZDoom Save Version", SAVESIG);
M_AppendPNGText (stdfile, "Title", description);
diff --git a/src/gameconfigfile.cpp b/src/gameconfigfile.cpp
index 2b97bf4bd..5c6fb0ce2 100644
--- a/src/gameconfigfile.cpp
+++ b/src/gameconfigfile.cpp
@@ -225,7 +225,7 @@ FGameConfigFile::~FGameConfigFile ()
void FGameConfigFile::WriteCommentHeader (FILE *file) const
{
- fprintf (file, "# This file was generated by " GAMENAME " " DOTVERSIONSTR " on %s\n", myasctime());
+ fprintf (file, "# This file was generated by " GAMENAME " %s on %s\n", GetVersionString(), myasctime());
}
void FGameConfigFile::MigrateStub (const char *pathname, FConfigFile *config, void *userdata)
diff --git a/src/gitinfo.cpp b/src/gitinfo.cpp
new file mode 100644
index 000000000..4ef00dcf5
--- /dev/null
+++ b/src/gitinfo.cpp
@@ -0,0 +1,65 @@
+/*
+** gitinfo.cpp
+** Returns strings from gitinfo.h.
+**
+**---------------------------------------------------------------------------
+** Copyright 2013 Randy Heit
+** All rights reserved.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+**
+** 1. Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** 2. Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in the
+** documentation and/or other materials provided with the distribution.
+** 3. The name of the author may not be used to endorse or promote products
+** derived from this software without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**---------------------------------------------------------------------------
+**
+** This file is just here so that when gitinfo.h changes, only one source
+** file needs to be recompiled.
+*/
+
+#include "gitinfo.h"
+#include "version.h"
+
+const char *GetGitDescription()
+{
+ return GIT_DESCRIPTION;
+}
+
+const char *GetGitHash()
+{
+ return GIT_HASH;
+}
+
+const char *GetGitTime()
+{
+ return GIT_TIME;
+}
+
+const char *GetVersionString()
+{
+ if (GetGitDescription()[0] == '\0')
+ {
+ return VERSIONSTR;
+ }
+ else
+ {
+ return GIT_DESCRIPTION;
+ }
+}
diff --git a/src/m_misc.cpp b/src/m_misc.cpp
index f552d4880..a8c6b7380 100644
--- a/src/m_misc.cpp
+++ b/src/m_misc.cpp
@@ -632,8 +632,10 @@ void WritePCXfile (FILE *file, const BYTE *buffer, const PalEntry *palette,
void WritePNGfile (FILE *file, const BYTE *buffer, const PalEntry *palette,
ESSType color_type, int width, int height, int pitch)
{
+ char software[100];
+ mysnprintf(software, countof(software), GAMENAME " %s", GetVersionString());
if (!M_CreatePNG (file, buffer, palette, color_type, width, height, pitch) ||
- !M_AppendPNGText (file, "Software", GAMENAME DOTVERSIONSTR) ||
+ !M_AppendPNGText (file, "Software", software) ||
!M_FinishPNG (file))
{
Printf ("Could not create screenshot.\n");
diff --git a/src/sdl/i_main.cpp b/src/sdl/i_main.cpp
index 36cf49617..48395cea7 100644
--- a/src/sdl/i_main.cpp
+++ b/src/sdl/i_main.cpp
@@ -150,7 +150,7 @@ static int DoomSpecificInfo (char *buffer, char *end)
int i, p;
p = 0;
- p += snprintf (buffer+p, size-p, GAMENAME" version " DOTVERSIONSTR " (" __DATE__ ")\n");
+ p += snprintf (buffer+p, size-p, GAMENAME" version %s (%s)\n", GetVersionString(), GetGitHash());
#ifdef __VERSION__
p += snprintf (buffer+p, size-p, "Compiler version: %s\n", __VERSION__);
#endif
@@ -248,8 +248,8 @@ int main (int argc, char **argv)
}
#endif // !__APPLE__
- printf(GAMENAME" v%s - SVN revision %s - SDL version\nCompiled on %s\n",
- DOTVERSIONSTR_NOREV,SVN_REVISION_STRING,__DATE__);
+ printf(GAMENAME" %s - %s - SDL version\nCompiled on %s\n",
+ GetVersionString(), GetGitTime(), __DATE__);
seteuid (getuid ());
std::set_new_handler (NewFailure);
@@ -284,7 +284,9 @@ int main (int argc, char **argv)
printf("\n");
}
- SDL_WM_SetCaption (GAMESIG " " DOTVERSIONSTR " (" __DATE__ ")", NULL);
+ char caption[100];
+ mysnprintf(caption, countof(caption), GAMESIG " %s (%s)", GetVersionString(), GetGitTime());
+ SDL_WM_SetCaption(caption);
#ifdef __APPLE__
diff --git a/src/sdl/i_system.cpp b/src/sdl/i_system.cpp
index afabd0d21..cea3cb1c3 100644
--- a/src/sdl/i_system.cpp
+++ b/src/sdl/i_system.cpp
@@ -483,10 +483,12 @@ int I_PickIWad_Gtk (WadStuff *wads, int numwads, bool showwin, int defaultiwad)
GtkTreeIter iter, defiter;
int close_style = 0;
int i;
+ char caption[100];
// Create the dialog window.
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title (GTK_WINDOW(window), GAMESIG " " DOTVERSIONSTR ": Select an IWAD to use");
+ mysnprintf(caption, countof(caption), GAMESIG " %s: Select an IWAD to use", GetVersionString());
+ gtk_window_set_title (GTK_WINDOW(window), caption);
gtk_window_set_position (GTK_WINDOW(window), GTK_WIN_POS_CENTER);
gtk_container_set_border_width (GTK_CONTAINER(window), 10);
g_signal_connect (window, "delete_event", G_CALLBACK(gtk_main_quit), NULL);
@@ -614,7 +616,8 @@ int I_PickIWad (WadStuff *wads, int numwads, bool showwin, int defaultiwad)
const char *str;
if((str=getenv("KDE_FULL_SESSION")) && strcmp(str, "true") == 0)
{
- FString cmd("kdialog --title \""GAMESIG" "DOTVERSIONSTR": Select an IWAD to use\""
+ FString cmd("kdialog --title \""GAMESIG" ");
+ cmd << GetVersionString() << ": Select an IWAD to use\""
" --menu \"ZDoom found more than one IWAD\n"
"Select from the list below to determine which one to use:\"");
diff --git a/src/version.h b/src/version.h
index 4e310abb7..6ac3cfcac 100644
--- a/src/version.h
+++ b/src/version.h
@@ -34,21 +34,18 @@
#ifndef __VERSION_H__
#define __VERSION_H__
-// The svnrevision.h is automatically updated to grab the revision of
-// of the current source tree so that it can be included with version numbers.
-#include "svnrevision.h"
+const char *GetGitDescription();
+const char *GetGitHash();
+const char *GetGitTime();
+const char *GetVersionString();
/** Lots of different version numbers **/
-#define DOTVERSIONSTR_NOREV "2.7.0"
-
-// The version string the user actually sees.
-#define DOTVERSIONSTR DOTVERSIONSTR_NOREV " (r" SVN_REVISION_STRING ")"
+#define VERSIONSTR "2.7.0"
// The version as seen in the Windows resource
-#define RC_FILEVERSION 2,7,0,SVN_REVISION_NUMBER
+#define RC_FILEVERSION 2,7,0,0
#define RC_PRODUCTVERSION 2,7,0,0
-#define RC_FILEVERSION2 DOTVERSIONSTR
#define RC_PRODUCTVERSION2 "2.7"
// Version identifier for network games.
@@ -75,36 +72,15 @@
// SAVESIG should match SAVEVER.
// MINSAVEVER is the minimum level snapshot version that can be loaded.
-#define MINSAVEVER 3100
+#define MINSAVEVER 3100
-#if SVN_REVISION_NUMBER < MINSAVEVER
-// If we don't know the current revision write something very high to ensure that
-// the reesulting executable can read its own savegames but no regular engine can.
-#define SAVEVER 999999
-#define SAVESIG MakeSaveSig()
-static inline const char *MakeSaveSig()
-{
- static char foo[] = { 'Z','D','O','O','M','S','A','V','E',
-#if SAVEVER > 99999
- '0' + (SAVEVER / 100000),
-#endif
-#if SAVEVER > 9999
- '0' + ((SAVEVER / 10000) % 10),
-#endif
-#if SAVEVER > 999
- '0' + ((SAVEVER / 1000) % 10),
-#endif
- '0' + ((SAVEVER / 100) % 10),
- '0' + ((SAVEVER / 10) % 10),
- '0' + (SAVEVER % 10),
- '\0'
- };
- return foo;
-}
-#else
-#define SAVEVER SVN_REVISION_NUMBER
-#define SAVESIG "ZDOOMSAVE"SVN_REVISION_STRING
-#endif
+// Use 4500 as the base git save version, since it's higher than the
+// SVN revision ever got.
+#define SAVEVER 4500
+
+#define SAVEVERSTRINGIFY2(x) str(x)
+#define SAVEVERSTRINGIFY(x) #x
+#define SAVESIG "ZDOOMSAVE" SAVEVERSTRINGIFY(SAVEVER)
// This is so that derivates can use the same savegame versions without worrying about engine compatibility
#define GAMESIG "ZDOOM"
diff --git a/src/win32/i_crash.cpp b/src/win32/i_crash.cpp
index de084f623..d629bacc9 100644
--- a/src/win32/i_crash.cpp
+++ b/src/win32/i_crash.cpp
@@ -128,7 +128,7 @@ RtlVirtualUnwind (
// If you are working on your own modified version of ZDoom, change
// the last part of the UPLOAD_AGENT (between parentheses) to your
// own program's name. e.g. (Skulltag) or (ZDaemon) or (ZDoomFu)
-#define UPLOAD_AGENT "ZDoom/" DOTVERSIONSTR " (" GAMESIG ")"
+#define UPLOAD_AGENT "ZDoom/" VERSIONSTR " (" GAMESIG ")"
// Time, in milliseconds, to wait for a send() or recv() to complete.
#define TIMEOUT 60000
diff --git a/src/win32/i_main.cpp b/src/win32/i_main.cpp
index a11233e29..472080423 100644
--- a/src/win32/i_main.cpp
+++ b/src/win32/i_main.cpp
@@ -95,8 +95,6 @@
#define X64 ""
#endif
-#define WINDOW_TITLE GAMESIG " " DOTVERSIONSTR X64 " (" __DATE__ ")"
-
// The maximum number of functions that can be registered with atterm.
#define MAX_TERMS 64
@@ -714,7 +712,9 @@ void ShowErrorPane(const char *text)
}
if (text != NULL)
{
- SetWindowText (Window, "Fatal Error - " WINDOW_TITLE);
+ char caption[100];
+ mysnprintf(caption, countof(caption), "Fatal Error - "GAMESIG" %s "X64" (%s)", GetVersionString(), GetGitTime());
+ SetWindowText (Window, caption);
ErrorIcon = CreateWindowEx (WS_EX_NOPARENTNOTIFY, "STATIC", NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | SS_OWNERDRAW, 0, 0, 0, 0, Window, NULL, g_hInst, NULL);
if (ErrorIcon != NULL)
{
@@ -945,10 +945,12 @@ void DoMain (HINSTANCE hInstance)
I_FatalError ("Could not register window class");
/* create window */
+ char caption[100];
+ mysnprintf(caption, countof(caption), ""GAMESIG" %s "X64" (%s)", GetVersionString(), GetGitTime());
Window = CreateWindowEx(
WS_EX_APPWINDOW,
(LPCTSTR)WinClassName,
- (LPCTSTR)WINDOW_TITLE,
+ (LPCTSTR)caption,
WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPCHILDREN,
x, y, width, height,
(HWND) NULL,
@@ -1045,7 +1047,7 @@ void DoomSpecificInfo (char *buffer, size_t bufflen)
char *const buffend = buffer + bufflen - 2; // -2 for CRLF at end
int i;
- buffer += mysnprintf (buffer, buffend - buffer, "ZDoom version " DOTVERSIONSTR " (" __DATE__ ")\r\n");
+ buffer += mysnprintf (buffer, buffend - buffer, GAMENAME " version %s (%s)", GetVersionString(), GetGitHash());
buffer += mysnprintf (buffer, buffend - buffer, "\r\nCommand line: %s\r\n", GetCommandLine());
for (i = 0; (arg = Wads.GetWadName (i)) != NULL; ++i)
diff --git a/src/win32/i_system.cpp b/src/win32/i_system.cpp
index e28ce07a7..b5843ec7a 100644
--- a/src/win32/i_system.cpp
+++ b/src/win32/i_system.cpp
@@ -1095,7 +1095,7 @@ BOOL CALLBACK IWADBoxCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa
FString newlabel;
GetWindowText(hDlg, label, countof(label));
- newlabel.Format(GAMESIG " " DOTVERSIONSTR_NOREV ": %s", label);
+ newlabel.Format(GAMESIG " %s: %s", GetVersionString(), label);
SetWindowText(hDlg, newlabel.GetChars());
}
// Populate the list with all the IWADs found
diff --git a/src/win32/zdoom.rc b/src/win32/zdoom.rc
index 7dd80380f..e28277e3a 100644
--- a/src/win32/zdoom.rc
+++ b/src/win32/zdoom.rc
@@ -8,7 +8,8 @@
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
-#include "../version.h"
+#include "../version.h"
+#include "../gitinfo.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
@@ -36,7 +37,8 @@ END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
- "#include ""../version.h""\r\0"
+ "#include ""../version.h""\r\r\n"
+ "#include ""../gitinfo.h""\r\0"
END
3 TEXTINCLUDE
@@ -49,6 +51,7 @@ BEGIN
"//\r\n"
"// Version\r\n"
"//\r\n"
+ "#define RC_FILEVERSION2 GIT_DESCRIPTION\r\n"
"\r\n"
"VS_VERSION_INFO VERSIONINFO\r\n"
" FILEVERSION RC_FILEVERSION\r\n"
@@ -72,8 +75,8 @@ BEGIN
" VALUE ""FileDescription"", ""ZDoom""\r\n"
" VALUE ""FileVersion"", RC_FILEVERSION2\r\n"
" VALUE ""InternalName"", ""ZDoom""\r\n"
- " VALUE ""LegalCopyright"", ""Copyright \u00A9 1993-1996 id Software, 1998-2010 Randy Heit, 2002-2010 Christoph Oelckers, et al.""\r\n"
- " VALUE ""LegalTrademarks"", ""Doom® is a Registered Trademark of id Software, Inc.""\r\n"
+ " VALUE ""LegalCopyright"", ""Copyright \\u00A9 1993-1996 id Software, 1998-2010 Randy Heit, 2002-2010 Christoph Oelckers, et al.""\r\n"
+ " VALUE ""LegalTrademarks"", ""DoomR is a Registered Trademark of id Software, Inc.""\r\n"
" VALUE ""OriginalFilename"", ""zdoom.exe""\r\n"
" VALUE ""ProductName"", ""ZDoom""\r\n"
" VALUE ""ProductVersion"", RC_PRODUCTVERSION2\r\n"
@@ -83,7 +86,7 @@ BEGIN
" BEGIN\r\n"
" VALUE ""Translation"", 0x409, 1200\r\n"
" END\r\n"
- "END\0"
+ "EN\0"
END
#endif // APSTUDIO_INVOKED
@@ -468,6 +471,7 @@ IDB_DEADGUY BITMAP "deadguy.bmp"
//
// Version
//
+#define RC_FILEVERSION2 GIT_DESCRIPTION
VS_VERSION_INFO VERSIONINFO
FILEVERSION RC_FILEVERSION
@@ -491,8 +495,8 @@ BEGIN
VALUE "FileDescription", "ZDoom"
VALUE "FileVersion", RC_FILEVERSION2
VALUE "InternalName", "ZDoom"
- VALUE "LegalCopyright", "Copyright © 1993-1996 id Software, 1998-2013 Randy Heit, Christoph Oelckers, Braden Obrzut, et al."
- VALUE "LegalTrademarks", "Doom® is a Registered Trademark of id Software, Inc."
+ VALUE "LegalCopyright", "Copyright \u00A9 1993-1996 id Software, 1998-2010 Randy Heit, 2002-2010 Christoph Oelckers, et al."
+ VALUE "LegalTrademarks", "DoomR is a Registered Trademark of id Software, Inc."
VALUE "OriginalFilename", "zdoom.exe"
VALUE "ProductName", "ZDoom"
VALUE "ProductVersion", RC_PRODUCTVERSION2
diff --git a/zdoom.vcproj b/zdoom.vcproj
index 43efc9bd5..d8d7a2535 100644
--- a/zdoom.vcproj
+++ b/zdoom.vcproj
@@ -28,8 +28,8 @@
>
+
+
@@ -2417,6 +2423,10 @@
+
+