diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2019-07-17 12:39:01 -0400 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2019-07-22 07:33:38 -0400 |
| commit | 2ef32d12306ac21c0c900ff8f353ff0b573e67ae (patch) | |
| tree | 879c179df39c01a317c19bff40e38769427debe4 | |
| parent | 35ae099d3fcc6c5b42fbd8d10e5efc2427bcf2dc (diff) | |
moved environment dump to member function
added check for nahimic
| -rw-r--r-- | src/main.cpp | 51 | ||||
| -rw-r--r-- | src/shared/util.cpp | 25 | ||||
| -rw-r--r-- | src/shared/util.h | 6 |
3 files changed, 54 insertions, 28 deletions
diff --git a/src/main.cpp b/src/main.cpp index 15d36428..ef698dd4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -482,27 +482,6 @@ static QString getVersionDisplayString() return createVersionInfo().displayString(3); } -void dumpEnvironment() -{ - env::Environment env; - - log::debug("windows: {}", env.windowsInfo().toString()); - - if (env.windowsInfo().compatibilityMode()) { - log::warn("MO seems to be running in compatibility mode"); - } - - log::debug("security products:"); - for (const auto& sp : env.securityProducts()) { - log::debug(" . {}", sp.toString()); - } - - log::debug("modules loaded in process:"); - for (const auto& m : env.loadedModules()) { - log::debug(" . {}", m.toString()); - } -} - void dumpSettings(QSettings& settings) { static const QStringList ignore({ @@ -524,7 +503,7 @@ void dumpSettings(QSettings& settings) settings.endGroup(); } -void sanityChecks() +void checkMissingFiles() { // files that are likely to be eaten static const QStringList files({ @@ -545,6 +524,28 @@ void sanityChecks() } } +void checkNahimic(const env::Environment& e) +{ + for (auto&& m : e.loadedModules()) { + const QFileInfo file(m.path()); + + if (file.fileName().compare("NahimicOSD.dll", Qt::CaseInsensitive)) { + log::warn( + "NahimicOSD.dll is loaded. Nahimic is known to cause issues with " + "Mod Organizer, such as freezing or blank windows. Consider " + "uninstalling it."); + + break; + } + } +} + +void sanityChecks(const env::Environment& e) +{ + checkMissingFiles(); + checkNahimic(e); +} + int runApplication(MOApplication &application, SingleInstance &instance, const QString &splashPath) @@ -585,9 +586,11 @@ int runApplication(MOApplication &application, SingleInstance &instance, // update it when the settings are changed during runtime OrganizerCore::setGlobalCrashDumpsType(settings.crashDumpsType()); - dumpEnvironment(); + env::Environment env; + + env.dump(); dumpSettings(initSettings); - sanityChecks(); + sanityChecks(env); log::debug("initializing core"); OrganizerCore organizer(settings); diff --git a/src/shared/util.cpp b/src/shared/util.cpp index 8d8c2000..eacd1f88 100644 --- a/src/shared/util.cpp +++ b/src/shared/util.cpp @@ -23,6 +23,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "executableslist.h"
#include "instancemanager.h"
#include <utility.h>
+#include <log.h>
#include <sstream>
#include <locale>
@@ -41,8 +42,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #pragma comment(lib, "Wbemuuid.lib")
-using MOBase::formatSystemMessage;
-using MOBase::formatSystemMessageQ;
+using namespace MOBase;
namespace fs = std::filesystem;
namespace MOShared {
@@ -870,7 +870,7 @@ Environment::Environment() m_security = getSecurityProducts();
}
-const std::vector<Module>& Environment::loadedModules()
+const std::vector<Module>& Environment::loadedModules() const
{
return m_modules;
}
@@ -885,6 +885,25 @@ const std::vector<SecurityProduct>& Environment::securityProducts() const return m_security;
}
+void Environment::dump() const
+{
+ log::debug("windows: {}", windowsInfo().toString());
+
+ if (windowsInfo().compatibilityMode()) {
+ log::warn("MO seems to be running in compatibility mode");
+ }
+
+ log::debug("security products:");
+ for (const auto& sp : securityProducts()) {
+ log::debug(" . {}", sp.toString());
+ }
+
+ log::debug("modules loaded in process:");
+ for (const auto& m : loadedModules()) {
+ log::debug(" . {}", m.toString());
+ }
+}
+
std::vector<Module> Environment::getLoadedModules() const
{
HandlePtr snapshot(CreateToolhelp32Snapshot(
diff --git a/src/shared/util.h b/src/shared/util.h index a5d096ac..267bb780 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -410,7 +410,7 @@ public: // list of loaded modules in the current process
//
- const std::vector<Module>& loadedModules();
+ const std::vector<Module>& loadedModules() const;
// information about the operating system
//
@@ -420,6 +420,10 @@ public: //
const std::vector<SecurityProduct>& securityProducts() const;
+ // logs the environment
+ //
+ void dump() const;
+
private:
std::vector<Module> m_modules;
WindowsInfo m_windows;
|
