From 595f36311f7dcfe7ac90a0a22950f88fde755630 Mon Sep 17 00:00:00 2001 From: T1ti <40864460+T1ti@users.noreply.github.com> Date: Wed, 17 Jul 2024 04:47:35 +0200 Subject: [PATCH] Log visual c++ redist version --- src/noggit/application/NoggitApplication.cpp | 36 ++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/src/noggit/application/NoggitApplication.cpp b/src/noggit/application/NoggitApplication.cpp index cfc0350d..43215367 100755 --- a/src/noggit/application/NoggitApplication.cpp +++ b/src/noggit/application/NoggitApplication.cpp @@ -64,7 +64,7 @@ namespace Noggit::Application if (!std::filesystem::exists(noggitProjectPath)) { std::filesystem::create_directory(noggitProjectPath); - Log << "Noggit Project Folder Not Loaded! Creating..." << std::endl; + // Log << "Noggit Project Folder Not Loaded! Creating..." << std::endl; } auto listFilePath = applicationConfiguration.ApplicationListFilePath; @@ -78,11 +78,43 @@ namespace Noggit::Application auto databaseDefinitionPath = applicationConfiguration.ApplicationDatabaseDefinitionsPath; if (!std::filesystem::exists(databaseDefinitionPath)) { - // LogError << "Unable to find database definitions! please reinstall Noggit Red, or download from wow.tools" << std::endl; + LogError << "Unable to find database definitions! please reinstall Noggit Red, or download from wow.tools" << std::endl; } Log << "Database Definitions found! : " << databaseDefinitionPath << std::endl; + // Check MSVC redistribuable version + const QString registryPath = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\"; + + // Visual C++ 2015 (MSVC++ 14.0) + // Visual C++ 2017 (MSVC++ 14.1) + // Visual C++ 2019 (MSVC++ 14.2) + // Visual C++ 2022 (MSVC++ 14.3) + const QStringList versions = { + "14.0", // MSVC 14.0 Visual Studio 2015 + // "15.0", // MSVC 14.1 Visual Studio 2017 + // "16.0", // MSVC 14.2 Visual Studio 2019 + // "17.0" // MSVC 14.3 Visual Studio 2022 + }; + + bool redist_found = false; + foreach (const QString & version, versions) { + QString keyPath = registryPath + version + "\\VC\\Runtimes\\x64"; + QSettings settings(keyPath, QSettings::NativeFormat); + + if (settings.contains("Installed")) { + bool installed = settings.value("Installed").toBool(); + if (installed) { + redist_found = true; + QString versionNumber = settings.value("Version").toString(); + LogDebug << "Found MSVC " << version.toStdString() << " Redistributable Version: " << versionNumber.toStdString() << std::endl; + } + } + } + if (!redist_found) + LogDebug << "No Redistribuable MSVC version found" << std::endl; + + // Initialize OpenGL QSurfaceFormat format; format.setRenderableType(QSurfaceFormat::OpenGL);