From 4bff98352788d6d993927254380ed10441f95894 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Thu, 24 Dec 2020 09:12:16 -0500 Subject: regex for osds added gigabyte 3d osd, more nahimic --- src/sanitychecks.cpp | 57 +++++++++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/sanitychecks.cpp b/src/sanitychecks.cpp index 613e4b26..4833b4a2 100644 --- a/src/sanitychecks.cpp +++ b/src/sanitychecks.cpp @@ -220,46 +220,53 @@ int checkMissingFiles() int checkBadOSDs(const env::Module& m) { - // these dlls seems to interfere mostly with dialogs, like the mod info - // dialog: it renders dialogs fully white and makes it impossible to interact - // with them + // these dlls seem to interfere mostly with dialogs, like the mod info + // dialog: they render some dialogs fully white and make it impossible to + // interact with them // - // the dlls is usually loaded on startup, but there has been some reports - // where it got loaded later, so this is also called every time a new module + // the dlls is usually loaded on startup, but there has been some reports + // where they got loaded later, so this is also called every time a new module // is loaded into this process - const char* nahimic = - "Nahimic (also known as SonicSuite, SonicRadar, SteelSeries, A-Volute, etc.)"; + const std::string nahimic = + "Nahimic (also known as SonicSuite, SonicRadar, " + "SteelSeries, A-Volute, etc.)"; - static const std::map names = { - {"NahimicOSD.dll", nahimic}, - {"nahimicmsiosd.dll", nahimic}, - {"cassinimlkosd.dll", nahimic}, - {"SS3DevProps.dll", nahimic}, - {"ss2devprops.dll", nahimic}, - {"ss2osd.dll", nahimic}, - {"RTSSHooks64.dll", "RivaTuner Statistics Server"}, - {"SSAudioOSD.dll", "SteelSeries Audio"}, - {"specialk64.dll", "SpecialK"}, - {"corsairosdhook.x64.dll", "Corsair Utility Engine"}, - {"gtii-osd64-vk.dll", "ASUS GPU Tweak 2"}, - {"easyhook64.dll", "Razer Cortex"}, - {"k_fps64.dll", "Razer Cortex"} + auto p = [](std::string re, std::string s) { + return std::make_pair(std::regex(re, std::regex::icase), s); + }; + + static const std::vector> list = { + p("nahimic(.*)osd\\.dll", nahimic), + p("cassini(.*)osd\\.dll", nahimic), + p(".+devprops.*.dll", nahimic), + p("ss2osd\\.dll", nahimic), + p("RTSSHooks64\\.dll", "RivaTuner Statistics Server"), + p("SSAudioOSD\\.dll", "SteelSeries Audio"), + p("specialk64\\.dll", "SpecialK"), + p("corsairosdhook\\.x64\\.dll", "Corsair Utility Engine"), + p("gtii-osd64-vk\\.dll", "ASUS GPU Tweak 2"), + p("easyhook64\\.dll", "Razer Cortex"), + p("k_fps64\\.dll", "Razer Cortex"), + p("fw1fontwrapper\\.dll", "Gigabyte 3D OSD"), + p("gfxhook64\\.dll", "Gigabyte 3D OSD") }; const QFileInfo file(m.path()); int n = 0; - for (auto&& p : names) { - if (file.fileName().compare(p.first, Qt::CaseInsensitive) == 0) { + for (auto&& p : list) { + std::smatch m; + const auto filename = file.fileName().toStdString(); + + if (std::regex_match(filename, m, p.first)) { log::warn("{}", QObject::tr( "%1 is loaded.\nThis program is known to cause issues with " "Mod Organizer, such as freezing or blank windows. Consider " "uninstalling it.") - .arg(p.second)); + .arg(QString::fromStdString(p.second))); log::warn("{}", file.absoluteFilePath()); - ++n; } } -- cgit v1.3.1 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') 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') 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') 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 444f12c7c4103e7ed3c89706a8d8f682d5e87b67 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Thu, 24 Dec 2020 09:45:26 -0500 Subject: replaced "validator" logs with "nexus", clearer for users --- src/nxmaccessmanager.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/nxmaccessmanager.cpp b/src/nxmaccessmanager.cpp index 6c8b9054..79c067a2 100644 --- a/src/nxmaccessmanager.cpp +++ b/src/nxmaccessmanager.cpp @@ -376,7 +376,7 @@ void ValidationAttempt::start(NXMAccessManager& m, const QString& key) m_timeout.start(); log::debug( - "validator: attempt started with timeout of {} seconds", timeout().count()); + "nexus: attempt started with timeout of {} seconds", timeout().count()); } bool ValidationAttempt::sendRequest( @@ -458,11 +458,11 @@ void ValidationAttempt::onFinished() return; } - log::debug("validator attempt: request has finished"); + log::debug("nexus: request has finished"); if (!m_reply) { // shouldn't happen - log::error("validator attempt: reply is null"); + log::error("nexus: reply is null"); setFailure(HardError, QObject::tr("Internal error")); return; } @@ -472,7 +472,7 @@ void ValidationAttempt::onFinished() if (code == 0) { // request wasn't even sent - log::error("validator attempt: code is 0"); + log::error("nexus: code is 0"); setFailure(SoftError, m_reply->errorString()); return; } @@ -539,7 +539,7 @@ void ValidationAttempt::onFinished() void ValidationAttempt::onSslErrors(const QList& errors) { - log::error("validator attempt: ssl errors"); + log::error("nexus: ssl errors"); for (auto& e : errors) { log::error(" . {}", e.errorString()); @@ -557,7 +557,7 @@ void ValidationAttempt::setFailure(Result r, const QString& error) { if (r != Cancelled) { // don't spam the log - log::error("validator attempt: {}", error); + log::error("nexus: {}", error); } cleanup(); @@ -572,7 +572,7 @@ void ValidationAttempt::setFailure(Result r, const QString& error) void ValidationAttempt::setSuccess(const APIUserAccount& user) { - log::debug("validator attempt successful"); + log::debug("nexus connection successful"); cleanup(); m_result = Success; @@ -617,7 +617,7 @@ std::vector NexusKeyValidator::getTimeouts() const void NexusKeyValidator::start(const QString& key, Behaviour b) { if (isActive()) { - log::debug("validator: trying to start while ongoing; ignoring"); + log::debug("nexus: trying to start while ongoing; ignoring"); return; } @@ -655,7 +655,7 @@ void NexusKeyValidator::createAttempts( void NexusKeyValidator::cancel() { - log::debug("validator: cancelled"); + log::debug("nexus: connection cancelled"); for (auto&& a : m_attempts) { a->cancel(); -- cgit v1.3.1 From 28d24b3caaf2d4fcee1441299bdf483939e7359f Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Thu, 24 Dec 2020 09:50:43 -0500 Subject: don't count overwrite, m_Overwrite is dead code --- src/profile.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/profile.cpp b/src/profile.cpp index 92f2abce..3cc1a2a3 100644 --- a/src/profile.cpp +++ b/src/profile.cpp @@ -1123,10 +1123,6 @@ void Profile::debugDump() const for (const auto& status : m_ModStatus) { - if (status.m_Overwrite) { - continue; - } - auto index = m_ModIndexByPriority.find(status.m_Priority); if (index == m_ModIndexByPriority.end()) { log::error("mod with priority {} not in priority map", status.m_Priority); @@ -1139,6 +1135,10 @@ void Profile::debugDump() const continue; } + if (m->hasFlag(ModInfo::FLAG_OVERWRITE)) { + continue; + } + add(total, status); if (m->hasFlag(ModInfo::FLAG_BACKUP)) { -- cgit v1.3.1 From c8cff6166d05e77c843bb727702607f970d3d030 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Thu, 24 Dec 2020 10:02:56 -0500 Subject: added version to dmp filename replaced QApplication calls so createVersionInfo() can be called without one, happens with dump_running_process.bat --- src/env.cpp | 35 ++++++++++++++++++++++++++++++++--- src/env.h | 4 ++++ src/shared/util.cpp | 5 +++-- 3 files changed, 39 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/env.cpp b/src/env.cpp index 98d2e6ea..edd8cd6b 100644 --- a/src/env.cpp +++ b/src/env.cpp @@ -6,6 +6,7 @@ #include "envwindows.h" #include "envdump.h" #include "settings.h" +#include "shared/util.h" #include #include @@ -1009,7 +1010,7 @@ bool registryValueExists(const QString& keyName, const QString& valueName) // returns the filename of the given process or the current one // -std::wstring processFilename(HANDLE process=INVALID_HANDLE_VALUE) +std::filesystem::path processPath(HANDLE process=INVALID_HANDLE_VALUE) { // double the buffer size 10 times const int MaxTries = 10; @@ -1045,7 +1046,7 @@ std::wstring processFilename(HANDLE process=INVALID_HANDLE_VALUE) const std::wstring s(buffer.get(), writtenSize); const std::filesystem::path path(s); - return path.filename().native(); + return path; } } @@ -1062,6 +1063,21 @@ std::wstring processFilename(HANDLE process=INVALID_HANDLE_VALUE) return {}; } +std::wstring processFilename(HANDLE process=INVALID_HANDLE_VALUE) +{ + const auto p = processPath(process); + if (p.empty()) { + return {}; + } + + return p.filename().native(); +} + +std::filesystem::path thisProcessPath() +{ + return processPath(); +} + DWORD findOtherPid() { const std::wstring defaultName = L"ModOrganizer.exe"; @@ -1126,6 +1142,19 @@ std::wstring tempDir() return std::wstring(buffer, buffer + written); } +std::wstring safeVersion() +{ + try + { + // this can throw + return MOShared::createVersionInfo().displayString(3).toStdWString() + L"-"; + } + catch(...) + { + return {}; + } +} + HandlePtr tempFile(const std::wstring dir) { // maximum tries of incrementing the counter @@ -1139,7 +1168,7 @@ HandlePtr tempFile(const std::wstring dir) // i can go until MaxTries std::wostringstream oss; oss - << L"ModOrganizer-" + << L"ModOrganizer-" << safeVersion() << std::setw(4) << (1900 + tm->tm_year) << std::setw(2) << std::setfill(L'0') << (tm->tm_mon + 1) << std::setw(2) << std::setfill(L'0') << tm->tm_mday << "T" diff --git a/src/env.h b/src/env.h index e9cb7a36..2152a40d 100644 --- a/src/env.h +++ b/src/env.h @@ -309,6 +309,10 @@ bool registryValueExists(const QString& key, const QString& value); // void deleteRegistryKeyIfEmpty(const QString& name); +// returns the path to this process +// +std::filesystem::path thisProcessPath(); + } // namespace env #endif // ENV_ENV_H diff --git a/src/shared/util.cpp b/src/shared/util.cpp index f316549e..54c6b841 100644 --- a/src/shared/util.cpp +++ b/src/shared/util.cpp @@ -210,12 +210,13 @@ std::wstring GetFileVersionString(const std::wstring &fileName) VersionInfo createVersionInfo() { - VS_FIXEDFILEINFO version = GetFileVersion(QApplication::applicationFilePath().toStdWString()); + VS_FIXEDFILEINFO version = GetFileVersion(env::thisProcessPath().native()); if (version.dwFileFlags & VS_FF_PRERELEASE) { // Pre-release builds need annotating - QString versionString = QString::fromStdWString(GetFileVersionString(QApplication::applicationFilePath().toStdWString())); + QString versionString = QString::fromStdWString( + GetFileVersionString(env::thisProcessPath().native())); // The pre-release flag can be set without the string specifying what type of pre-release bool noLetters = true; -- cgit v1.3.1 From 5183b2f47ad240174bf653b299af9e068a3b83e4 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Thu, 24 Dec 2020 10:55:55 -0500 Subject: optimizations for download manager: - use envfs for walking directory - minimize string copies, disk access - use set of filenames to check for duplicates - use file size from envfs --- src/downloadmanager.cpp | 91 +++++++++++++++++++++++++++++++------------ src/downloadmanager.h | 4 +- src/envfs.cpp | 25 +++++++----- src/envfs.h | 5 ++- src/shared/directoryentry.cpp | 2 +- 5 files changed, 90 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index 762e3cdb..c912464d 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -24,11 +24,13 @@ along with Mod Organizer. If not, see . #include "nexusinterface.h" #include "nxmaccessmanager.h" #include "iplugingame.h" +#include "envfs.h" #include #include #include "utility.h" #include "selectiondialog.h" #include "bbcode.h" +#include "shared/util.h" #include #include @@ -77,7 +79,9 @@ DownloadManager::DownloadInfo *DownloadManager::DownloadInfo::createNew(const Mo return info; } -DownloadManager::DownloadInfo *DownloadManager::DownloadInfo::createFromMeta(const QString &filePath, bool showHidden, const QString outputDirectory) +DownloadManager::DownloadInfo *DownloadManager::DownloadInfo::createFromMeta( + const QString &filePath, bool showHidden, const QString outputDirectory, + std::optional fileSize) { DownloadInfo *info = new DownloadInfo; @@ -113,7 +117,7 @@ DownloadManager::DownloadInfo *DownloadManager::DownloadInfo::createFromMeta(con info->m_DownloadID = s_NextDownloadID++; info->m_Output.setFileName(filePath); - info->m_TotalSize = QFileInfo(filePath).size(); + info->m_TotalSize = fileSize ? *fileSize : QFileInfo(filePath).size(); info->m_PreResumeSize = info->m_TotalSize; info->m_CurrentUrl = 0; info->m_Urls = metaFile.value("url", "").toString().split(";"); @@ -325,13 +329,15 @@ void DownloadManager::refreshList() } } - QStringList supportedExtensions = m_OrganizerCore->installationManager()->getSupportedExtensions(); - QStringList nameFilters(supportedExtensions); + const QStringList supportedExtensions = m_OrganizerCore->installationManager()->getSupportedExtensions(); + std::vector nameFilters; for (const auto& extension : supportedExtensions) { - nameFilters.append("*." + extension); + nameFilters.push_back(L"." + extension.toLower().toStdWString()); } - nameFilters.append(QString("*").append(UNFINISHED)); + nameFilters.push_back(QString(UNFINISHED).toLower().toStdWString()); + + QDir dir(QDir::fromNativeSeparators(m_OutputDirectory)); // find orphaned meta files and delete them (sounds cruel but it's better for everyone) @@ -348,28 +354,65 @@ void DownloadManager::refreshList() shellDelete(orphans, true); } - // add existing downloads to list - foreach (QString file, dir.entryList(nameFilters, QDir::Files, QDir::Time)) { - bool Exists = false; - for (QVector::const_iterator Iter = m_ActiveDownloads.begin(); Iter != m_ActiveDownloads.end() && !Exists; ++Iter) { - if (QString::compare((*Iter)->m_FileName, file, Qt::CaseInsensitive) == 0) { - Exists = true; - } else if (QString::compare(QFileInfo((*Iter)->m_Output.fileName()).fileName(), file, Qt::CaseInsensitive) == 0) { - Exists = true; - } - } - if (Exists) { - continue; - } - QString fileName = QDir::fromNativeSeparators(m_OutputDirectory) + "/" + file; + std::set seen; - DownloadInfo *info = DownloadInfo::createFromMeta(fileName, m_ShowHidden, m_OutputDirectory); - if (info != nullptr) { - m_ActiveDownloads.push_front(info); - } + struct Context + { + DownloadManager& self; + std::set& seen; + std::vector& extensions; + }; + + Context cx = {*this, seen, nameFilters}; + + for (auto&& d : m_ActiveDownloads) { + cx.seen.insert(d->m_FileName.toLower().toStdWString()); + cx.seen.insert(QFileInfo(d->m_Output.fileName()).fileName().toLower().toStdWString()); } + + env::forEachEntry( + QDir::toNativeSeparators(m_OutputDirectory).toStdWString(), &cx, nullptr, nullptr, + [](void* data, std::wstring_view f, FILETIME, uint64_t size) { + auto& cx = *static_cast(data); + + std::wstring lc = MOShared::ToLowerCopy(f); + + bool interestingExt = false; + for (auto&& ext : cx.extensions) { + if (lc.ends_with(ext)) { + interestingExt = true; + break; + } + } + + if (!interestingExt) { + return; + } + + if (cx.seen.contains(lc)) { + return; + } + + QString fileName = + QDir::fromNativeSeparators(cx.self.m_OutputDirectory) + "/" + + QString::fromWCharArray(f.data(), f.size()); + + DownloadInfo *info = DownloadInfo::createFromMeta( + fileName, cx.self.m_ShowHidden, cx.self.m_OutputDirectory, size); + + if (info == nullptr) { + return; + } + + cx.self.m_ActiveDownloads.push_front(info); + cx.seen.insert(std::move(lc)); + cx.seen.insert(QFileInfo(info->m_Output.fileName()).fileName().toLower().toStdWString()); + }); + + log::debug("saw {} downloads", m_ActiveDownloads.size()); + emit update(-1); //let watcher trigger refreshes again diff --git a/src/downloadmanager.h b/src/downloadmanager.h index 953ab88b..5e126f4b 100644 --- a/src/downloadmanager.h +++ b/src/downloadmanager.h @@ -104,7 +104,9 @@ private: bool m_Hidden; static DownloadInfo *createNew(const MOBase::ModRepositoryFileInfo *fileInfo, const QStringList &URLs); - static DownloadInfo *createFromMeta(const QString &filePath, bool showHidden, const QString outputDirectory); + static DownloadInfo *createFromMeta( + const QString &filePath, bool showHidden, const QString outputDirectory, + std::optional fileSize={}); /** * @brief rename the file diff --git a/src/envfs.cpp b/src/envfs.cpp index 20ba4229..9317eb70 100644 --- a/src/envfs.cpp +++ b/src/envfs.cpp @@ -298,14 +298,17 @@ void forEachEntryImpl( ObjectName.MaximumLength = ObjectName.Length; if (DirInfo->FileAttributes & FILE_ATTRIBUTE_DIRECTORY) { - dirStartF(cx, toStringView(&oa)); - forEachEntryImpl(cx, hc, buffers, &oa, depth+1, dirStartF, dirEndF, fileF); - dirEndF(cx, toStringView(&oa)); + if (dirStartF && dirEndF) { + dirStartF(cx, toStringView(&oa)); + forEachEntryImpl(cx, hc, buffers, &oa, depth+1, dirStartF, dirEndF, fileF); + dirEndF(cx, toStringView(&oa)); + } } else { FILETIME ft; ft.dwLowDateTime = DirInfo->LastWriteTime.LowPart; ft.dwHighDateTime = DirInfo->LastWriteTime.HighPart; - fileF(cx, toStringView(&oa), ft); + + fileF(cx, toStringView(&oa), ft, DirInfo->AllocationSize.QuadPart); } } @@ -380,20 +383,20 @@ Directory getFilesAndDirs(const std::wstring& path) cx->current.pop(); }, - [](void* pcx, std::wstring_view path, FILETIME ft) { + [](void* pcx, std::wstring_view path, FILETIME ft, uint64_t s) { Context* cx = (Context*)pcx; - cx->current.top()->files.push_back(File(path, ft)); + cx->current.top()->files.push_back(File(path, ft, s)); } ); return root; } -File::File(std::wstring_view n, FILETIME ft) : +File::File(std::wstring_view n, FILETIME ft, uint64_t s) : name(n.begin(), n.end()), lcname(MOShared::ToLowerCopy(name)), - lastModified(ft) + lastModified(ft), size(s) { } @@ -429,7 +432,11 @@ void getFilesAndDirsWithFindImpl(const std::wstring& path, Directory& d) getFilesAndDirsWithFindImpl(newPath, d.dirs.back()); } } else { - d.files.push_back(File(findData.cFileName, findData.ftLastWriteTime)); + const auto size = + (findData.nFileSizeHigh * (MAXDWORD+1)) + findData.nFileSizeLow; + + d.files.push_back(File( + findData.cFileName, findData.ftLastWriteTime, size)); } result = ::FindNextFileW(searchHandle, &findData); diff --git a/src/envfs.h b/src/envfs.h index e4d98d71..62540e18 100644 --- a/src/envfs.h +++ b/src/envfs.h @@ -12,8 +12,9 @@ struct File std::wstring name; std::wstring lcname; FILETIME lastModified; + uint64_t size; - File(std::wstring_view name, FILETIME ft); + File(std::wstring_view name, FILETIME ft, uint64_t size); }; struct Directory @@ -174,7 +175,7 @@ private: using DirStartF = void (void*, std::wstring_view); using DirEndF = void (void*, std::wstring_view); -using FileF = void (void*, std::wstring_view, FILETIME); +using FileF = void (void*, std::wstring_view, FILETIME, uint64_t); void setHandleCloserThreadCount(std::size_t n); diff --git a/src/shared/directoryentry.cpp b/src/shared/directoryentry.cpp index c4b467d6..0d275844 100644 --- a/src/shared/directoryentry.cpp +++ b/src/shared/directoryentry.cpp @@ -636,7 +636,7 @@ void DirectoryEntry::addFiles( onDirectoryEnd((Context*)pcx, path); }, - [](void* pcx, std::wstring_view path, FILETIME ft) + [](void* pcx, std::wstring_view path, FILETIME ft, uint64_t) { onFile((Context*)pcx, path, ft); } -- cgit v1.3.1 From da0771853a27eb9e61d32c4326bd8f6af990b7b5 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Thu, 24 Dec 2020 10:59:46 -0500 Subject: added BlueAmulet to contributors (conflict icons) sorted names --- src/aboutdialog.ui | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/aboutdialog.ui b/src/aboutdialog.ui index 7a7627a0..e1f7aef3 100644 --- a/src/aboutdialog.ui +++ b/src/aboutdialog.ui @@ -441,12 +441,17 @@ - DoubleYou + BlueAmulet - Drew Warwick + Bridger + + + + + Brixified @@ -456,12 +461,12 @@ - Bridger + DoubleYou - Brixified + Drew Warwick @@ -536,12 +541,12 @@ - z929669 + thosrtanner - thosrtanner + z929669 -- 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') 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 From 9441d49c6d7dff23395460076112b57d4c0e8743 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Thu, 24 Dec 2020 12:37:19 -0500 Subject: added citrix to checks --- src/sanitychecks.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/sanitychecks.cpp b/src/sanitychecks.cpp index 4833b4a2..1e673ff9 100644 --- a/src/sanitychecks.cpp +++ b/src/sanitychecks.cpp @@ -279,7 +279,8 @@ int checkUsvfsIncompatibilites(const env::Module& m) // these dlls seems to interfere with usvfs static const std::map names = { - {"mactype64.dll", "Mactype"} + {"mactype64.dll", "Mactype"}, + {"epclient64.dll", "Citrix ICA Client"} }; const QFileInfo file(m.path()); @@ -290,7 +291,7 @@ int checkUsvfsIncompatibilites(const env::Module& m) log::warn("{}", QObject::tr( "%1 is loaded. This program is known to cause issues with " "Mod Organizer and its virtual filesystem, such script extenders " - "refusing to run. Consider uninstalling it.") + "or others programs refusing to run. Consider uninstalling it.") .arg(p.second)); log::warn("{}", file.absoluteFilePath()); -- cgit v1.3.1