log the MSVC runtime version when running on MSVC build

This might be useful information, not 100% sure.

[   0.958068] Frontend <Info> yuzu\main.cpp:GMainWindow:275: yuzu Version: yuzu Development Build | master-0b9ef3c0b-dirty
[   0.958095] Frontend <Info> yuzu\main.cpp:LogRuntimes:220: MSVC Compiler: 1931 Runtime: 14.32.31326.0
master
Kyle Kienapfel 2022-06-10 20:37:47 +07:00
parent 20576ebb43
commit 3370546a7a
2 changed files with 30 additions and 0 deletions

@ -242,6 +242,7 @@ elseif(WIN32)
target_link_libraries(yuzu PRIVATE Qt5::WinMain) target_link_libraries(yuzu PRIVATE Qt5::WinMain)
endif() endif()
if(MSVC) if(MSVC)
target_link_libraries(yuzu PRIVATE version.lib)
set_target_properties(yuzu PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS") set_target_properties(yuzu PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS")
elseif(MINGW) elseif(MINGW)
set_target_properties(yuzu PROPERTIES LINK_FLAGS_RELEASE "-Wl,--subsystem,windows") set_target_properties(yuzu PROPERTIES LINK_FLAGS_RELEASE "-Wl,--subsystem,windows")

@ -198,6 +198,34 @@ static void RemoveCachedContents() {
Common::FS::RemoveDirRecursively(offline_system_data); 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() { static QString PrettyProductName() {
#ifdef _WIN32 #ifdef _WIN32
// After Windows 10 Version 2004, Microsoft decided to switch to a different notation: 20H2 // After Windows 10 Version 2004, Microsoft decided to switch to a different notation: 20H2
@ -268,6 +296,7 @@ GMainWindow::GMainWindow()
const auto yuzu_build_version = override_build.empty() ? yuzu_build : override_build; const auto yuzu_build_version = override_build.empty() ? yuzu_build : override_build;
LOG_INFO(Frontend, "yuzu Version: {}", yuzu_build_version); LOG_INFO(Frontend, "yuzu Version: {}", yuzu_build_version);
LogRuntimes();
#ifdef ARCHITECTURE_x86_64 #ifdef ARCHITECTURE_x86_64
const auto& caps = Common::GetCPUCaps(); const auto& caps = Common::GetCPUCaps();
std::string cpu_string = caps.cpu_string; std::string cpu_string = caps.cpu_string;