Copy the version string obtained from svnversion at runtime instead of

using it as a constant in several places. Saves a few bytes and the time
it takes to recompile a bunch of files whenever svnversion twitches.

Using the SVN version string as an integer is not portable as the Unix
svnversion always includes e.g. the "M" suffix for a modified tree.

Windows people, please check my change to Plugin_VideoDX9/Src/main.cpp
as I don't really understand how _T() and the %hs format string work.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5852 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Soren Jorvang 2010-07-08 15:25:01 +00:00
parent 75be9ce40d
commit 39ae36398f
14 changed files with 21 additions and 51 deletions

View File

@ -888,6 +888,10 @@
RelativePath=".\Src\Timer.h"
>
</File>
<File
RelativePath=".\Src\Version.cpp"
>
</File>
<File
RelativePath=".\Src\x64Analyzer.cpp"
>

View File

@ -25,6 +25,10 @@
#include <stdio.h>
#include <string.h>
// SVN version number
extern const char *svn_rev_str;
extern const char *netplay_dolphin_ver;
// Force enable logging in the right modes. For some reason, something had changed
// so that debugfast no longer logged.
#if defined(_DEBUG) || defined(DEBUGFAST)

View File

@ -34,6 +34,7 @@ files = [
"Thunk.cpp",
"Timer.cpp",
"Thread.cpp",
"Version.cpp",
"x64Emitter.cpp",
"x64Analyzer.cpp",
"Crypto/bn.cpp",

View File

@ -1,2 +1 @@
#define SVN_REV $WCREV$
#define SVN_REV_STR "$WCMODS?$WCREV$M:$WCREV$$"

View File

@ -1,7 +0,0 @@
REV=`svnversion -n ./`
echo $REV
cat > Src/svnrev.h <<EOF
#define SVN_REV $REV
#define SVN_REV_STR "$REV"
EOF

View File

@ -17,7 +17,6 @@
#include "Common.h"
#include "AboutDolphin.h"
#include "svnrev.h"
#include "CPUDetect.h"
#include "../resources/dolphin_logo.cpp"
@ -49,7 +48,7 @@ void AboutDolphin::CreateGUIControls()
wxBitmap(iDolphinLogo), wxDefaultPosition, wxDefaultSize, 0);
std::string Text = std::string("") +
"Dolphin SVN revision " + SVN_REV_STR + "\n"
"Dolphin SVN revision " + svn_rev_str + "\n"
"Copyright (c) 2003-2010+ Dolphin Team\n"
"\n"
"Dolphin is a Gamecube/Wii emulator, which was\n"

View File

@ -17,7 +17,6 @@
#include <vector>
#include <string>
#include "svnrev.h"
#include "Common.h" // Common
@ -358,15 +357,6 @@ bool DolphinApp::OnInit()
SetEnableAlert(SConfig::GetInstance().m_LocalCoreStartupParameter.bUsePanicHandlers);
// Create the window title
#ifdef _DEBUG
const char *title = "Dolphin Debug SVN R " SVN_REV_STR;
#elif defined DEBUGFAST
const char *title = "Dolphin Debugfast SVN R " SVN_REV_STR;
#else
const char *title = "Dolphin SVN R " SVN_REV_STR;
#endif
int x = SConfig::GetInstance().m_LocalCoreStartupParameter.iPosX;
int y = SConfig::GetInstance().m_LocalCoreStartupParameter.iPosY;
int w = SConfig::GetInstance().m_LocalCoreStartupParameter.iWidth;
@ -383,8 +373,10 @@ bool DolphinApp::OnInit()
x = y = -1;
#endif
main_frame = new CFrame((wxFrame*)NULL, wxID_ANY, wxString::FromAscii(title),
wxPoint(x, y), wxSize(w, h), UseDebugger, UseLogger);
main_frame = new CFrame((wxFrame*)NULL, wxID_ANY,
wxString::FromAscii(svn_rev_str),
wxPoint(x, y), wxSize(w, h),
UseDebugger, UseLogger);
SetTopWindow(main_frame);
#if defined HAVE_X11 && HAVE_X11

View File

