From 84598cbcbf08862fe02300bf3945b194df12ddfa Mon Sep 17 00:00:00 2001 From: Tannin Date: Mon, 25 Aug 2014 20:12:25 +0200 Subject: - processes spawned from MO are now themselves allowed to break away from the job. Without this the CEF (chromium embedded framework) seems to fail - bugfix: Fixed an error message when installing a fomod wrapped in an archive - bugfix: sorting plugins had no effect on non-skyrim games - bugfix: fomod parser quit installing filelists after one file - bugfix: function retrieving local appdata path read wrong directory --- src/installationmanager.cpp | 6 ++++-- src/mainwindow.cpp | 7 ++++++- src/pluginlist.cpp | 9 +++++---- src/pluginlist.h | 1 + src/shared/gameinfo.cpp | 2 +- src/spawn.cpp | 7 +++++++ 6 files changed, 24 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/installationmanager.cpp b/src/installationmanager.cpp index c865d897..29914b65 100644 --- a/src/installationmanager.cpp +++ b/src/installationmanager.cpp @@ -266,9 +266,11 @@ QStringList InstallationManager::extractFiles(const QStringList &filesOrig, bool IPluginInstaller::EInstallResult InstallationManager::installArchive(GuessedValue &modName, const QString &archiveName) { - GuessedValue temp(modName); + // in earlier versions the modName was copied here and the copy passed to install. I don't know why I did this and it causes + // a problem if this is called by the bundle installer and the bundled installer adds additional names that then end up being used, + // because the caller will then not have the right name. bool iniTweaks; - if (install(archiveName, temp, iniTweaks)) { + if (install(archiveName, modName, iniTweaks)) { return IPluginInstaller::RESULT_SUCCESS; } else { return IPluginInstaller::RESULT_FAILED; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index b28bb47b..0d9fad5d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1426,8 +1426,11 @@ void MainWindow::spawnBinary(const QFileInfo &binary, const QString &arguments, this->setEnabled(true); refreshDirectoryStructure(); + // need to remove our stored load order because it may be outdated if a foreign tool changed the + // file time. After removing that file, refreshESPList will use the file time as the order if (GameInfo::instance().getLoadOrderMechanism() == GameInfo::TYPE_FILETIME) { QFile::remove(m_CurrentProfile->getLoadOrderFileName()); + refreshESPList(); } } } @@ -5595,11 +5598,13 @@ void MainWindow::on_bossButton_clicked() } m_IntegratedBrowser.openUrl(url); } - refreshESPList(); + // if the game specifies load order by file time, our own load order file needs to be removed because it's outdated. + // refreshESPList will then use the file time as the load order. if (GameInfo::instance().getLoadOrderMechanism() == GameInfo::TYPE_FILETIME) { QFile::remove(m_CurrentProfile->getLoadOrderFileName()); } + refreshESPList(); } } diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index 2bc47f9c..f37f9e3a 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -65,13 +65,14 @@ bool ByPriority(const PluginList::ESPInfo& LHS, const PluginList::ESPInfo& RHS) } bool ByDate(const PluginList::ESPInfo& LHS, const PluginList::ESPInfo& RHS) { - QString lhsExtension = LHS.m_Name.right(3).toLower(); + return QFileInfo(LHS.m_FullPath).lastModified() < QFileInfo(RHS.m_FullPath).lastModified(); +/* QString lhsExtension = LHS.m_Name.right(3).toLower(); QString rhsExtension = RHS.m_Name.right(3).toLower(); if (lhsExtension != rhsExtension) { return lhsExtension == "esm"; } - return ::CompareFileTime(&LHS.m_Time, &RHS.m_Time) < 0; + return ::CompareFileTime(&LHS.m_Time, &RHS.m_Time) < 0;*/ } PluginList::PluginList(QObject *parent) @@ -1143,8 +1144,8 @@ bool PluginList::eventFilter(QObject *obj, QEvent *event) PluginList::ESPInfo::ESPInfo(const QString &name, bool enabled, FILETIME time, const QString &originName, const QString &fullPath, bool hasIni) - : m_Name(name), m_Enabled(enabled), m_ForceEnabled(enabled), - m_Priority(0), m_LoadOrder(-1), m_Time(time), m_OriginName(originName), m_HasIni(hasIni) + : m_Name(name), m_FullPath(fullPath), m_Enabled(enabled), m_ForceEnabled(enabled), + m_Priority(0), m_LoadOrder(-1), m_OriginName(originName), m_HasIni(hasIni) { try { ESP::File file(ToWString(fullPath)); diff --git a/src/pluginlist.h b/src/pluginlist.h index b8e141fc..67d1b640 100644 --- a/src/pluginlist.h +++ b/src/pluginlist.h @@ -267,6 +267,7 @@ private: ESPInfo(const QString &name, bool enabled, FILETIME time, const QString &originName, const QString &fullPath, bool hasIni); QString m_Name; + QString m_FullPath; bool m_Enabled; bool m_ForceEnabled; int m_Priority; diff --git a/src/shared/gameinfo.cpp b/src/shared/gameinfo.cpp index f1b72cfb..21e9a586 100644 --- a/src/shared/gameinfo.cpp +++ b/src/shared/gameinfo.cpp @@ -221,7 +221,7 @@ std::wstring GameInfo::getLocalAppFolder() const wchar_t localAppFolder[MAX_PATH]; memset(localAppFolder, '\0', MAX_PATH); - if (::SHGetFolderPathW(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, localAppFolder) == S_OK) { + if (::SHGetFolderPathW(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, localAppFolder) == S_OK) { return localAppFolder; } else { // fallback: try the registry diff --git a/src/spawn.cpp b/src/spawn.cpp index c05049c2..ddcf573e 100644 --- a/src/spawn.cpp +++ b/src/spawn.cpp @@ -117,10 +117,17 @@ HANDLE startBinary(const QFileInfo &binary, HANDLE stdOut, HANDLE stdErr) { + JOBOBJECT_EXTENDED_LIMIT_INFORMATION jobInfo; + + ::QueryInformationJobObject(NULL, JobObjectExtendedLimitInformation, &jobInfo, sizeof(JOBOBJECT_EXTENDED_LIMIT_INFORMATION), NULL); + jobInfo.BasicLimitInformation.LimitFlags |= JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK | JOB_OBJECT_LIMIT_BREAKAWAY_OK; + HANDLE jobObject = ::CreateJobObject(NULL, NULL); if (jobObject == NULL) { qWarning("failed to create job object: %lu", ::GetLastError()); + } else { + ::SetInformationJobObject(jobObject, JobObjectExtendedLimitInformation, &jobInfo, sizeof(JOBOBJECT_EXTENDED_LIMIT_INFORMATION)); } HANDLE processHandle, threadHandle; -- cgit v1.3.1