mirror of
https://github.com/ModOrganizer2/modorganizer-game_fallout76.git
synced 2026-07-27 14:08:28 -07:00
Archive conflicts (#4)
* Necessary changes for querying plugin loadorder for archive sorting * Necessary changes for querying plugin loadorder for archive sorting * Merge fixes for archive parsing * Necessary changes for querying plugin loadorder for archive sorting * Necessary changes for querying plugin loadorder for archive sorting * Merge fixes for archive parsing
This commit is contained in:
@@ -22,6 +22,25 @@ Fallout4GamePlugins::Fallout4GamePlugins(IOrganizer *organizer)
|
||||
{
|
||||
}
|
||||
|
||||
void Fallout4GamePlugins::getLoadOrder(QStringList &loadOrder) {
|
||||
QString loadOrderPath =
|
||||
organizer()->profile()->absolutePath() + "/loadorder.txt";
|
||||
QString pluginsPath = organizer()->profile()->absolutePath() + "/plugins.txt";
|
||||
|
||||
bool loadOrderIsNew = !m_LastRead.isValid() ||
|
||||
!QFileInfo(loadOrderPath).exists() ||
|
||||
QFileInfo(loadOrderPath).lastModified() > m_LastRead;
|
||||
bool pluginsIsNew = !m_LastRead.isValid() ||
|
||||
QFileInfo(pluginsPath).lastModified() > m_LastRead;
|
||||
|
||||
if (loadOrderIsNew || !pluginsIsNew) {
|
||||
loadOrder = readLoadOrderList(m_Organizer->pluginList(), loadOrderPath);
|
||||
}
|
||||
else {
|
||||
loadOrder = readPluginList(m_Organizer->pluginList());
|
||||
}
|
||||
}
|
||||
|
||||
void Fallout4GamePlugins::writePluginList(const IPluginList *pluginList,
|
||||
const QString &filePath) {
|
||||
SafeWriteFile file(filePath);
|
||||
@@ -91,8 +110,7 @@ void Fallout4GamePlugins::writePluginList(const IPluginList *pluginList,
|
||||
}
|
||||
}
|
||||
|
||||
bool Fallout4GamePlugins::readPluginList(MOBase::IPluginList *pluginList,
|
||||
bool useLoadOrder)
|
||||
QStringList Fallout4GamePlugins::readPluginList(MOBase::IPluginList *pluginList)
|
||||
{
|
||||
QStringList plugins = pluginList->pluginNames();
|
||||
QStringList primaryPlugins = organizer()->managedGame()->primaryPlugins();
|
||||
@@ -108,7 +126,7 @@ bool Fallout4GamePlugins::readPluginList(MOBase::IPluginList *pluginList,
|
||||
QFile file(filePath);
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
qWarning("%s not found", qPrintable(filePath));
|
||||
return false;
|
||||
return loadOrder;
|
||||
}
|
||||
ON_BLOCK_EXIT([&]() { file.close(); });
|
||||
|
||||
@@ -116,7 +134,7 @@ bool Fallout4GamePlugins::readPluginList(MOBase::IPluginList *pluginList,
|
||||
// MO stores at least a header in the file. if it's completely empty the
|
||||
// file is broken
|
||||
qWarning("%s empty", qPrintable(filePath));
|
||||
return false;
|
||||
return loadOrder;
|
||||
}
|
||||
|
||||
while (!file.atEnd()) {
|
||||
@@ -161,9 +179,5 @@ bool Fallout4GamePlugins::readPluginList(MOBase::IPluginList *pluginList,
|
||||
pluginList->setState(pluginName, IPluginList::STATE_INACTIVE);
|
||||
}
|
||||
|
||||
if (useLoadOrder) {
|
||||
pluginList->setLoadOrder(loadOrder);
|
||||
}
|
||||
|
||||
return true;
|
||||
return loadOrder;
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@ public:
|
||||
protected:
|
||||
virtual void writePluginList(const MOBase::IPluginList *pluginList,
|
||||
const QString &filePath) override;
|
||||
virtual bool readPluginList(MOBase::IPluginList *pluginList,
|
||||
bool useLoadOrder) override;
|
||||
virtual QStringList readPluginList(MOBase::IPluginList *pluginList) override;
|
||||
virtual void getLoadOrder(QStringList &loadOrder) override;
|
||||
|
||||
private:
|
||||
std::map<QString, QByteArray> m_LastSaveHash;
|
||||
|
||||
Reference in New Issue
Block a user