summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2019-10-09 01:38:53 -0400
committerisanae <14251494+isanae@users.noreply.github.com>2019-10-09 01:38:53 -0400
commitdfb3020f8982e325e804f9e43b28a33b54c798f9 (patch)
tree587093f23e31d22b24dda3ac8db1baa5c2334626 /src/shared
parentc01e80a651f5e25441330ad20253bb47ad0f516c (diff)
added usvfs version in log and about dialog
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/util.cpp46
-rw-r--r--src/shared/util.h1
2 files changed, 47 insertions, 0 deletions
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 <http://www.gnu.org/licenses/>.
#include "util.h"
#include "windows_error.h"
#include "mainwindow.h"
+#include <usvfs.h>
+#include <usvfs_version.h>
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<USVFSVersionStringType*>(
+ ::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