From dfb3020f8982e325e804f9e43b28a33b54c798f9 Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Wed, 9 Oct 2019 01:38:53 -0400
Subject: added usvfs version in log and about dialog
---
src/aboutdialog.cpp | 3 +++
src/aboutdialog.ui | 7 +++++++
src/main.cpp | 5 +++--
src/shared/util.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++++++
src/shared/util.h | 1 +
5 files changed, 60 insertions(+), 2 deletions(-)
(limited to 'src')
diff --git a/src/aboutdialog.cpp b/src/aboutdialog.cpp
index 41fd24f7..6ae7f56d 100644
--- a/src/aboutdialog.cpp
+++ b/src/aboutdialog.cpp
@@ -20,6 +20,7 @@ along with Mod Organizer. If not, see .
#include "aboutdialog.h"
#include "ui_aboutdialog.h"
+#include "util.h"
#include
#include
@@ -85,6 +86,8 @@ AboutDialog::AboutDialog(const QString &version, QWidget *parent)
ui->revisionLabel->setText(ui->revisionLabel->text() + " unknown");
#endif
+
+ ui->usvfsLabel->setText(ui->usvfsLabel->text() + " " + MOShared::getUsvfsVersionString());
ui->licenseText->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
}
diff --git a/src/aboutdialog.ui b/src/aboutdialog.ui
index c72a85f8..415ce0a7 100644
--- a/src/aboutdialog.ui
+++ b/src/aboutdialog.ui
@@ -104,6 +104,13 @@
+ -
+
+
+ usvfs:
+
+
+
-
diff --git a/src/main.cpp b/src/main.cpp
index f08ba066..776c3775 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -504,8 +504,9 @@ int runApplication(MOApplication &application, SingleInstance &instance,
const QString &splashPath)
{
log::info(
- "starting Mod Organizer version {} revision {} in {}",
- getVersionDisplayString(), GITID, QCoreApplication::applicationDirPath());
+ "starting Mod Organizer version {} revision {} in {}, usvfs: {}",
+ getVersionDisplayString(), GITID, QCoreApplication::applicationDirPath(),
+ MOShared::getUsvfsVersionString());
preloadSsl();
if (!QSslSocket::supportsSsl()) {
diff --git a/src/shared/util.cpp b/src/shared/util.cpp
index 58f4eb2b..32eb825c 100644
--- a/src/shared/util.cpp
+++ b/src/shared/util.cpp
@@ -20,6 +20,8 @@ along with Mod Organizer. If not, see .
#include "util.h"
#include "windows_error.h"
#include "mainwindow.h"
+#include
+#include
namespace MOShared
{
@@ -244,6 +246,50 @@ MOBase::VersionInfo createVersionInfo()
}
}
+QString getUsvfsDLLVersion()
+{
+ // once 2.2.2 is released, this can be changed to call USVFSVersionString()
+ // directly; until then, using GetProcAddress() allows for mixing up devbuilds
+ // and usvfs dlls
+
+ using USVFSVersionStringType = const char* WINAPI ();
+
+ QString s;
+
+ const auto m = ::LoadLibraryW(L"usvfs_x64.dll");
+
+ if (m) {
+ auto* f = reinterpret_cast(
+ ::GetProcAddress(m, "USVFSVersionString"));
+
+ if (f) {
+ s = f();
+ }
+
+ ::FreeLibrary(m);
+ }
+
+ if (s.isEmpty()) {
+ s = "?";
+ }
+
+ return s;
+}
+
+QString getUsvfsVersionString()
+{
+ const QString dll = getUsvfsDLLVersion();
+ const QString header = USVFS_VERSION_STRING;
+
+ QString usvfsVersion;
+
+ if (dll == header) {
+ return dll;
+ } else {
+ return "dll is " + dll + ", compiled against " + header;
+ }
+}
+
} // namespace MOShared
diff --git a/src/shared/util.h b/src/shared/util.h
index aea6f200..e87244b6 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -45,6 +45,7 @@ std::wstring ToLower(const std::wstring &text);
bool CaseInsensitiveEqual(const std::wstring &lhs, const std::wstring &rhs);
MOBase::VersionInfo createVersionInfo();
+QString getUsvfsVersionString();
} // namespace MOShared
--
cgit v1.3.1