From 817e329fca895be37e41849db4b569cd1386731e Mon Sep 17 00:00:00 2001 From: Dave Corley Date: Thu, 29 Feb 2024 00:13:43 -0600 Subject: [PATCH] Support openmw file types --- src/mainwindow.cpp | 4 +++- src/modinfodialogesps.cpp | 3 ++- src/organizercore.cpp | 35 +++++++++++++++++++++++++++++++++++ src/pluginlist.cpp | 8 ++++++-- 4 files changed, 46 insertions(+), 4 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 2c62e7319..3d51d9292 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1930,7 +1930,9 @@ void MainWindow::updateBSAList(const QStringList& defaultArchives, m_OrganizerCore.findFiles("", [](const QString& fileName) -> bool { return fileName.endsWith(".esp", Qt::CaseInsensitive) || fileName.endsWith(".esm", Qt::CaseInsensitive) || - fileName.endsWith(".esl", Qt::CaseInsensitive); + fileName.endsWith(".esl", Qt::CaseInsensitive) || + fileName.endsWith(".omwaddon", Qt::CaseInsensitive) || + fileName.endsWith(".omwscripts", Qt::CaseInsensitive); }); auto hasAssociatedPlugin = [&](const QString& bsaName) -> bool { diff --git a/src/modinfodialogesps.cpp b/src/modinfodialogesps.cpp index f9a3ba8c8..09d8aea1f 100644 --- a/src/modinfodialogesps.cpp +++ b/src/modinfodialogesps.cpp @@ -217,7 +217,8 @@ void ESPsTab::clear() bool ESPsTab::feedFile(const QString& rootPath, const QString& fullPath) { - static const QString extensions[] = {".esp", ".esm", ".esl"}; + static const QString extensions[] = {".esp", ".esm", ".esl", ".omwaddon", + ".omwscripts"}; for (const auto& e : extensions) { if (fullPath.endsWith(e, Qt::CaseInsensitive)) { diff --git a/src/organizercore.cpp b/src/organizercore.cpp index 5bc3851cc..940d56efe 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -1346,6 +1346,41 @@ void OrganizerCore::updateModsActiveState(const QList& modIndices, ++enabled; } } + + QStringList omwaddons = dir.entryList(QStringList() << "*.omwaddon", QDir::Files); + for (const QString& omwaddon : omwaddons) { + const FileEntryPtr file = m_DirectoryStructure->findFile(ToWString(omwaddon)); + if (file.get() == nullptr) { + log::warn("failed to activate {}", omwaddon); + continue; + } + + if (active != m_PluginList.isEnabled(omwaddon) && + file->getAlternatives().empty()) { + m_PluginList.blockSignals(true); + m_PluginList.enableESP(omwaddon, active); + m_PluginList.blockSignals(false); + ++enabled; + } + } + + QStringList omwscripts = + dir.entryList(QStringList() << "*.omwscripts", QDir::Files); + for (const QString& omwscript : omwscripts) { + const FileEntryPtr file = m_DirectoryStructure->findFile(ToWString(omwscript)); + if (file.get() == nullptr) { + log::warn("failed to activate {}", omwscript); + continue; + } + + if (active != m_PluginList.isEnabled(omwscript) && + file->getAlternatives().empty()) { + m_PluginList.blockSignals(true); + m_PluginList.enableESP(omwscript, active); + m_PluginList.blockSignals(false); + ++enabled; + } + } } if (active && (enabled > 1)) { MessageDialog::showMessage( diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index da63d9343..4753c0ab4 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -134,7 +134,9 @@ void PluginList::highlightPlugins(const std::vector& modIndices, QDir dir(selectedMod->absolutePath()); QStringList plugins = dir.entryList(QStringList() << "*.esp" << "*.esm" - << "*.esl"); + << "*.esl" + << "*.omwaddon" + << "*.omwscripts"); const MOShared::FilesOrigin& origin = directoryEntry.getOriginByName(selectedMod->internalName().toStdWString()); if (plugins.size() > 0) { @@ -196,7 +198,9 @@ void PluginList::refresh(const QString& profileName, if (filename.endsWith(".esp", Qt::CaseInsensitive) || filename.endsWith(".esm", Qt::CaseInsensitive) || - filename.endsWith(".esl", Qt::CaseInsensitive)) { + filename.endsWith(".esl", Qt::CaseInsensitive) || + filename.endsWith(".omwaddon", Qt::CaseInsensitive) || + filename.endsWith(".omwscripts", Qt::CaseInsensitive)) { availablePlugins.append(filename);