diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/createinstancedialogpages.cpp | 46 | ||||
| -rw-r--r-- | src/createinstancedialogpages.h | 9 | ||||
| -rw-r--r-- | src/sanitychecks.cpp | 3 |
3 files changed, 56 insertions, 2 deletions
diff --git a/src/createinstancedialogpages.cpp b/src/createinstancedialogpages.cpp index 09026fa4..6173335a 100644 --- a/src/createinstancedialogpages.cpp +++ b/src/createinstancedialogpages.cpp @@ -293,7 +293,7 @@ void GamePage::select(IPluginGame* game, const QString& dir) Game* checked = findGame(game); if (checked) { - if (!checked->installed) { + if (!checked->installed || (detectMicrosoftStore(checked->dir) && !confirmMicrosoftStore(checked->dir, checked->game))) { if (dir.isEmpty()) { // the selected game has no installation directory and none was given, // ask the user @@ -305,6 +305,9 @@ void GamePage::select(IPluginGame* game, const QString& dir) if (path.isEmpty()) { // cancelled checked = nullptr; + } else if (detectMicrosoftStore(path) && !confirmMicrosoftStore(path, game)) { + // cancelled + checked = nullptr; } else { // check whether a plugin supports the given directory; this can // return the same plugin, a different one, or null @@ -354,6 +357,13 @@ void GamePage::selectCustom() return; } + // Microsoft store games are not supported + if (detectMicrosoftStore(path) && !confirmMicrosoftStore(path, nullptr)) { + // reselect the previous button + selectButton(m_selection); + return; + } + // try to find a plugin that likes this directory for (auto& g : m_games) { if (g->game->looksValid(path)) { @@ -594,6 +604,11 @@ GamePage::Game* GamePage::checkInstallation(const QString& path, Game* g) return g; } + if (detectMicrosoftStore(path) && confirmMicrosoftStore(path, g->game)) { + // okay + return g; + } + // the selected game can't use that folder, find another one IPluginGame* otherGame = nullptr; @@ -640,6 +655,35 @@ GamePage::Game* GamePage::checkInstallation(const QString& path, Game* g) return g; } +bool GamePage::detectMicrosoftStore(const QString& path) +{ + return path.contains("/ModifiableWindowsApps/") || + path.contains("/WindowsApps/"); +} + +bool GamePage::confirmMicrosoftStore(const QString& path, IPluginGame* game) +{ + const auto r = TaskDialog(&m_dlg) + .title(QObject::tr("Microsoft Store game")) + .main(QObject::tr("Microsoft Store game")) + .content(QObject::tr( + "The folder %1 seems to be a Microsoft Store game install. Games" + " installed through the Microsoft Store are not supported by Mod Organizer" + " and will not work properly.") + .arg(path)) + .button({ + game ? QObject::tr("Use this folder for %1").arg(game->gameName()) + : QObject::tr("Use this folder"), + QObject::tr("I know what I'm doing"), + QMessageBox::Ignore}) + .button({ + QObject::tr("Cancel"), + QMessageBox::Cancel}) + .exec(); + + return (r == QMessageBox::Ignore); +} + bool GamePage::confirmUnknown(const QString& path, IPluginGame* game) { const auto r = TaskDialog(&m_dlg) diff --git a/src/createinstancedialogpages.h b/src/createinstancedialogpages.h index 08953a74..7237bfb2 100644 --- a/src/createinstancedialogpages.h +++ b/src/createinstancedialogpages.h @@ -354,6 +354,15 @@ private: MOBase::IPluginGame* confirmOtherGame( const QString& path, MOBase::IPluginGame* selectedGame, MOBase::IPluginGame* guessedGame); + + // detects if the given path likely contains a Microsoft Store game + // + bool detectMicrosoftStore(const QString& path); + + // tells the user that the path probably contains a Microsoft Store game that + // is not supported, returns true if the user decides to accept anyway. + // + bool confirmMicrosoftStore(const QString& path, MOBase::IPluginGame* game); }; diff --git a/src/sanitychecks.cpp b/src/sanitychecks.cpp index 637cd83f..2f7126ea 100644 --- a/src/sanitychecks.cpp +++ b/src/sanitychecks.cpp @@ -389,7 +389,8 @@ int checkMicrosoftStore(const QDir& gameDir) for (auto badPath : pathsToCheck) { if (gameDir.path().contains(badPath)) { - log::warn("the game is installed with the Microsoft Store / Gamepass and is not supported"); + log::error("This game is not supported by Mod Organizer."); + log::error("Games installed through the Microsoft Store will not work properly."); return 1; } } |
