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/shared/util.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
(limited to 'src/shared/util.cpp')
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
--
cgit v1.3.1