summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMai M <mathew1800@gmail.com>2022-06-11 19:21:23 +0200
committerGitHub <noreply@github.com>2022-06-11 19:21:23 +0200
commitb94739cfa7f4b9ff515a527e00a915437417eca7 (patch)
treed2974d2d9efbe8dbdff498341ea14b33f50c2608
parentMerge pull request #8427 from Docteh/deprecate_qdesktop (diff)
parentlog the MSVC runtime version when running on MSVC build (diff)
downloadyuzu-b94739cfa7f4b9ff515a527e00a915437417eca7.tar
yuzu-b94739cfa7f4b9ff515a527e00a915437417eca7.tar.gz
yuzu-b94739cfa7f4b9ff515a527e00a915437417eca7.tar.bz2
yuzu-b94739cfa7f4b9ff515a527e00a915437417eca7.tar.lz
yuzu-b94739cfa7f4b9ff515a527e00a915437417eca7.tar.xz
yuzu-b94739cfa7f4b9ff515a527e00a915437417eca7.tar.zst
yuzu-b94739cfa7f4b9ff515a527e00a915437417eca7.zip
-rw-r--r--src/yuzu/CMakeLists.txt1
-rw-r--r--src/yuzu/main.cpp29
2 files changed, 30 insertions, 0 deletions
diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt
index 9259ca15e..242867a4f 100644
--- a/src/yuzu/CMakeLists.txt
+++ b/src/yuzu/CMakeLists.txt
@@ -244,6 +244,7 @@ elseif(WIN32)
target_link_libraries(yuzu PRIVATE Qt5::WinMain)
endif()
if(MSVC)
+ target_link_libraries(yuzu PRIVATE version.lib)
set_target_properties(yuzu PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS")
elseif(MINGW)
set_target_properties(yuzu PROPERTIES LINK_FLAGS_RELEASE "-Wl,--subsystem,windows")
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 89b1d9824..27f23bcb0 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -199,6 +199,34 @@ static void RemoveCachedContents() {
Common::FS::RemoveDirRecursively(offline_system_data);
}
+static void LogRuntimes() {
+#ifdef _MSC_VER
+ // It is possible that the name of the dll will change.
+ // vcruntime140.dll is for 2015 and onwards
+ constexpr char runtime_dll_name[] = "vcruntime140.dll";
+ UINT sz = GetFileVersionInfoSizeA(runtime_dll_name, nullptr);
+ bool runtime_version_inspection_worked = false;
+ if (sz > 0) {
+ std::vector<u8> buf(sz);
+ if (GetFileVersionInfoA(runtime_dll_name, 0, sz, buf.data())) {
+ VS_FIXEDFILEINFO* pvi;
+ sz = sizeof(VS_FIXEDFILEINFO);
+ if (VerQueryValueA(buf.data(), "\\", reinterpret_cast<LPVOID*>(&pvi), &sz)) {
+ if (pvi->dwSignature == VS_FFI_SIGNATURE) {
+ runtime_version_inspection_worked = true;
+ LOG_INFO(Frontend, "MSVC Compiler: {} Runtime: {}.{}.{}.{}", _MSC_VER,
+ pvi->dwProductVersionMS >> 16, pvi->dwProductVersionMS & 0xFFFF,
+ pvi->dwProductVersionLS >> 16, pvi->dwProductVersionLS & 0xFFFF);
+ }
+ }
+ }
+ }
+ if (!runtime_version_inspection_worked) {
+ LOG_INFO(Frontend, "Unable to inspect {}", runtime_dll_name);
+ }
+#endif
+}
+
static QString PrettyProductName() {
#ifdef _WIN32
// After Windows 10 Version 2004, Microsoft decided to switch to a different notation: 20H2
@@ -269,6 +297,7 @@ GMainWindow::GMainWindow()
const auto yuzu_build_version = override_build.empty() ? yuzu_build : override_build;
LOG_INFO(Frontend, "yuzu Version: {}", yuzu_build_version);
+ LogRuntimes();
#ifdef ARCHITECTURE_x86_64
const auto& caps = Common::GetCPUCaps();
std::string cpu_string = caps.cpu_string;