From 696e1b40b58ee1ef9340ceac02059abbe63f3120 Mon Sep 17 00:00:00 2001
From: Lioncash
Date: Sat, 9 Sep 2017 15:52:35 -0400
Subject: [PATCH] Common: Move version strings to their own header
Ideally Common.h wouldn't be a header in the Common library, and instead be renamed to something else, like PlatformCompatibility.h or something, but even then, there's still some things in the header that don't really fall under that label
This moves the version strings out to their own version header that doesn't dump a bunch of other unrelated things into scope, like what Common.h was doing.
This also places them into the Common namespace, as opposed to letting them sit in the global namespace.
---
Source/Android/jni/MainAndroid.cpp | 3 ++-
Source/Core/Common/BitField.h | 1 +
Source/Core/Common/ChunkFile.h | 1 +
Source/Core/Common/Common.h | 13 ------------
Source/Core/Common/Common.vcxproj | 1 +
Source/Core/Common/Common.vcxproj.filters | 1 +
Source/Core/Common/LinearDiskCache.h | 6 ++++--
Source/Core/Common/TraversalClient.cpp | 8 ++++++-
Source/Core/Common/TraversalClient.h | 11 ++++++----
Source/Core/Common/Version.cpp | 21 ++++++++++++-------
Source/Core/Common/Version.h | 18 ++++++++++++++++
Source/Core/Core/Analytics.cpp | 10 ++++-----
Source/Core/Core/HW/SystemTimers.cpp | 3 +++
Source/Core/Core/Movie.cpp | 3 ++-
Source/Core/Core/NetPlayClient.cpp | 10 +++++----
Source/Core/Core/NetPlayServer.cpp | 6 ++++--
Source/Core/Core/State.cpp | 3 ++-
Source/Core/DolphinQt2/AboutDialog.cpp | 8 +++----
Source/Core/DolphinQt2/MainWindow.cpp | 6 +++---
Source/Core/DolphinWX/AboutDolphin.cpp | 9 ++++----
Source/Core/DolphinWX/Frame.cpp | 3 ++-
Source/Core/DolphinWX/FrameTools.cpp | 3 ++-
Source/Core/DolphinWX/Main.cpp | 3 ++-
.../ControllerInterface/evdev/evdev.cpp | 2 ++
Source/Core/UICommon/CommandLineParse.cpp | 4 ++--
Source/Core/VideoBackends/Software/SWmain.cpp | 1 +
.../VideoBackends/Vulkan/VulkanContext.cpp | 1 +
27 files changed, 101 insertions(+), 58 deletions(-)
create mode 100644 Source/Core/Common/Version.h
diff --git a/Source/Android/jni/MainAndroid.cpp b/Source/Android/jni/MainAndroid.cpp
index 37795ab131..35c81cc305 100644
--- a/Source/Android/jni/MainAndroid.cpp
+++ b/Source/Android/jni/MainAndroid.cpp
@@ -24,6 +24,7 @@
#include "Common/GL/GLInterfaceBase.h"
#include "Common/Logging/LogManager.h"
#include "Common/MsgHandler.h"
+#include "Common/Version.h"
#include "Core/Boot/Boot.h"
#include "Core/BootManager.h"
@@ -585,7 +586,7 @@ JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetPlatform(
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetVersionString(JNIEnv* env,
jobject obj)
{
- return env->NewStringUTF(scm_rev_str.c_str());
+ return env->NewStringUTF(Common::scm_rev_str.c_str());
}
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveScreenShot(JNIEnv* env,
diff --git a/Source/Core/Common/BitField.h b/Source/Core/Common/BitField.h
index 59bee7b4b5..5832fbcc3f 100644
--- a/Source/Core/Common/BitField.h
+++ b/Source/Core/Common/BitField.h
@@ -31,6 +31,7 @@
#pragma once
+#include
#include
#include
diff --git a/Source/Core/Common/ChunkFile.h b/Source/Core/Common/ChunkFile.h
index 497a6d439a..fdae41102b 100644
--- a/Source/Core/Common/ChunkFile.h
+++ b/Source/Core/Common/ChunkFile.h
@@ -15,6 +15,7 @@
#include
#include
+#include
#include
#include
#include
"));
- text.append(small + tr("Revision: ") + QString::fromUtf8(scm_rev_git_str.c_str()) +
+ text.append(small + tr("Revision: ") + QString::fromUtf8(Common::scm_rev_git_str.c_str()) +
QStringLiteral(""));
text.append(small + tr("Compiled: ") + QStringLiteral(__DATE__ " " __TIME__ ""));
diff --git a/Source/Core/DolphinQt2/MainWindow.cpp b/Source/Core/DolphinQt2/MainWindow.cpp
index abb2ac38d2..0331104e01 100644
--- a/Source/Core/DolphinQt2/MainWindow.cpp
+++ b/Source/Core/DolphinQt2/MainWindow.cpp
@@ -16,7 +16,7 @@
#include
-#include "Common/Common.h"
+#include "Common/Version.h"
#include "Core/Boot/Boot.h"
#include "Core/BootManager.h"
@@ -66,7 +66,7 @@
MainWindow::MainWindow() : QMainWindow(nullptr)
{
- setWindowTitle(QString::fromStdString(scm_rev_str));
+ setWindowTitle(QString::fromStdString(Common::scm_rev_str));
setWindowIcon(QIcon(Resources::GetMisc(Resources::LOGO_SMALL)));
setUnifiedTitleAndToolBarOnMac(true);
setAcceptDrops(true);
@@ -541,7 +541,7 @@ void MainWindow::HideRenderWidget()
m_render_widget->setParent(nullptr);
m_rendering_to_main = false;
disconnect(Host::GetInstance(), &Host::RequestTitle, this, &MainWindow::setWindowTitle);
- setWindowTitle(QString::fromStdString(scm_rev_str));
+ setWindowTitle(QString::fromStdString(Common::scm_rev_str));
}
m_render_widget->hide();
}
diff --git a/Source/Core/DolphinWX/AboutDolphin.cpp b/Source/Core/DolphinWX/AboutDolphin.cpp
index 9fb555c4a9..1e1db9cab0 100644
--- a/Source/Core/DolphinWX/AboutDolphin.cpp
+++ b/Source/Core/DolphinWX/AboutDolphin.cpp
@@ -12,7 +12,7 @@
#include
#include
-#include "Common/Common.h"
+#include "Common/Version.h"
#include "DolphinWX/AboutDolphin.h"
#include "DolphinWX/WxUtils.h"
@@ -24,12 +24,13 @@ AboutDolphin::AboutDolphin(wxWindow* parent, wxWindowID id, const wxString& titl
this, wxID_ANY, WxUtils::LoadScaledResourceBitmap("dolphin_logo", this));
const wxString DolphinText = _("Dolphin");
- const wxString RevisionText = scm_desc_str;
+ const wxString RevisionText = Common::scm_desc_str;
const wxString CopyrightText =
_("(c) 2003-2015+ Dolphin Team. \"GameCube\" and \"Wii\" are trademarks of Nintendo. Dolphin "
"is not affiliated with Nintendo in any way.");
- const wxString BranchText = wxString::Format(_("Branch: %s"), scm_branch_str.c_str());
- const wxString BranchRevText = wxString::Format(_("Revision: %s"), scm_rev_git_str.c_str());
+ const wxString BranchText = wxString::Format(_("Branch: %s"), Common::scm_branch_str.c_str());
+ const wxString BranchRevText =
+ wxString::Format(_("Revision: %s"), Common::scm_rev_git_str.c_str());
const wxString CheckUpdateText = _("Check for updates: ");
const wxString Text =
_("\n"
diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp
index 4f350f3978..7800907a37 100644
--- a/Source/Core/DolphinWX/Frame.cpp
+++ b/Source/Core/DolphinWX/Frame.cpp
@@ -42,6 +42,7 @@
#include "Common/Logging/ConsoleListener.h"
#include "Common/StringUtil.h"
#include "Common/Thread.h"
+#include "Common/Version.h"
#include "Core/Config/GraphicsSettings.h"
#include "Core/ConfigManager.h"
@@ -758,7 +759,7 @@ void CFrame::UninhibitScreensaver()
void CFrame::UpdateTitle(const wxString& str)
{
- const wxString revision_string = StrToWxStr(scm_rev_str);
+ const wxString revision_string = StrToWxStr(Common::scm_rev_str);
if (SConfig::GetInstance().bRenderToMain && SConfig::GetInstance().m_InterfaceStatusbar)
{
GetStatusBar()->SetStatusText(str, 0);
diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp
index b2d8622ac9..d505ce14d3 100644
--- a/Source/Core/DolphinWX/FrameTools.cpp
+++ b/Source/Core/DolphinWX/FrameTools.cpp
@@ -31,6 +31,7 @@
#include "Common/FileUtil.h"
#include "Common/NandPaths.h"
#include "Common/StringUtil.h"
+#include "Common/Version.h"
#include "Core/Boot/Boot.h"
#include "Core/BootManager.h"
@@ -916,7 +917,7 @@ void CFrame::OnStopped()
UninhibitScreensaver();
- m_render_frame->SetTitle(StrToWxStr(scm_rev_str));
+ m_render_frame->SetTitle(StrToWxStr(Common::scm_rev_str));
// Destroy the renderer frame when not rendering to main
m_render_parent->Unbind(wxEVT_SIZE, &CFrame::OnRenderParentResize, this);
diff --git a/Source/Core/DolphinWX/Main.cpp b/Source/Core/DolphinWX/Main.cpp
index 7df2d3ef71..bff1c34adb 100644
--- a/Source/Core/DolphinWX/Main.cpp
+++ b/Source/Core/DolphinWX/Main.cpp
@@ -31,6 +31,7 @@
#include "Common/Logging/LogManager.h"
#include "Common/MsgHandler.h"
#include "Common/Thread.h"
+#include "Common/Version.h"
#include "Core/Analytics.h"
#include "Core/ConfigManager.h"
@@ -151,7 +152,7 @@ bool DolphinApp::OnInit()
// event dispatch including WM_MOVE/WM_SIZE)
wxRect window_geometry(SConfig::GetInstance().iPosX, SConfig::GetInstance().iPosY,
SConfig::GetInstance().iWidth, SConfig::GetInstance().iHeight);
- main_frame = new CFrame(nullptr, wxID_ANY, StrToWxStr(scm_rev_str), window_geometry,
+ main_frame = new CFrame(nullptr, wxID_ANY, StrToWxStr(Common::scm_rev_str), window_geometry,
m_use_debugger, m_batch_mode, m_use_logger);
SetTopWindow(main_frame);
diff --git a/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp b/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp
index bb29e216cd..6d9b7c1091 100644
--- a/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp
@@ -2,10 +2,12 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
+#include
#include
#include
#include