diff options
| author | Tannin <devnull@localhost> | 2013-09-16 22:32:42 +0200 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2013-09-16 22:32:42 +0200 |
| commit | 500ab7f706bdc8d4eb94db22ab60f882b2670dde (patch) | |
| tree | c035d4e2399d7426008d840b5af50d166dd814a7 /src | |
| parent | 08309b71ba45eb4e5bc632c2687e320be70e04de (diff) | |
- bugfix: testing for missing masters at the wrong time seems to have caused crashes
- bugfix: mod list is now written to a temporary file first. Only on success is the original file overwritten
- bugfix: moving a mod priority to just above the overwrite could cause a crash or error message
- bugfix: versions with a release candidate number weren't sorted correctly (woops)
- bugfix: staging script didn't include archive.dll and dlls.manifest
- installation time on overwrite no longer updates constantly
Diffstat (limited to 'src')
| -rw-r--r-- | src/mainwindow.ui | 2 | ||||
| -rw-r--r-- | src/modinfo.cpp | 2 | ||||
| -rw-r--r-- | src/modinfo.h | 6 | ||||
| -rw-r--r-- | src/pluginlist.cpp | 15 | ||||
| -rw-r--r-- | src/profile.cpp | 86 | ||||
| -rw-r--r-- | src/version.rc | 4 |
6 files changed, 72 insertions, 43 deletions
diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 54611235..923df17c 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -786,7 +786,7 @@ BSAs checked here are loaded in such a way that your installation order is obeye <item>
<widget class="QLabel" name="bsaWarning">
<property name="text">
- <string><html><head/><body><p>Marked Archives (<img src=":/MO/gui/resources/dialog-warning_16.png"/>) are still loaded on Skyrim but the <a href="http://forums.bethsoft.com/topic/1354395-update-bsas-and-you/"><span style=" text-decoration: underline; color:#0000ff;">regular file override</span></a> mechanism will apply: Loose files override BSAs, no matter the mod/plugin priority.</p></body></html></string>
+ <string><html><head/><body><p>Marked Archives (<img src=":/MO/gui/warning_16"/>) are still loaded on Skyrim but the <a href="http://forums.bethsoft.com/topic/1354395-update-bsas-and-you/"><span style=" text-decoration: underline; color:#0000ff;">regular file override</span></a> mechanism will apply: Loose files override BSAs, no matter the mod/plugin priority.</p></body></html></string>
</property>
<property name="wordWrap">
<bool>true</bool>
diff --git a/src/modinfo.cpp b/src/modinfo.cpp index 8372af55..166c815b 100644 --- a/src/modinfo.cpp +++ b/src/modinfo.cpp @@ -792,9 +792,9 @@ ModInfoBackup::ModInfoBackup(const QDir &path, DirectoryEntry **directoryStructu ModInfoOverwrite::ModInfoOverwrite() + : m_StartupTime(QDateTime::currentDateTime()) { testValid(); - } diff --git a/src/modinfo.h b/src/modinfo.h index df948a76..7e217de7 100644 --- a/src/modinfo.h +++ b/src/modinfo.h @@ -811,7 +811,7 @@ public: virtual void endorse(bool) {} virtual QString name() const { return "Overwrite"; } virtual QString notes() const { return ""; } - virtual QDateTime creationTime() const { return QDateTime::currentDateTime(); } + virtual QDateTime creationTime() const { return m_StartupTime; } virtual QString absolutePath() const; virtual MOBase::VersionInfo getNewestVersion() const { return ""; } virtual QString getInstallationFile() const { return ""; } @@ -828,6 +828,10 @@ private: ModInfoOverwrite(); +private: + + QDateTime m_StartupTime; + }; #endif // MODINFO_H diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index f73805fd..ea23fcdd 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -594,6 +594,8 @@ int PluginList::columnCount(const QModelIndex &) const void PluginList::testMasters() { +// emit layoutAboutToBeChanged(); + std::set<QString> enabledMasters; for (auto iter = m_ESPs.begin(); iter != m_ESPs.end(); ++iter) { if (iter->m_Enabled) { @@ -613,7 +615,8 @@ void PluginList::testMasters() } } - emit layoutChanged(); +#pragma message("emitting this seems to cause a crash!") +// emit layoutChanged(); } @@ -738,18 +741,18 @@ void PluginList::setPluginPriority(int row, int &newPriority) if (!m_ESPs[row].m_IsMaster) { // don't allow esps to be moved above esms while ((newPriorityTemp < static_cast<int>(m_ESPsByPriority.size() - 1)) && - m_ESPs[m_ESPsByPriority[newPriorityTemp]].m_IsMaster) { + m_ESPs.at(m_ESPsByPriority.at(newPriorityTemp)).m_IsMaster) { ++newPriorityTemp; } } else { // don't allow esms to be moved below esps while ((newPriorityTemp > 0) && - !m_ESPs[m_ESPsByPriority[newPriorityTemp]].m_IsMaster) { + !m_ESPs.at(m_ESPsByPriority.at(newPriorityTemp)).m_IsMaster) { --newPriorityTemp; } // also don't allow "regular" esms to be moved above primary plugins while ((newPriorityTemp < static_cast<int>(m_ESPsByPriority.size() - 1)) && - (m_ESPs[m_ESPsByPriority[newPriorityTemp]].m_ForceEnabled)) { + (m_ESPs.at(m_ESPsByPriority.at(newPriorityTemp)).m_ForceEnabled)) { ++newPriorityTemp; } } @@ -806,9 +809,9 @@ void PluginList::changePluginPriority(std::vector<int> rows, int newPriority) } refreshLoadOrder(); - startSaveTime(); - emit layoutChanged(); + + startSaveTime(); } diff --git a/src/profile.cpp b/src/profile.cpp index a6d8f49d..330bfa09 100644 --- a/src/profile.cpp +++ b/src/profile.cpp @@ -30,6 +30,8 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include <QMessageBox> #include <QApplication> #include <QSettings> +#include <QTemporaryFile> + #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <shlobj.h> @@ -146,38 +148,56 @@ void Profile::writeModlistNow(bool onlyOnTimer) const if (!m_Directory.exists()) return; #pragma message("right now, this is doing unnecessary saves. Need a flag that says that mod priority, enabled-state or name of a mod has changed") - QString fileName = getModlistFileName(); - QFile file(fileName); - if (!file.open(QIODevice::WriteOnly)) { - reportError(tr("failed to open \"%1\" for writing").arg(fileName)); - return; - } + try { + QTemporaryFile file; - file.resize(0); - file.write(QString("# This file was automatically generated by Mod Organizer.\r\n").toUtf8()); - if (m_ModStatus.empty()) { - return; - } + if (!file.open()) { + reportError(tr("failed to open temporary file")); + return; + } - for (int i = m_ModStatus.size() - 1; i >= 0; --i) { - // the priority order was inverted on load so it has to be inverted again - unsigned int index = m_ModIndexByPriority[i]; - if (index != UINT_MAX) { - ModInfo::Ptr modInfo = ModInfo::getByIndex(index); - if (modInfo->getFixedPriority() == INT_MIN) { - if (m_ModStatus[index].m_Enabled) { - file.write("+"); - } else { - file.write("-"); + file.resize(0); + file.write(QString("# This file was automatically generated by Mod Organizer.\r\n").toUtf8()); + if (m_ModStatus.empty()) { + return; + } + + for (int i = m_ModStatus.size() - 1; i >= 0; --i) { + // the priority order was inverted on load so it has to be inverted again + unsigned int index = m_ModIndexByPriority[i]; + if (index != UINT_MAX) { + ModInfo::Ptr modInfo = ModInfo::getByIndex(index); + if (modInfo->getFixedPriority() == INT_MIN) { + if (m_ModStatus[index].m_Enabled) { + file.write("+"); + } else { + file.write("-"); + } + file.write(modInfo->name().toUtf8()); + file.write("\r\n"); } - file.write(modInfo->name().toUtf8()); - file.write("\r\n"); } } - } - file.close(); - qDebug("%s saved", QDir::toNativeSeparators(fileName).toUtf8().constData()); + file.close(); + + + QString fileName = getModlistFileName(); + + if (QFile::exists(fileName)) { + shellDelete(QStringList(fileName)); + } + + if (!file.copy(fileName)) { + reportError(tr("failed to open \"%1\" for writing").arg(fileName)); + return; + } + + qDebug("%s saved", QDir::toNativeSeparators(fileName).toUtf8().constData()); + } catch (const std::exception &e) { + reportError(tr("failed to write mod list: %1").arg(e.what())); + return; + } } @@ -331,6 +351,7 @@ void Profile::updateIndices() for (unsigned int i = 0; i < m_ModStatus.size(); ++i) { int priority = m_ModStatus[i].m_Priority; if (priority < 0) { + // don't assign this to mapping at all, it's probably the overwrite mod continue; } else if (priority >= static_cast<int>(m_ModIndexByPriority.size())) { qCritical("invalid priority %d for mod", priority); @@ -418,7 +439,7 @@ int Profile::getModPriority(unsigned int index) const void Profile::setModPriority(unsigned int index, int &newPriority) { - if (m_ModStatus[index].m_Overwrite) { + if (m_ModStatus.at(index).m_Overwrite) { // can't change priority of the overwrite return; } @@ -426,24 +447,25 @@ void Profile::setModPriority(unsigned int index, int &newPriority) int newPriorityTemp = (std::max)(0, (std::min<int>)(m_ModStatus.size() - 1, newPriority)); // don't try to place below overwrite - while (m_ModStatus[m_ModIndexByPriority[newPriorityTemp]].m_Overwrite) { + while ((m_ModIndexByPriority.at(newPriorityTemp) >= m_ModStatus.size()) || + m_ModStatus.at(m_ModIndexByPriority.at(newPriorityTemp)).m_Overwrite) { --newPriorityTemp; } - int oldPriority = m_ModStatus[index].m_Priority; + int oldPriority = m_ModStatus.at(index).m_Priority; if (newPriorityTemp > oldPriority) { // priority is higher than the old, so the gap we left is in lower priorities for (int i = oldPriority + 1; i <= newPriorityTemp; ++i) { - --m_ModStatus[m_ModIndexByPriority[i]].m_Priority; + --m_ModStatus.at(m_ModIndexByPriority.at(i)).m_Priority; } } else { for (int i = newPriorityTemp; i < oldPriority; ++i) { - ++m_ModStatus[m_ModIndexByPriority[i]].m_Priority; + ++m_ModStatus.at(m_ModIndexByPriority.at(i)).m_Priority; } ++newPriority; } - m_ModStatus[index].m_Priority = newPriorityTemp; + m_ModStatus.at(index).m_Priority = newPriorityTemp; updateIndices(); writeModlist(); diff --git a/src/version.rc b/src/version.rc index fb8dcf7c..7e988897 100644 --- a/src/version.rc +++ b/src/version.rc @@ -1,7 +1,7 @@ #include "Winver.h"
-#define VER_FILEVERSION 0,99,7,0
-#define VER_FILEVERSION_STR "0,99,7,0\0"
+#define VER_FILEVERSION 1,0,0,1
+#define VER_FILEVERSION_STR "1,0,0,1\0"
VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION
|
