From 9fe54aa8c635cfe1f43cda6aef7c979d88210e40 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Mon, 17 Dec 2018 11:46:51 +0200 Subject: [PATCH] [General] Add getArchitectureType() to multiplayer Utils Additionally, rename getOperatingSystem() into getOperatingSystemType() for clarity. --- components/openmw-mp/Utils.cpp | 25 ++++++++++++++----------- components/openmw-mp/Utils.hpp | 3 ++- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/components/openmw-mp/Utils.cpp b/components/openmw-mp/Utils.cpp index 11603beac..32b1843c3 100644 --- a/components/openmw-mp/Utils.cpp +++ b/components/openmw-mp/Utils.cpp @@ -175,7 +175,7 @@ unsigned int ::Utils::crc32Checksum(const std::string &file) return crc32.checksum(); } -std::string Utils::getOperatingSystem() +std::string Utils::getOperatingSystemType() { #if defined(_WIN32) return "Windows"; @@ -188,25 +188,28 @@ std::string Utils::getOperatingSystem() #endif } -void Utils::printVersion(std::string appName, std::string version, std::string commitHash, int protocol) +std::string Utils::getArchitectureType() { - cout << appName << " " << version; - cout << " (" << getOperatingSystem() << " "; #if defined(__x86_64__) || defined(_M_X64) - cout << "64-bit"; + return "64-bit"; #elif defined(__i386__) || defined(_M_I86) - cout << "32-bit"; + return "32-bit"; #elif defined(__ARM_ARCH) - cout << "ARMv" << __ARM_ARCH << " "; + return "ARMv" + __ARM_ARCH; #ifdef __aarch64__ - cout << "64-bit"; + return "64-bit"; #else - cout << "32-bit"; + return "32-bit"; #endif #else - cout << "Unknown architecture"; + return "Unknown architecture"; #endif - cout << ")" << endl; +} + +void Utils::printVersion(std::string appName, std::string version, std::string commitHash, int protocol) +{ + cout << appName << " " << version; + cout << " (" << getOperatingSystemType() << " " << getArchitectureType() << ")" << endl; cout << "Protocol version: " << protocol << endl; cout << "Commit hash: " << commitHash.substr(0, 10) << endl; diff --git a/components/openmw-mp/Utils.hpp b/components/openmw-mp/Utils.hpp index 9fc4fded5..8f365940f 100644 --- a/components/openmw-mp/Utils.hpp +++ b/components/openmw-mp/Utils.hpp @@ -60,7 +60,8 @@ namespace Utils unsigned int crc32Checksum(const std::string &file); - std::string getOperatingSystem(); + std::string getOperatingSystemType(); + std::string getArchitectureType(); void printVersion(std::string appName, std::string version, std::string commitHash, int protocol);