From 549b84b0f8815737c93913b200dde3821a062cb0 Mon Sep 17 00:00:00 2001 From: SulfurNitride Date: Sat, 16 May 2026 19:51:40 -0500 Subject: mo2: catch up to upstream 2.5.3 Betas 3-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Multi-area sync against the upstream MO2 2.5.3 beta line. Roughly three logical sections share the diff: Catch-up (Betas 3-11): - nxmaccessmanager: drop "supporter" from validRoles so non-premium supporters get the right download path (Beta 10) - mainwindow: disable tutorial triggers at the trigger sites; Qt 6.11 lockup on child windows (Beta 4) - basic_games: add Kingdom Come Deliverance 2, Slay the Spire 2 (Betas 11, 6) - uibase: add NXM collections parsing fields/accessors + (?:nxm|modl) scheme support in NXMUrl (Beta 9) - Starfield: blueprintPrefix() on IPluginGame; plugins.txt write suppression for blueprint plugins; hasInvalidBlueprint / hasUnpairedBlueprint diagnoses; Title-keyed content catalog consolidation (Betas 3-5) - downloadmanager + systemtraymanager + organizercore + iuserinterface + settings: add Beta 11 "show notifications when downloads complete or fail" toggle and the showNotification plumbing - nxmaccessmanager: restore upstream re-entry guard for OAuth refresh and the styled OAuth response page (Beta 11) - organizer_en.ts and game-bethesda *_en.ts: pull upstream HEAD strings Workarounds tab removed: - Delete settingsdialogworkarounds.{h,cpp}; drop the tab in settingsdialog.ui; move "Enable archives parsing" into General - Hardcode GameSettings::forceEnableCoreFiles() to true so the primary-master toggle-off bug (DLCs unchecked on tab refresh) can't recur; setter becomes a no-op - No-op stubs for offlineMode, useProxy, useCustomBrowser, Steam appID/credentials, executablesBlacklist, skipFileSuffixes, skipDirectories — UI gone, accessors keep call sites green - settingsdialognexus drops the custom-browser wiring; spawn drops the "Change the blacklist" Retry path Beta 9 download manager port: - fileID-first match in nxmFilesAvailable and nxmFileInfoFromMd5Available; filename remains the fallback - NexusInterface::isActiveFileStatus() helper; rewrite of nxmUpdatesAvailable to use pickNewestVersion / findUpdateChainSuccessors / resolveInstalledFileId. ARCHIVED_HIDDEN now correctly treated as inactive - std::optional reservedID on DownloadInfo factories and on the three addDownload overloads; startDownloadURLs and startDownloadURLWithMeta return the canonical DownloadID instead of m_ActiveDownloads.size()-1 (which was the index, not an ID) - QHash m_ByID maintained alongside m_ActiveDownloads at every mutation site; downloadInfoByID is now O(1) via m_ByID.value(id, nullptr) LOOT remains intentionally stripped (lootcli build cruft cleaned up separately). BSA wide-path skipped — Linux UTF-8 paths already work. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../src/games/starfield/gamestarfield.cpp | 66 ++++++++++++++++++- .../src/games/starfield/starfieldgameplugins.cpp | 74 +++++++++++++++++++++- .../src/games/starfield/starfieldunmanagedmods.cpp | 65 ++++++++++++------- 3 files changed, 178 insertions(+), 27 deletions(-) (limited to 'libs/game_bethesda/src/*.cpp') diff --git a/libs/game_bethesda/src/games/starfield/gamestarfield.cpp b/libs/game_bethesda/src/games/starfield/gamestarfield.cpp index ebec948..06a6d79 100644 --- a/libs/game_bethesda/src/games/starfield/gamestarfield.cpp +++ b/libs/game_bethesda/src/games/starfield/gamestarfield.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -337,15 +338,23 @@ QStringList GameStarfield::CCPlugins() const // as Creations. The StarfieldUnmanagedMods class handles parsing mod names and files. if (unmanagedMods.get()) { auto contentCatalog = unmanagedMods->parseContentCatalog(); - for (const auto& mod : contentCatalog) { - if (!plugins.contains(mod.first, Qt::CaseInsensitive)) { - plugins.append(mod.first); + for (auto& mod : contentCatalog) { + QStringList pluginFiles = mod.second.files.filter(QRegularExpression( + "\\.es(m|p|l)$", QRegularExpression::CaseInsensitiveOption)); + if (!pluginFiles.isEmpty()) { + plugins += pluginFiles; } } } + plugins.removeDuplicates(); return plugins; } +QString GameStarfield::blueprintPrefix() const +{ + return "blueprintships-"; +} + IPluginGame::SortMechanism GameStarfield::sortMechanism() const { return IPluginGame::SortMechanism::LOOT; @@ -380,6 +389,10 @@ std::vector GameStarfield::activeProblems() const if (testFilePresent()) result.push_back(PROBLEM_TEST_FILE); } + if (hasInvalidBlueprint()) + result.push_back(PROBLEM_INVALID_BLUEPRINT); + if (hasUnpairedBlueprint()) + result.push_back(PROBLEM_UNPAIRED_BLUEPRINT); } return result; } @@ -412,6 +425,38 @@ bool GameStarfield::testFilePresent() const return false; } +bool GameStarfield::hasInvalidBlueprint() const +{ + auto plugins = m_Organizer->pluginList()->pluginNames(); + for (auto plugin : plugins) { + if (m_Organizer->pluginList()->isBlueprintFlagged(plugin)) { + if (!plugin.startsWith(blueprintPrefix(), Qt::CaseInsensitive) || + !m_Organizer->pluginList()->hasMasterExtension(plugin)) + return true; + } else if (plugin.startsWith(blueprintPrefix(), Qt::CaseInsensitive)) { + return true; + } + } + return false; +} + +bool GameStarfield::hasUnpairedBlueprint() const +{ + auto plugins = m_Organizer->pluginList()->pluginNames(); + for (auto plugin : plugins) { + if (plugin.startsWith(blueprintPrefix(), Qt::CaseInsensitive) && + m_Organizer->pluginList()->hasMasterExtension(plugin)) { + QString parent = plugin.mid(blueprintPrefix().size(), + plugin.size() - blueprintPrefix().size() - 4); + auto mainPlugin = plugins.filter(QRegularExpression( + "^" + parent + "\\.es(m|p|l)$", QRegularExpression::CaseInsensitiveOption)); + if (mainPlugin.isEmpty()) + return true; + } + } + return false; +} + QString GameStarfield::shortDescription(unsigned int key) const { switch (key) { @@ -419,6 +464,10 @@ QString GameStarfield::shortDescription(unsigned int key) const return tr("You have active ESP plugins in Starfield"); case PROBLEM_TEST_FILE: return tr("sTestFile entries are present"); + case PROBLEM_INVALID_BLUEPRINT: + return tr("Invalid blueprint plugins found"); + case PROBLEM_UNPAIRED_BLUEPRINT: + return tr("Unpaired blueprint plugins found"); } return ""; } @@ -446,6 +495,17 @@ QString GameStarfield::fullDescription(unsigned int key) const "settings in your StarfieldCustom.ini. These must be removed or the game " "will not read the plugins.txt file. Management is still disabled.

"); } + case PROBLEM_INVALID_BLUEPRINT: + return tr( + "

You have a blueprint file that is invalid. Blueprints require the " + "blueprint flag and prefix and must have the ESM extension to be valid.

"); + case PROBLEM_UNPAIRED_BLUEPRINT: + return tr( + "

You have a valid blueprint file that has no paired main plugin. The only " + "way to load blueprint files is by enabling a main plugin with the same base " + "name. This is the part after the prefix and before the extension.

eg. " + "BlueprintShips-example.esm should have a paired main plugin " + "example.esm

"); } return ""; } diff --git a/libs/game_bethesda/src/games/starfield/starfieldgameplugins.cpp b/libs/game_bethesda/src/games/starfield/starfieldgameplugins.cpp index 6b4e6ab..efd1bad 100644 --- a/libs/game_bethesda/src/games/starfield/starfieldgameplugins.cpp +++ b/libs/game_bethesda/src/games/starfield/starfieldgameplugins.cpp @@ -1,5 +1,9 @@ #include "starfieldgameplugins.h" +#include +#include +#include + using namespace MOBase; StarfieldGamePlugins::StarfieldGamePlugins(MOBase::IOrganizer* organizer) @@ -19,10 +23,76 @@ bool StarfieldGamePlugins::blueprintPluginsAreSupported() void StarfieldGamePlugins::writePluginList(const IPluginList* pluginList, const QString& filePath) { - if (m_Organizer->managedGame()->loadOrderMechanism() == + if (m_Organizer->managedGame()->loadOrderMechanism() != MOBase::IPluginGame::LoadOrderMechanism::PluginsTxt) { - CreationGamePlugins::writePluginList(pluginList, filePath); + return; + } + + SafeWriteFile file(filePath); + + QStringEncoder encoder(QStringConverter::Encoding::System); + + file->resize(0); + + file->write(encoder.encode( + "# This file was automatically generated by Mod Organizer.\r\n")); + + bool invalidFileNames = false; + int writtenCount = 0; + + QStringList plugins = pluginList->pluginNames(); + std::sort(plugins.begin(), plugins.end(), + [pluginList](const QString& lhs, const QString& rhs) { + return pluginList->priority(lhs) < pluginList->priority(rhs); + }); + + QStringList PrimaryPlugins = organizer()->managedGame()->primaryPlugins(); + QStringList DLCPlugins = organizer()->managedGame()->DLCPlugins(); + QSet ManagedMods = + QSet(PrimaryPlugins.begin(), PrimaryPlugins.end()); + QSet DLCSet = QSet(DLCPlugins.begin(), DLCPlugins.end()); + ManagedMods.subtract(DLCSet); + PrimaryPlugins.append(QList(ManagedMods.begin(), ManagedMods.end())); + + // TODO: do not write plugins in OFFICIAL_FILES container + for (const QString& pluginName : plugins) { + if (!PrimaryPlugins.contains(pluginName, Qt::CaseInsensitive) && + !pluginList->isBlueprintFlagged(pluginName) && + !pluginName.startsWith(m_Organizer->managedGame()->blueprintPrefix(), + Qt::CaseInsensitive)) { + if (pluginList->state(pluginName) == IPluginList::STATE_ACTIVE) { + auto result = encoder.encode(pluginName); + if (encoder.hasError()) { + invalidFileNames = true; + qCritical("invalid plugin name %s", qUtf8Printable(pluginName)); + } else { + file->write("*"); + file->write(result); + } + file->write("\r\n"); + ++writtenCount; + } else { + auto result = encoder.encode(pluginName); + if (encoder.hasError()) { + invalidFileNames = true; + qCritical("invalid plugin name %s", qUtf8Printable(pluginName)); + } else { + file->write(result); + } + file->write("\r\n"); + ++writtenCount; + } + } } + + if (invalidFileNames) { + reportError(QObject::tr("Some of your plugins have invalid names! These " + "plugins can not be loaded by the game. Please see " + "mo_interface.log for a list of affected plugins " + "and rename them.")); + } + + file->commit(); } QStringList StarfieldGamePlugins::readPluginList(MOBase::IPluginList* pluginList) diff --git a/libs/game_bethesda/src/games/starfield/starfieldunmanagedmods.cpp b/libs/game_bethesda/src/games/starfield/starfieldunmanagedmods.cpp index 30abb38..82207c3 100644 --- a/libs/game_bethesda/src/games/starfield/starfieldunmanagedmods.cpp +++ b/libs/game_bethesda/src/games/starfield/starfieldunmanagedmods.cpp @@ -9,7 +9,7 @@ StarfieldUnmanagedMods::StarfieldUnmanagedMods(const GameStarfield* game, const QString& appDataFolder) - : GamebryoUnmangedMods(game), m_AppDataFolder(appDataFolder) + : GamebryoUnmangedMods(game), m_Game(game), m_AppDataFolder(appDataFolder) {} StarfieldUnmanagedMods::~StarfieldUnmanagedMods() {} @@ -25,29 +25,52 @@ QStringList StarfieldUnmanagedMods::mods(bool onlyOfficial) const pluginList.removeAll(plugin); } QMap directories = {{"data", game()->dataDirectory()}}; + auto contentCatalog = parseContentCatalog(); directories.insert(game()->secondaryDataDirectories()); for (QDir directory : directories) { for (const QString& fileName : directory.entryList({"*.esp", "*.esl", "*.esm"})) { if (!pluginList.contains(fileName, Qt::CaseInsensitive)) { if (!onlyOfficial || pluginList.contains(fileName, Qt::CaseInsensitive)) { - result.append(fileName.chopped(4)); // trims the extension off + bool found = false; + for (const auto& mod : contentCatalog) { + if (mod.second.files.contains(fileName, Qt::CaseInsensitive)) { + result.append(mod.second.name); + found = true; + } + } + if (!found && !fileName.startsWith("blueprintships-", Qt::CaseInsensitive)) { + result.append(fileName.chopped(4)); // trims the extension off + } } } } } - + result.removeDuplicates(); return result; } QFileInfo StarfieldUnmanagedMods::referenceFile(const QString& modName) const { - QFileInfoList files; + QStringList modFiles; + auto contentCatalog = parseContentCatalog(); + if (contentCatalog.contains(modName)) { + modFiles = contentCatalog[modName].files; + } + QDir dataDir = m_Game->secondaryDataDirectories().first(); + QStringList plugins = modFiles.filter( + QRegularExpression("\\.es(m|p|l)$", QRegularExpression::CaseInsensitiveOption)); QMap directories = {{"data", game()->dataDirectory()}}; directories.insert(game()->secondaryDataDirectories()); + QFileInfoList pluginFiles; + QFileInfoList files; for (QDir directory : directories) { + if (!plugins.isEmpty()) + pluginFiles += dataDir.entryInfoList(plugins); files += directory.entryInfoList(QStringList() << modName + ".es*"); } - if (files.size() > 0) { + if (!pluginFiles.isEmpty()) { + return pluginFiles.at(0); + } else if (!files.isEmpty()) { return files.at(0); } else { return QFileInfo(); @@ -86,11 +109,10 @@ StarfieldUnmanagedMods::parseContentCatalog() const pluginList.append(fileName); } } - for (const auto& plugin : pluginList) { - contentCatalog[plugin] = ContentCatalog(); - contentCatalog[plugin].files = files; - contentCatalog[plugin].name = modInfo.value("Title").toString(); - } + QString name = modInfo.value("Title").toString(); + contentCatalog[name] = ContentCatalog(); + contentCatalog[name].files = files; + contentCatalog[name].name = name; } } } @@ -101,17 +123,16 @@ QStringList StarfieldUnmanagedMods::secondaryFiles(const QString& modName) const { QStringList files; auto contentCatalog = parseContentCatalog(); - for (const auto& mod : contentCatalog) { - if (mod.first.startsWith(modName, Qt::CaseInsensitive)) { - files += mod.second.files; - break; - } + if (contentCatalog.contains(modName)) { + return contentCatalog[modName].files; } // file extension in FO4 is .ba2 instead of bsa QMap directories = {{"data", game()->dataDirectory()}}; directories.insert(game()->secondaryDataDirectories()); for (QDir directory : directories) { - for (const QString& archiveName : directory.entryList({modName + "*.ba2"})) { + for (const QString& archiveName : + directory.entryList({modName + "*.ba2", "blueprintships-" + modName + ".esm", + "blueprintships-" + modName + "*.ba2"})) { files.append(directory.absoluteFilePath(archiveName)); } } @@ -121,12 +142,12 @@ QStringList StarfieldUnmanagedMods::secondaryFiles(const QString& modName) const QString StarfieldUnmanagedMods::displayName(const QString& modName) const { auto contentCatalog = parseContentCatalog(); - for (const auto& mod : contentCatalog) { - if (mod.first.startsWith(modName, Qt::CaseInsensitive)) { - return mod.second.name; - } + if (contentCatalog.contains(modName)) { + return contentCatalog[modName].name; } - // unlike in earlier games, in fallout 4 the file name doesn't correspond to - // the public name + if (modName == "ShatteredSpace") + return "Shattered Space"; + else if (modName == "SFBGS050") + return "Terran Armada"; return modName; } -- cgit v1.3.1