@ -12,7 +12,6 @@
#include <SFML/Network.hpp>
#include "GCPadStatus.h"
#include "svnrev.h"
//#include <wx/wx.h>
@ -41,20 +40,6 @@ typedef std::vector<Rpt> NetWiimote;
#define NETPLAY_VERSION "Dolphin NetPlay 2.2"
#ifdef _M_X64
#define NP_ARCH "x64"
#else
#define NP_ARCH "x86"
#endif
#ifdef _WIN32
#define NETPLAY_DOLPHIN_VER SVN_REV_STR" W"NP_ARCH
#elif __APPLE__
#define NETPLAY_DOLPHIN_VER SVN_REV_STR" M"NP_ARCH
#else
#define NETPLAY_DOLPHIN_VER SVN_REV_STR" L"NP_ARCH
#endif
// messages
#define NP_MSG_PLAYER_JOIN 0x10
#define NP_MSG_PLAYER_LEAVE 0x11

View File

@ -24,7 +24,7 @@ NetPlayClient::NetPlayClient(const std::string& address, const u16 port, const s
// send connect message
sf::Packet spac;
spac << NETPLAY_VERSION;
spac << NETPLAY_DOLPHIN_VER;
spac << netplay_dolphin_ver;
spac << name;
m_socket.Send(spac);
@ -61,7 +61,7 @@ NetPlayClient::NetPlayClient(const std::string& address, const u16 port, const s
Player player;
player.name = name;
player.pid = m_pid;
player.revision = NETPLAY_DOLPHIN_VER;
player.revision = netplay_dolphin_ver;
// add self to player list
m_players[m_pid] = player;

View File

@ -24,7 +24,7 @@ NetPlayServer::NetPlayServer(const u16 port, const std::string& name, NetPlayDia
{
Client player;
player.pid = 0;
player.revision = NETPLAY_DOLPHIN_VER;
player.revision = netplay_dolphin_ver;
player.socket = m_socket;
player.name = name;

View File

@ -27,7 +27,6 @@
#include "Thread.h"
#include "LogManager.h"
#include "svnrev.h"
#include "resource.h"
#include "main.h"
#include "VideoConfig.h"
@ -162,7 +161,7 @@ unsigned int Callback_PeekMessages()
void UpdateFPSDisplay(const char* text)
{
char temp[512];
sprintf_s(temp, 512, "SVN R%i: DX11: %s", SVN_REV, text);
sprintf_s(temp, 512, "SVN R%s: DX11: %s", svn_rev_str, text);
SetWindowTextA(EmuWindow::GetWnd(), temp);
}

View File

@ -26,14 +26,11 @@
GFXConfigDialogDX *m_ConfigFrame = NULL;
#endif // HAVE_WX
#if defined(HAVE_WX) && HAVE_WX
#include "Debugger/Debugger.h"
GFXDebuggerDX9 *m_DebuggerFrame = NULL;
#endif // HAVE_WX
#include "svnrev.h"
#include "main.h"
#include "VideoConfig.h"
#include "Fifo.h"
@ -165,8 +162,7 @@ unsigned int Callback_PeekMessages()
void UpdateFPSDisplay(const char *text)
{
TCHAR temp[512];
swprintf_s(temp, 512, _T("SVN R%i: DX9: %hs"), SVN_REV, text);
SetWindowText(EmuWindow::GetWnd(), temp);
swprintf_s(temp, 512, _T("SVN R%s: DX9: %hs"), svn_rev_str, text);
}
void GetDllInfo (PLUGIN_INFO* _PluginInfo)

View File

@ -18,7 +18,6 @@
#include "Globals.h"
#include "VideoConfig.h"
#include "IniFile.h"
#include "svnrev.h"
#include "Setup.h"
#include "Render.h"
@ -113,7 +112,7 @@ unsigned int Callback_PeekMessages()
void UpdateFPSDisplay(const char *text)
{
char temp[512];
sprintf(temp, "SVN R%s: GL: %s", SVN_REV_STR, text);
sprintf(temp, "SVN R%s: GL: %s", svn_rev_str, text);
OpenGL_SetWindowText(temp);
}

View File

@ -18,7 +18,6 @@
#include "main.h"
#include "VideoConfig.h"
#include "IniFile.h"
#include "svnrev.h"
#include "Setup.h"
//#include "Render.h"
@ -113,7 +112,7 @@ unsigned int Callback_PeekMessages()
void UpdateFPSDisplay(const char *text)
{
char temp[512];
sprintf(temp, "SVN R%s: SW: %s", SVN_REV_STR, text);
sprintf(temp, "SVN R%s: SW: %s", svn_rev_str, text);
OpenGL_SetWindowText(temp);
}
// =========================