From b6062f1ee0e9b40a16c7798428ab9f50fe67ba67 Mon Sep 17 00:00:00 2001 From: Boris Yumankulov Date: Mon, 26 Jan 2026 23:28:06 +0500 Subject: [PATCH] fix(gamecard): correct argument order when creating GameCard Signed-off-by: Boris Yumankulov --- portprotonqt/detail_pages.py | 2 +- portprotonqt/main_window.py | 6 +++--- portprotonqt/portproton_api.py | 24 ++++++++---------------- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/portprotonqt/detail_pages.py b/portprotonqt/detail_pages.py index 686fa0f..37508c9 100644 --- a/portprotonqt/detail_pages.py +++ b/portprotonqt/detail_pages.py @@ -28,7 +28,7 @@ class DetailPageManager: self._animations = {} self.portproton_api = PortProtonAPI(Downloader(max_workers=4)) - def openGameDetailPage(self, name, description, cover_path=None, appid="", exec_line="", controller_support="", + def openGameDetailPage(self, name, description, cover_path=None, appid="", controller_support="", exec_line="", last_launch="", formatted_playtime="", protondb_tier="", game_source="", anticheat_status=""): """Open detailed game information page showing all game stats, playtime and settings.""" detailPage = QWidget() diff --git a/portprotonqt/main_window.py b/portprotonqt/main_window.py index 4dcb0b3..17a34b5 100644 --- a/portprotonqt/main_window.py +++ b/portprotonqt/main_window.py @@ -961,8 +961,8 @@ class MainWindow(QMainWindow): info.get('description', ''), info.get('cover', ''), appid, - f"steam://rungameid/{appid}", info.get('controller_support', ''), + f"steam://rungameid/{appid}", last_launch, format_playtime(playtime_seconds), info.get('protondb_tier', ''), @@ -1111,8 +1111,8 @@ class MainWindow(QMainWindow): final_desc, final_cover, steam_info.get("appid", ""), - exec_line, steam_info.get("controller_support", ""), + exec_line, get_last_launch(exe_name) if exe_name else _("Never"), formatted_playtime, steam_info.get("protondb_tier", ""), @@ -1430,8 +1430,8 @@ class MainWindow(QMainWindow): final_desc, final_cover, steam_info.get("appid", ""), - exec_line, steam_info.get("controller_support", ""), + exec_line, last_launch, formatted_playtime, steam_info.get("protondb_tier", ""), diff --git a/portprotonqt/portproton_api.py b/portprotonqt/portproton_api.py index 754dc83..0938889 100644 --- a/portprotonqt/portproton_api.py +++ b/portprotonqt/portproton_api.py @@ -64,23 +64,15 @@ def extract_exe_name(exec_line: str) -> str: try: parts = shlex.split(exec_line) - # PortProton exec_line format: env VAR=val script game.exe - # The exe is usually the 4th part (index 3) or last part ending with .exe - if len(parts) >= 4: - game_exe = os.path.expanduser(parts[3]) - else: - # Fallback: find first .exe in the command - game_exe = exec_line - for part in parts: - if part.lower().endswith(".exe"): - game_exe = os.path.expanduser(part) - break - exe_name = os.path.basename(game_exe) - # Ensure .exe extension - if exe_name and not exe_name.lower().endswith(".exe"): - exe_name = f"{exe_name}.exe" - return exe_name + # Search for the last part ending with .exe + # In PortProton format, the game exe is always the last argument + for part in reversed(parts): + if part.lower().endswith(".exe"): + game_exe = os.path.expanduser(part) + return os.path.basename(game_exe) + + return "" except (ValueError, IndexError): return ""