From d0a45f17bf7b4b0d61d12dc58aec6dc1015bb025 Mon Sep 17 00:00:00 2001 From: Daniel Johnson Date: Fri, 10 Nov 2023 07:30:17 -0500 Subject: [PATCH] Add heuristics to predict the runner for Lutris service games Pretty simple; if there's just one platform, and it is Windows or Linux or MS-DOS, we guess 'wine' or 'linux' or 'dosbox'; otherwise we just give up. Sadly most Lutris service games seem to have multiple platforms. Darn you, portability, darn you to heck! We can tweak this to be more opinionated later, if desired. --- lutris/services/lutris.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lutris/services/lutris.py b/lutris/services/lutris.py index 61aea181d..3a9b64d8b 100644 --- a/lutris/services/lutris.py +++ b/lutris/services/lutris.py @@ -126,6 +126,23 @@ class LutrisService(OnlineService): application = Gio.Application.get_default() application.show_installer_window(installers) + def get_installed_runner_name(self, db_game): + platforms = self.get_game_platforms(db_game) + + if platforms and len(platforms) == 1: + platform = platforms[0].casefold() + + if platform == "windows": + return "wine" + + if platform == "linux": + return "linux" + + if platform == "ms-dos": + return "dosbox" + + return "" + def get_game_platforms(self, db_game): details = db_game.get("details") if details: