From c676247f99ceb8ae365fd6c9ca86981dd309082c Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Thu, 24 Dec 2020 09:13:11 -0500
Subject: ignore steam username when dumping settings
---
src/settings.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
(limited to 'src/settings.cpp')
diff --git a/src/settings.cpp b/src/settings.cpp
index 85aa5f2f..04e407fc 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -479,7 +479,9 @@ QSettings::Status Settings::iniStatus() const
void Settings::dump() const
{
static const QStringList ignore({
- "username", "password", "nexus_api_key", "nexus_username", "nexus_password"
+ "username", "password",
+ "nexus_api_key", "nexus_username", "nexus_password",
+ "steam_username"
});
log::debug("settings:");
--
cgit v1.3.1
From b2af1e340f956c11a7c522e8c4b5900925417634 Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Thu, 24 Dec 2020 09:36:04 -0500
Subject: dump nxmhandler.ini
---
src/settings.cpp | 50 ++++++++++++++++++++++++++++++++++++++++++++++--
src/settings.h | 4 ++++
src/shared/appconfig.inc | 2 ++
3 files changed, 54 insertions(+), 2 deletions(-)
(limited to 'src/settings.cpp')
diff --git a/src/settings.cpp b/src/settings.cpp
index 04e407fc..f554bc64 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -21,6 +21,7 @@ along with Mod Organizer. If not, see .
#include "settingsutilities.h"
#include "serverinfo.h"
#include "executableslist.h"
+#include "instancemanager.h"
#include "shared/appconfig.h"
#include "env.h"
#include "envmetrics.h"
@@ -499,6 +500,7 @@ void Settings::dump() const
}
m_Network.dump();
+ m_Nexus.dump();
}
void Settings::managedGameChanged(IPluginGame const *gamePlugin)
@@ -1526,7 +1528,7 @@ std::map PathSettings::recent() const
if (name.isValid() && dir.isValid()) {
map.emplace(name.toString(), dir.toString());
}
- });
+ });
return map;
}
@@ -1893,7 +1895,10 @@ void NexusSettings::setTrackedIntegration(bool b) const
void NexusSettings::registerAsNXMHandler(bool force)
{
- const auto nxmPath = QCoreApplication::applicationDirPath() + "/nxmhandler.exe";
+ const auto nxmPath =
+ QCoreApplication::applicationDirPath() + "/" +
+ QString::fromStdWString(AppConfig::nxmHandlerExe());
+
const auto executable = QCoreApplication::applicationFilePath();
QString mode = force ? "forcereg" : "reg";
@@ -1946,6 +1951,47 @@ std::vector NexusSettings::validationTimeouts() const
return v;
}
+void NexusSettings::dump() const
+{
+ const auto iniPath =
+ InstanceManager::singleton().globalInstancesRootPath() + "/" +
+ QString::fromStdWString(AppConfig::nxmHandlerIni());
+
+ if (!QFileInfo(iniPath).exists()) {
+ log::debug("nxm ini not found at {}", iniPath);
+ return;
+ }
+
+ QSettings s(iniPath, QSettings::IniFormat);
+ if (const auto st=s.status(); st != QSettings::NoError) {
+ log::debug("can't read nxm ini from {}", iniPath);
+ return;
+ }
+
+ log::debug("nxmhandler settings:");
+
+ const auto noregister = getOptional(s, "General", "noregister");
+
+ if (noregister) {
+ log::debug(" - noregister: {}", *noregister);
+ } else {
+ log::debug(" - noregister: (not found)");
+ }
+
+ ScopedReadArray sra(s, "handlers");
+
+ sra.for_each([&] {
+ const auto games = sra.get("games");
+ const auto executable = sra.get("executable");
+ const auto arguments = sra.get("arguments");
+
+ log::debug(" - handler:");
+ log::debug(" - games: {}", games.toString());
+ log::debug(" - executable: {}", executable.toString());
+ log::debug(" - arguments: {}", arguments.toString());
+ });
+}
+
SteamSettings::SteamSettings(Settings& parent, QSettings& settings)
: m_Parent(parent), m_Settings(settings)
diff --git a/src/settings.h b/src/settings.h
index 48aefc27..82c3a615 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -528,6 +528,10 @@ public:
std::vector validationTimeouts() const;
+ // dumps nxmhandler stuff
+ //
+ void dump() const;
+
private:
Settings& m_Parent;
QSettings& m_Settings;
diff --git a/src/shared/appconfig.inc b/src/shared/appconfig.inc
index 5839c2f4..9058bf18 100644
--- a/src/shared/appconfig.inc
+++ b/src/shared/appconfig.inc
@@ -18,6 +18,8 @@ APPPARAM(std::wstring, proxyDLLOrig, L"steam_api_orig.dll") // needs to be ident
APPPARAM(std::wstring, proxyDLLSource, L"proxy.dll")
APPPARAM(std::wstring, vfs32DLLName, L"usvfs_x86.dll")
APPPARAM(std::wstring, vfs64DLLName, L"usvfs_x64.dll")
+APPPARAM(std::wstring, nxmHandlerExe, L"nxmhandler.exe")
+APPPARAM(std::wstring, nxmHandlerIni, L"nxmhandler.ini")
APPPARAM(std::wstring, portableLockFileName, L"portable.txt")
APPPARAM(const wchar_t*, localSavePlaceholder, L"__MOProfileSave__\\")
--
cgit v1.3.1
From b20b4582998d1a400a1b18086edc1dd3ffcf20c1 Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Thu, 24 Dec 2020 09:42:23 -0500
Subject: also log primary handler
---
src/settings.cpp | 3 +++
1 file changed, 3 insertions(+)
(limited to 'src/settings.cpp')
diff --git a/src/settings.cpp b/src/settings.cpp
index f554bc64..436cd42b 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -1970,6 +1970,9 @@ void NexusSettings::dump() const
log::debug("nxmhandler settings:");
+ QSettings handler("HKEY_CURRENT_USER\\Software\\Classes\\nxm\\", QSettings::NativeFormat);
+ log::debug(" - primary: {}", handler.value("shell/open/command/Default").toString());
+
const auto noregister = getOptional(s, "General", "noregister");
if (noregister) {
--
cgit v1.3.1
From 1b700785bb8b5a3891391f60b13c9fee4647b5dd Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Thu, 24 Dec 2020 11:22:24 -0500
Subject: don't log modules in winroot dashes to dots
---
src/env.cpp | 4 +++-
src/envmodule.cpp | 23 +++++++++++++++++++++++
src/envmodule.h | 4 ++++
src/moapplication.cpp | 5 ++++-
src/settings.cpp | 14 +++++++-------
5 files changed, 41 insertions(+), 9 deletions(-)
(limited to 'src/settings.cpp')
diff --git a/src/env.cpp b/src/env.cpp
index edd8cd6b..76473dfb 100644
--- a/src/env.cpp
+++ b/src/env.cpp
@@ -345,7 +345,9 @@ void Environment::dump(const Settings& s) const
log::debug("modules loaded in process:");
for (const auto& m : loadedModules()) {
- log::debug(" . {}", m.toString());
+ if (m.interesting()) {
+ log::debug(" . {}", m.toString());
+ }
}
log::debug("displays:");
diff --git a/src/envmodule.cpp b/src/envmodule.cpp
index 5f2a5f5a..81cbad8a 100644
--- a/src/envmodule.cpp
+++ b/src/envmodule.cpp
@@ -308,6 +308,29 @@ QDateTime Module::getTimestamp(const VS_FIXEDFILEINFO& fi) const
QTime(utc.wHour, utc.wMinute, utc.wSecond, utc.wMilliseconds));
}
+bool Module::interesting() const
+{
+ static const auto windir = []() -> QString {
+ try
+ {
+ return QDir::toNativeSeparators(
+ MOBase::getKnownFolder(FOLDERID_Windows).path()) + "\\";
+ }
+ catch(...)
+ {
+ return "c:\\windows\\";
+ }
+ }();
+
+
+ if (m_path.startsWith(windir, Qt::CaseInsensitive)) {
+ return false;
+ }
+
+ return true;
+}
+
+
QString Module::getMD5() const
{
static const std::set ignore = {
diff --git a/src/envmodule.h b/src/envmodule.h
index c2829b32..4b85d737 100644
--- a/src/envmodule.h
+++ b/src/envmodule.h
@@ -66,6 +66,10 @@ public:
//
QString timestampString() const;
+ // returns false for modules in the Windows root directory
+ //
+ bool interesting() const;
+
// returns a string with all the above information on one line
//
QString toString() const;
diff --git a/src/moapplication.cpp b/src/moapplication.cpp
index e7ac3926..88b5710f 100644
--- a/src/moapplication.cpp
+++ b/src/moapplication.cpp
@@ -254,7 +254,10 @@ int MOApplication::doOneRun(MOMultiProcess& multiProcess)
sanity::checkEnvironment(env);
const auto moduleNotification = env.onModuleLoaded(qApp, [](auto&& m) {
- log::debug("loaded module {}", m.toString());
+ if (m.interesting()) {
+ log::debug("loaded module {}", m.toString());
+ }
+
sanity::checkIncompatibleModule(m);
});
diff --git a/src/settings.cpp b/src/settings.cpp
index 436cd42b..ebb4fabe 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -1971,14 +1971,14 @@ void NexusSettings::dump() const
log::debug("nxmhandler settings:");
QSettings handler("HKEY_CURRENT_USER\\Software\\Classes\\nxm\\", QSettings::NativeFormat);
- log::debug(" - primary: {}", handler.value("shell/open/command/Default").toString());
+ log::debug(" . primary: {}", handler.value("shell/open/command/Default").toString());
const auto noregister = getOptional(s, "General", "noregister");
if (noregister) {
- log::debug(" - noregister: {}", *noregister);
+ log::debug(" . noregister: {}", *noregister);
} else {
- log::debug(" - noregister: (not found)");
+ log::debug(" . noregister: (not found)");
}
ScopedReadArray sra(s, "handlers");
@@ -1988,10 +1988,10 @@ void NexusSettings::dump() const
const auto executable = sra.get("executable");
const auto arguments = sra.get("arguments");
- log::debug(" - handler:");
- log::debug(" - games: {}", games.toString());
- log::debug(" - executable: {}", executable.toString());
- log::debug(" - arguments: {}", arguments.toString());
+ log::debug(" . handler:");
+ log::debug(" . games: {}", games.toString());
+ log::debug(" . executable: {}", executable.toString());
+ log::debug(" . arguments: {}", arguments.toString());
});
}
--
cgit v1.3.1