aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2016-07-17 17:24:53 +0200
committerShauren <shauren.trinity@gmail.com>2016-07-17 17:24:53 +0200
commita8c412a06378df814307e4e166d4c7c44ad5a46f (patch)
tree0a840c5af245a11be91d5632aad858a7c90fe15f /src
parentf27e1eea4a443738b2e4d5baed553320e9b6b102 (diff)
Tools: Added universal TrinityCore banner with git version info to all tools
Diffstat (limited to 'src')
-rw-r--r--src/common/Banner.cpp38
-rw-r--r--src/common/Banner.h29
-rw-r--r--src/server/bnetserver/Main.cpp18
-rw-r--r--src/server/worldserver/Main.cpp27
-rw-r--r--src/tools/connection_patcher/Program.cpp5
-rw-r--r--src/tools/map_extractor/System.cpp4
-rw-r--r--src/tools/mmaps_generator/PathGenerator.cpp3
-rw-r--r--src/tools/vmap4_assembler/VMapAssembler.cpp3
-rw-r--r--src/tools/vmap4_extractor/vmapexport.cpp4
9 files changed, 108 insertions, 23 deletions
diff --git a/src/common/Banner.cpp b/src/common/Banner.cpp
new file mode 100644
index 00000000000..a9ba530baa9
--- /dev/null
+++ b/src/common/Banner.cpp
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "Banner.h"
+#include "GitRevision.h"
+#include "StringFormat.h"
+
+void Trinity::Banner::Show(char const* applicationName, void(*log)(char const* text), void(*logExtraInfo)())
+{
+ log(Trinity::StringFormat("%s (%s)", GitRevision::GetFullVersion(), applicationName).c_str());
+ log("<Ctrl-C> to stop.\n");
+ log(" ______ __");
+ log("/\\__ _\\ __ __/\\ \\__");
+ log("\\/_/\\ \\/ _ __ /\\_\\ ___ /\\_\\ \\, _\\ __ __");
+ log(" \\ \\ \\/\\`'__\\/\\ \\ /' _ `\\/\\ \\ \\ \\/ /\\ \\/\\ \\");
+ log(" \\ \\ \\ \\ \\/ \\ \\ \\/\\ \\/\\ \\ \\ \\ \\ \\_\\ \\ \\_\\ \\");
+ log(" \\ \\_\\ \\_\\ \\ \\_\\ \\_\\ \\_\\ \\_\\ \\__\\\\/`____ \\");
+ log(" \\/_/\\/_/ \\/_/\\/_/\\/_/\\/_/\\/__/ `/___/> \\");
+ log(" C O R E /\\___/");
+ log("http://TrinityCore.org \\/__/\n");
+
+ if (logExtraInfo)
+ logExtraInfo();
+}
diff --git a/src/common/Banner.h b/src/common/Banner.h
new file mode 100644
index 00000000000..a5d6eee646d
--- /dev/null
+++ b/src/common/Banner.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TrinityCore_Banner_h__
+#define TrinityCore_Banner_h__
+
+namespace Trinity
+{
+ namespace Banner
+ {
+ void Show(char const* applicationName, void(*log)(char const* text), void(*logExtraInfo)());
+ }
+}
+
+#endif // TrinityCore_Banner_h__
diff --git a/src/server/bnetserver/Main.cpp b/src/server/bnetserver/Main.cpp
index e2397981818..b54249f9412 100644
--- a/src/server/bnetserver/Main.cpp
+++ b/src/server/bnetserver/Main.cpp
@@ -28,6 +28,7 @@
#include "ProcessPriority.h"
#include "RealmList.h"
#include "GitRevision.h"
+#include "Banner.h"
#include "SslContext.h"
#include "DatabaseLoader.h"
#include "LoginRESTService.h"
@@ -108,11 +109,18 @@ int main(int argc, char** argv)
sLog->RegisterAppender<AppenderDB>();
sLog->Initialize(nullptr);
- TC_LOG_INFO("server.bnetserver", "%s (bnetserver)", GitRevision::GetFullVersion());
- TC_LOG_INFO("server.bnetserver", "<Ctrl-C> to stop.\n");
- TC_LOG_INFO("server.bnetserver", "Using configuration file %s.", sConfigMgr->GetFilename().c_str());
- TC_LOG_INFO("server.bnetserver", "Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
- TC_LOG_INFO("server.bnetserver", "Using Boost version: %i.%i.%i", BOOST_VERSION / 100000, BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100);
+ Trinity::Banner::Show("bnetserver",
+ [](char const* text)
+ {
+ TC_LOG_INFO("server.bnetserver", "%s", text);
+ },
+ []()
+ {
+ TC_LOG_INFO("server.bnetserver", "Using configuration file %s.", sConfigMgr->GetFilename().c_str());
+ TC_LOG_INFO("server.bnetserver", "Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
+ TC_LOG_INFO("server.bnetserver", "Using Boost version: %i.%i.%i", BOOST_VERSION / 100000, BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100);
+ }
+ );
// Seed the OpenSSL's PRNG here.
// That way it won't auto-seed when calling BigNumber::SetRand and slow down the first world login
diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp
index 2d14e3301a3..68c48853bad 100644
--- a/src/server/worldserver/Main.cpp
+++ b/src/server/worldserver/Main.cpp
@@ -39,6 +39,7 @@
#include "BattlegroundMgr.h"
#include "TCSoap.h"
#include "CliRunnable.h"
+#include "Banner.h"
#include "GitRevision.h"
#include "WorldSocket.h"
#include "WorldSocketMgr.h"
@@ -132,20 +133,18 @@ extern int main(int argc, char** argv)
// If logs are supposed to be handled async then we need to pass the io_service into the Log singleton
sLog->Initialize(sConfigMgr->GetBoolDefault("Log.Async.Enable", false) ? &_ioService : nullptr);
- TC_LOG_INFO("server.worldserver", "%s (worldserver-daemon)", GitRevision::GetFullVersion());
- TC_LOG_INFO("server.worldserver", "<Ctrl-C> to stop.\n");
- TC_LOG_INFO("server.worldserver", " ______ __");
- TC_LOG_INFO("server.worldserver", "/\\__ _\\ __ __/\\ \\__");
- TC_LOG_INFO("server.worldserver", "\\/_/\\ \\/ _ __ /\\_\\ ___ /\\_\\ \\, _\\ __ __");
- TC_LOG_INFO("server.worldserver", " \\ \\ \\/\\`'__\\/\\ \\ /' _ `\\/\\ \\ \\ \\/ /\\ \\/\\ \\");
- TC_LOG_INFO("server.worldserver", " \\ \\ \\ \\ \\/ \\ \\ \\/\\ \\/\\ \\ \\ \\ \\ \\_\\ \\ \\_\\ \\");
- TC_LOG_INFO("server.worldserver", " \\ \\_\\ \\_\\ \\ \\_\\ \\_\\ \\_\\ \\_\\ \\__\\\\/`____ \\");
- TC_LOG_INFO("server.worldserver", " \\/_/\\/_/ \\/_/\\/_/\\/_/\\/_/\\/__/ `/___/> \\");
- TC_LOG_INFO("server.worldserver", " C O R E /\\___/");
- TC_LOG_INFO("server.worldserver", "http://TrinityCore.org \\/__/\n");
- TC_LOG_INFO("server.worldserver", "Using configuration file %s.", sConfigMgr->GetFilename().c_str());
- TC_LOG_INFO("server.worldserver", "Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
- TC_LOG_INFO("server.worldserver", "Using Boost version: %i.%i.%i", BOOST_VERSION / 100000, BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100);
+ Trinity::Banner::Show("worldserver-daemon",
+ [](char const* text)
+ {
+ TC_LOG_INFO("server.worldserver", "%s", text);
+ },
+ []()
+ {
+ TC_LOG_INFO("server.worldserver", "Using configuration file %s.", sConfigMgr->GetFilename().c_str());
+ TC_LOG_INFO("server.worldserver", "Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
+ TC_LOG_INFO("server.worldserver", "Using Boost version: %i.%i.%i", BOOST_VERSION / 100000, BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100);
+ }
+ );
OpenSSLCrypto::threadsSetup();
diff --git a/src/tools/connection_patcher/Program.cpp b/src/tools/connection_patcher/Program.cpp
index 0f2a829d71b..354cfa17191 100644
--- a/src/tools/connection_patcher/Program.cpp
+++ b/src/tools/connection_patcher/Program.cpp
@@ -25,7 +25,8 @@
#include "Patterns/Mac.hpp"
#include "Patterns/Windows.hpp"
-#include <CompilerDefs.h>
+#include "Banner.h"
+#include "CompilerDefs.h"
#include <boost/algorithm/string/replace.hpp>
#include <boost/program_options.hpp>
@@ -131,6 +132,8 @@ int main(int argc, char** argv)
try
{
+ Trinity::Banner::Show("connection_patcher", [](char const* text) { std::cout << text << std::endl; }, nullptr);
+
auto vm = GetConsoleArguments(argc, argv);
// exit if help is enabled
diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp
index 22a8cc72c3c..91efa8ce287 100644
--- a/src/tools/map_extractor/System.cpp
+++ b/src/tools/map_extractor/System.cpp
@@ -35,6 +35,7 @@
#include "DBFilesClientList.h"
#include "CascLib.h"
#include "dbcfile.h"
+#include "Banner.h"
#include "StringFormat.h"
#include "adt.h"
@@ -1179,8 +1180,7 @@ bool OpenCascStorage(int locale)
int main(int argc, char * arg[])
{
- printf("Map & DBC Extractor\n");
- printf("===================\n");
+ Trinity::Banner::Show("Map & DBC Extractor", [](char const* text) { printf("%s\n", text); }, nullptr);
boost::filesystem::path current(boost::filesystem::current_path());
strcpy(input_path, current.string().c_str());
diff --git a/src/tools/mmaps_generator/PathGenerator.cpp b/src/tools/mmaps_generator/PathGenerator.cpp
index 7bec37a64e8..29b0715fdbf 100644
--- a/src/tools/mmaps_generator/PathGenerator.cpp
+++ b/src/tools/mmaps_generator/PathGenerator.cpp
@@ -19,6 +19,7 @@
#include "PathCommon.h"
#include "MapBuilder.h"
#include "Timer.h"
+#include "Banner.h"
using namespace MMAP;
@@ -242,6 +243,8 @@ int finish(const char* message, int returnValue)
int main(int argc, char** argv)
{
+ Trinity::Banner::Show("MMAP generator", [](char const* text) { printf("%s\n", text); }, nullptr);
+
int threads = 3, mapnum = -1;
float maxAngle = 70.0f;
int tileX = -1, tileY = -1;
diff --git a/src/tools/vmap4_assembler/VMapAssembler.cpp b/src/tools/vmap4_assembler/VMapAssembler.cpp
index efe705e8b6c..24889e7fa63 100644
--- a/src/tools/vmap4_assembler/VMapAssembler.cpp
+++ b/src/tools/vmap4_assembler/VMapAssembler.cpp
@@ -20,9 +20,12 @@
#include <iostream>
#include "TileAssembler.h"
+#include "Banner.h"
int main(int argc, char* argv[])
{
+ Trinity::Banner::Show("VMAP assembler", [](char const* text) { std::cout << text << std::endl; }, nullptr);
+
if (argc != 3)
{
std::cout << "usage: " << argv[0] << " <raw data dir> <vmap dest dir>" << std::endl;
diff --git a/src/tools/vmap4_extractor/vmapexport.cpp b/src/tools/vmap4_extractor/vmapexport.cpp
index 55f2e6efde4..e4177052751 100644
--- a/src/tools/vmap4_extractor/vmapexport.cpp
+++ b/src/tools/vmap4_extractor/vmapexport.cpp
@@ -49,7 +49,7 @@
#include "mpqfile.h"
#include "vmapexport.h"
-
+#include "Banner.h"
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
@@ -457,6 +457,8 @@ bool processArgv(int argc, char ** argv, const char *versionString)
int main(int argc, char ** argv)
{
+ Trinity::Banner::Show("VMAP data extractor", [](char const* text) { printf("%s\n", text); }, nullptr);
+
bool success = true;
const char *versionString = "V4.03 2015_05";