diff --git a/dzgui/api/steam.py b/dzgui/api/steam.py index e007084..9e128f6 100644 --- a/dzgui/api/steam.py +++ b/dzgui/api/steam.py @@ -139,6 +139,8 @@ def get_remote_signatures(mods: list[str]) -> list[tuple[str, str, int, int]]: j = r.json() rows = j["response"]["publishedfiledetails"] for row in rows: + if row["result"] == 9: + continue title = str(row["title"]) _id = str(row["publishedfileid"]) time = int(row["time_updated"]) @@ -205,9 +207,11 @@ def launch_offline( proc = subprocess.run([*client_args, *params]) return proc.returncode + def find_loginusers(path: Path) -> Path: return path / "config" / "loginusers.vdf" + def find_user_id(path: Path) -> str | None: resolved_path = find_loginusers(path) try: @@ -226,7 +230,6 @@ def find_user_id(path: Path) -> str | None: return None - def find_user_id_32(path: Path) -> int: uid = find_user_id(path) if uid is None: diff --git a/dzgui/managers/connection.py b/dzgui/managers/connection.py index 1ec5a66..c96abc2 100644 --- a/dzgui/managers/connection.py +++ b/dzgui/managers/connection.py @@ -86,6 +86,7 @@ class Prerequisites: mods: list[list[str]] game_mode: bool is_last_server: bool + invalid_mods: list[tuple[str, str]] allows_downloads: tuple[bool, str] @@ -191,6 +192,9 @@ class ConnectionManager: is_last = self.is_last_server() + # TODO: strings + invalid_mods = [(mod[0], mod[1]) for mod in remote_mods if mod[2] == "Invalid mod"] + prereqs = Prerequisites( name=info.server_name, appid=info.game_id, @@ -206,6 +210,7 @@ class ConnectionManager: mods=remote_mods, game_mode=game_mode, is_last_server=is_last, + invalid_mods=invalid_mods, allows_downloads=allows_downloads, ) @@ -261,6 +266,11 @@ class ConnectionManager: for mod in alpha_mods: if any(mod[1] in tuple for tuple in missing_mods): mod[2] = resync + for mod in alpha_mods: + # NOTE: if the mod is neither synched or out of date, it is a malformed mod + if mod[2] == "": + # TODO: strings + mod[2] = "Invalid mod" return alpha_mods, missing_mods diff --git a/dzgui/views/pages/preconnect.py b/dzgui/views/pages/preconnect.py index 817063b..345f7a7 100644 --- a/dzgui/views/pages/preconnect.py +++ b/dzgui/views/pages/preconnect.py @@ -239,6 +239,15 @@ class PreConnectionAssistant(Gtk.Box): ) """Errors""" + if len(prereqs.invalid_mods) > 0: + pairs = [": ".join(sub) for sub in prereqs.invalid_mods] + lines = "\n".join(pairs) + msg = ( + "Server has invalid mods that are not recognized by Steam.\n" + "Contact the server owner and include these mod IDs in your report:\n" + f"{lines}" + ) + errors.append(msg) if prereqs.binary_missing: errors.append( f"Remote server is running the build '{prereqs.build}', but it is not installed.\n{resync_msg}" @@ -278,7 +287,7 @@ class PreConnectionAssistant(Gtk.Box): f"The game '{running_app}' is currently running in Steam, but background downloads are not enabled.\n" "Either stop the game first, or update your global Steam settings or the game's local settings.\n" "Otherwise, mods may be queued for download but never update." - ) + ) warnings.append(msg) self.add_warnings(warnings)