CString DiagnosticsUtil::GetProductName()
{
- return CString(ProductInfo::getFullVersionString());
+ return ProductInfo::GetFullVersion();
}
CString DiagnosticsUtil::GetProductVer()
{
- return CString(ProductInfo::getVersion());
+ return ProductInfo::GetBuildRevision();
}
namespace
* from verstub. */
CString GenerateDebugSerial()
{
- return CString(ProductInfo::getSerial());
+ return CString();
}
}
void SetProgramGlobals( lua_State* L )
{
LUA->SetGlobal( "OPENITG", true );
- LUA->SetGlobal( "OPENITG_VERSION", ProductInfo::getVersion() );
+ LUA->SetGlobal( "OPENITG_VERSION", ProductInfo::GetVersion() );
}
REGISTER_WITH_LUA_FUNCTION( SetProgramGlobals );
m_iEndlessBreakLength ( "EndlessBreakLength", 5 ),
m_bDisableScreenSaver ( "DisableScreenSaver", true ),
m_sLanguage ( "Language", "" ), // ThemeManager will deal with this invalid language
- m_sMemoryCardProfileSubdir ( "MemoryCardProfileSubdir", ProductInfo::getName()),
+ m_sMemoryCardProfileSubdir ( "MemoryCardProfileSubdir", ProductInfo::GetName()),
m_iProductID ( "ProductID", 1 ),
m_sDefaultLocalProfileIDP1 ( "DefaultLocalProfileIDP1", "" ),
m_sDefaultLocalProfileIDP2 ( "DefaultLocalProfileIDP2", "" ),
-#if defined(WIN32)
- #include "global.h"
-#endif
#include "StdString.h"
#include "ProductInfo.h"
-CString ProductInfo::getName() {
- return CString("OpenITG");
-}
+#if HAVE_CONFIG_H
+ #include "config.h"
+#else
+/* XXX: workaround until the Windows build can pull Git versioning. */
+ #define BUILD_VERSION "beta3 DEV"
+ #define BUILD_DATE "unknown date"
+ #define BUILD_REVISION_TAG "unknown revision"
+#endif
-CString ProductInfo::getVersion() {
- return CString(OITG_VERSION);
-}
+#define VERSION_STRING( id, value ) \
+ static const CString g_s##id = CString( value ); \
+ const CString& ProductInfo::Get##id() { return g_s##id; }
-CString ProductInfo::getDate() {
- return CString(OITG_DATE);
-}
+VERSION_STRING( Name, "OpenITG" );
+VERSION_STRING( Version, BUILD_VERSION );
-CString ProductInfo::getPlatform() {
-#if defined(ITG_ARCADE)
- return CString("AC");
-#elif defined(XBOX)
- return CString("CS");
-#else
- return CString("PC");
-#endif
-}
+VERSION_STRING( BuildDate, BUILD_DATE );
+VERSION_STRING( BuildRevision, BUILD_REVISION_TAG );
-CString ProductInfo::getCrashReportUrl() {
- return CString("http://wush.net/bugzilla/terabyte/");
-}
+VERSION_STRING( CrashReportURL, "<to be determined>" );
-CString ProductInfo::getFullVersionString() {
- return getVersion() + "-" + getPlatform();
+namespace
+{
+ const CString GetPlatform()
+ {
+ #if defined(ITG_ARCADE)
+ return "AC";
+ #elif defined(XBOX)
+ return "CS";
+ #else
+ return "PC";
+ #endif
+ }
}
-CString ProductInfo::getSerial() {
- return CString("OITG-") + getVersion() + "-" + getPlatform();
-}
+VERSION_STRING( FullVersion, g_sName + " " + GetPlatform() + " " + g_sVersion );
+
+#undef VERSION_STRING
+
+/*
+ * (c) 2013 Marc Cannon
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons to
+ * whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
+ * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
+ * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
+ * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+ * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
#ifndef PRODUCT_INFO_H
#define PRODUCT_INFO_H
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#undef OFFICIAL_RELEASE
-//#define OFFICIAL_RELEASE 1
+namespace ProductInfo
+{
+ /* Binary name + release (e.g. "OpenITG", "beta3") */
+ const CString& GetName();
+ const CString& GetVersion();
-#include "StdString.h"
+ /* Binary name + build type + release (e.g. "OpenITG AC beta3") */
+ const CString& GetFullVersion();
-class ProductInfo {
+ /* Build data (e.g. "2012-12-31", "beta3-105-g63a1100") */
+ const CString& GetBuildDate();
+ const CString& GetBuildRevision();
- public:
- static CString getName();
- static CString getVersion();
- static CString getDate();
- static CString getPlatform();
- static CString getCrashReportUrl();
- static CString getFullVersionString();
- static CString getSerial();
+ /* Crash report URL */
+ const CString& GetCrashReportURL();
};
#endif
/*
- * (c) 2003-2009 Chris Danford, BoXoRRoXoRs
+ * (c) 2003-2013 Chris Danford, Marc Cannon
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
#include "CodeDetector.h"
#include "RageTextureManager.h"
#include "UnlockManager.h"
-#include "ProductInfo.h"
#include "LightsManager.h"
#include "CommonMetrics.h"
#include "Game.h"
m_textVersion.LoadFromFont( THEME->GetPathF("Common","normal") );
m_textVersion.SetName( "Version" );
/* easier debugging, plus product placement ;D */
- m_textVersion.SetText( ProductInfo::getName() );
+ m_textVersion.SetText( ProductInfo::GetFullVersion() );
this->AddChild( &m_textVersion );
SET_XY_AND_ON_COMMAND( m_textVersion );
static void WriteLogHeader()
{
- LOG->Info( ProductInfo::getFullVersionString());
- LOG->Info( "Compiled %s (build %s)", ProductInfo::getDate().c_str(), ProductInfo::getVersion().c_str() );
+ LOG->Info( ProductInfo::GetFullVersion() );
+
+ LOG->Info( "Compiled %s (build %s)",
+ ProductInfo::GetBuildDate().c_str(),
+ ProductInfo::GetBuildRevision().c_str()
+ );
time_t cur_time;
time(&cur_time);
exit(1);
}
- fprintf(CrashDump, "%s crash report", ProductInfo::getFullVersionString().c_str() );
+ fprintf(CrashDump, "%s crash report", ProductInfo::GetFullVersion().c_str() );
#if defined(HAVE_VERSION_INFO)
- fprintf(CrashDump, " (build %u)", ProductInfo::getVersion().c_str() );
+ fprintf(CrashDump, " (build %u)", ProductInfo::GetBuildRevision().c_str() );
#endif
fprintf(CrashDump, "\n");
fprintf(CrashDump, "--------------------------------------\n");
#if defined(DARWIN)
InformUserOfCrash( sCrashInfoPath );
-
+
/* Forcibly kill our parent. */
kill( getppid(), SIGKILL );
#else
if( tty == NULL )
tty = stderr;
- fprintf(tty,
- "\n"
- + ProductInfo::getName()
- + " has crashed. Debug information has been output to\n"
- "\n"
- " " + sCrashInfoPath + "\n"
- "\n"
- "Please report a bug at:\n"
- "\n"
- " " + ProductInfo::getCrashReportUrl() + "\n"
- "\n"
- );
+ fprintf(tty,
+ "\n"
+ + ProductInfo::GetName()
+ + " has crashed. Debug information has been output to\n"
+ "\n"
+ " " + sCrashInfoPath + "\n"
+ "\n"
+ "Please report a bug at:\n"
+ "\n"
+ " " + ProductInfo::GetCrashReportURL() + "\n"
+ "\n"
+ );
#endif
if( g_debugInfo.nBuildNumber != int(VersionNumber) )
{
- Report(hwnd, hFile, (CString("Incorrect %s file (build %d, expected %d) for this version of ") + ProductInfo::getName() + " -- call stack unavailable.").c_str(),
- g_debugInfo.sFilename, g_debugInfo.nBuildNumber, int(VersionNumber));
+ Report( hwnd, hFile,
+ "Incorrect %s file (build %d, expected %d) -- call stack unavailable.").c_str(),
+ g_debugInfo.sFilename,
+ g_debugInfo.nBuildNumber,
+ int(VersionNumber)
+ );
+
return false;
}
Report(NULL, hFile,
"%s crash report (build %d)\r\n"
"--------------------------------------"
- "\r\n", ProductInfo::getFullVersionString().c_str(), VersionNumber);
+ "\r\n", ProductInfo::GetFullVersion().c_str(), VersionNumber);
ReportReason( NULL, hFile, &g_CrashInfo );
Report(NULL, hFile, "");
case IDC_CRASH_SAVE:
if (!s_bHaveCallstack)
if (IDOK != MessageBox(hDlg,
- (ProductInfo::getName() + " cannot load its crash resource file, and thus the crash dump will be "
+ (ProductInfo::GetName() + " cannot load its crash resource file, and thus the crash dump will be "
"missing the most important part, the call stack. Crash dumps are much less useful "
- "without the call stack.").c_str(), (ProductInfo::getName() + " warning").c_str(), MB_OK|MB_ICONEXCLAMATION))
+ "without the call stack.").c_str(), (ProductInfo::GetName() + " warning").c_str(), MB_OK|MB_ICONEXCLAMATION))
return TRUE;
ViewWithNotepad( s_sCrashLogPath );
EndDialog( hDlg, FALSE );
break;
case IDC_BUTTON_REPORT:
- GotoURL( ProductInfo::getCrashReportUrl().c_str() );
- //GotoURL( http://sourceforge.net/tracker/?func=add&group_id=37892&atid=421366" );
+ GotoURL( ProductInfo::GetCrashReportURL().c_str() );
break;
}
break;
#include <set>
-static const CString g_sClassName = ProductInfo::getName() + " LowLevelWindow_Win32";
+static const CString g_sClassName = ProductInfo::GetName() + " LowLevelWindow_Win32";
static HWND g_hWndMain;
static HDC g_HDC;