From d06dd9bf82040ad67a6f12fb92fb411770d63f28 Mon Sep 17 00:00:00 2001 From: SulfurNitride Date: Sat, 25 Apr 2026 20:27:53 -0500 Subject: Detect native-Linux Stardew Valley, default executables to no-Proton MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add IPluginGame::isNativeLinux() (virtual, default false) so a plugin can advertise that the discovered installation is a native Linux build. Bound through the Python plugin trampoline so basic_games subclasses can override it. Stardew Valley plugin: when the install dir contains the StardewValley launcher script and no Stardew Valley.exe, report isNativeLinux=true and return Linux-side binary names (StardewValley, StardewModdingAPI). Also fix GameDataPath to "Mods" — Linux ships the SMAPI mods dir with a capital M. ExecutablesList::getPluginExecutables: skip the UseProton flag when the plugin reports native Linux, so the spawn path falls into launchDirect() and the game runs without a Wine prefix. --- libs/basic_games/games/game_stardewvalley.py | 36 ++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'libs/basic_games') 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") -- cgit v1.3.1