aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/basic_games/games/game_stardewvalley.py36
-rw-r--r--libs/plugin_python/src/mobase/wrappers/pyplugins.cpp1
-rw-r--r--libs/plugin_python/src/mobase/wrappers/pyplugins.h4
-rw-r--r--libs/uibase/include/uibase/iplugingame.h9
-rw-r--r--src/src/executableslist.cpp11
5 files changed, 58 insertions, 3 deletions
diff --git a/libs/basic_games/games/game_stardewvalley.py b/libs/basic_games/games/game_stardewvalley.py
index 6397b40..566a511 100644
--- a/libs/basic_games/games/game_stardewvalley.py
+++ b/libs/basic_games/games/game_stardewvalley.py
@@ -1,4 +1,6 @@
-from PyQt6.QtCore import QFileInfo
+import sys
+
+from PyQt6.QtCore import QDir, QFileInfo
import mobase
@@ -21,6 +23,17 @@ class StardewValleyModDataChecker(mobase.ModDataChecker):
return mobase.ModDataChecker.INVALID
+def _has_native_linux_install(game_dir: QDir) -> bool:
+ # Native Linux Stardew ships a `StardewValley` shell-script launcher and
+ # has no `Stardew Valley.exe`. Use that to distinguish from a Windows
+ # install dropped under a Wine prefix.
+ if sys.platform != "linux":
+ return False
+ if QFileInfo(game_dir, "Stardew Valley.exe").exists():
+ return False
+ return QFileInfo(game_dir, "StardewValley").exists()
+
+
class StardewValleyGame(BasicGame):
Name = "Stardew Valley Support Plugin"
Author = "Syer10"
@@ -33,7 +46,7 @@ class StardewValleyGame(BasicGame):
GameSteamId = 413150
GameGogId = 1453375253
GameBinary = "Stardew Valley.exe"
- GameDataPath = "mods"
+ GameDataPath = "Mods"
GameDocumentsDirectory = "%DOCUMENTS%/StardewValley"
GameSavesDirectory = "%GAME_DOCUMENTS%/Saves"
GameSupportURL = (
@@ -46,7 +59,26 @@ class StardewValleyGame(BasicGame):
self._register_feature(StardewValleyModDataChecker())
return True
+ def isNativeLinux(self) -> bool:
+ return _has_native_linux_install(self.gameDirectory())
+
+ def binaryName(self) -> str:
+ if self.isNativeLinux():
+ return "StardewValley"
+ return super().binaryName()
+
def executables(self):
+ if self.isNativeLinux():
+ return [
+ mobase.ExecutableInfo(
+ "SMAPI",
+ QFileInfo(self.gameDirectory(), "StardewModdingAPI"),
+ ),
+ mobase.ExecutableInfo(
+ "Stardew Valley",
+ QFileInfo(self.gameDirectory(), "StardewValley"),
+ ),
+ ]
return [
mobase.ExecutableInfo(
"SMAPI", QFileInfo(self.gameDirectory(), "StardewModdingAPI.exe")
diff --git a/libs/plugin_python/src/mobase/wrappers/pyplugins.cpp b/libs/plugin_python/src/mobase/wrappers/pyplugins.cpp
index bcce0df..c744c7b 100644
--- a/libs/plugin_python/src/mobase/wrappers/pyplugins.cpp
+++ b/libs/plugin_python/src/mobase/wrappers/pyplugins.cpp
@@ -52,6 +52,7 @@ namespace mo2::python {
"settings"_a)
.def("listSaves", &IPluginGame::listSaves, "folder"_a)
.def("isInstalled", &IPluginGame::isInstalled)
+ .def("isNativeLinux", &IPluginGame::isNativeLinux)
.def("gameIcon", &IPluginGame::gameIcon)
.def("gameDirectory", &IPluginGame::gameDirectory)
.def("dataDirectory", &IPluginGame::dataDirectory)
diff --git a/libs/plugin_python/src/mobase/wrappers/pyplugins.h b/libs/plugin_python/src/mobase/wrappers/pyplugins.h
index 17f7ab5..ce9a911 100644
--- a/libs/plugin_python/src/mobase/wrappers/pyplugins.h
+++ b/libs/plugin_python/src/mobase/wrappers/pyplugins.h
@@ -385,6 +385,10 @@ namespace mo2::python {
{
PYBIND11_OVERRIDE_PURE(bool, IPluginGame, isInstalled, );
}
+ bool isNativeLinux() const override
+ {
+ PYBIND11_OVERRIDE(bool, IPluginGame, isNativeLinux, );
+ }
QIcon gameIcon() const override
{
PYBIND11_OVERRIDE_PURE(QIcon, IPluginGame, gameIcon, );
diff --git a/libs/uibase/include/uibase/iplugingame.h b/libs/uibase/include/uibase/iplugingame.h
index 0fa2508..93ee09f 100644
--- a/libs/uibase/include/uibase/iplugingame.h
+++ b/libs/uibase/include/uibase/iplugingame.h
@@ -145,6 +145,15 @@ public:
/**
* this function may be called before init()
*
+ * @return true if the discovered installation is a native Linux build that
+ * should be launched directly without Proton/Wine. Default false:
+ * Linux ports of MO2 historically run every game under Proton.
+ */
+ virtual bool isNativeLinux() const { return false; }
+
+ /**
+ * this function may be called before init()
+ *
* @return an icon for this game
*/
virtual QIcon gameIcon() const = 0;
diff --git a/src/src/executableslist.cpp b/src/src/executableslist.cpp
index f12a74c..459d25c 100644
--- a/src/src/executableslist.cpp
+++ b/src/src/executableslist.cpp
@@ -150,12 +150,21 @@ ExecutablesList::getPluginExecutables(MOBase::IPluginGame const* game) const
std::vector<Executable> v;
+ // Native Linux installs (e.g. native Stardew Valley) launch directly without
+ // Proton. Their executables default to UseProton=false so the user doesn't
+ // have to flip every entry by hand after instance creation.
+ const bool nativeLinux = game->isNativeLinux();
+
for (const ExecutableInfo& info : game->executables()) {
if (!info.isValid()) {
continue;
}
- v.push_back({info, Executable::UseApplicationIcon | Executable::UseProton});
+ Executable::Flags flags = Executable::UseApplicationIcon;
+ if (!nativeLinux) {
+ flags |= Executable::UseProton;
+ }
+ v.push_back({info, flags});
}
const QFileInfo eppBin(QCoreApplication::applicationDirPath() +