diff options
| author | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-02-11 19:04:11 -0600 |
|---|---|---|
| committer | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-02-11 19:04:11 -0600 |
| commit | 8a10147bbb1fe6589c4205bcfd26d6d696512ced (patch) | |
| tree | 66fe7403114e2d63fa48ceee14352bee4dbddae0 /libs/basic_games/gog_utils.py | |
| parent | a03455028d8b79a1196bffc2f80c2455c41db065 (diff) | |
Add Root Builder plugin, Linux game detection, and OMOD installer fix
- New native Root Builder plugin (src/plugins/rootbuilder.py) with copy
and symlink deploy modes, auto-deploy hooks, backup/restore, and
third-party conflict detection that moves incompatible plugins to
DisabledPlugins/. In link mode, .exe/.dll are always copied to avoid
Wine/Proton path resolution issues with symlinked executables.
- Fix basic_games detection on Linux: steam_utils now checks native
Steam paths (~/.local/share/Steam, Flatpak, Snap), epic_utils uses
correct Linux Heroic config paths, gog_utils falls back to Heroic
GOG installed.json when Windows registry is unavailable.
- Fix OMOD installer crash: isArchiveSupported now handles both IFileTree
(from mod list refresh) and string (from install check) arguments.
- Add flatpak manifest step to copy source-tree Python plugins
(src/plugins/*.py) into the build output.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'libs/basic_games/gog_utils.py')
| -rw-r--r-- | libs/basic_games/gog_utils.py | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/libs/basic_games/gog_utils.py b/libs/basic_games/gog_utils.py index e5e6d24..de66ec2 100644 --- a/libs/basic_games/gog_utils.py +++ b/libs/basic_games/gog_utils.py @@ -1,12 +1,50 @@ # Code adapted from EzioTheDeadPoet / erri120: # https://github.com/ModOrganizer2/modorganizer-basic_games/pull/5 +from __future__ import annotations + +import json +import sys import winreg from pathlib import Path +def _find_heroic_gog_games() -> dict[str, Path]: + """Detect GOG games installed via Heroic Launcher on Linux.""" + games: dict[str, Path] = {} + + for candidate in ( + Path.home() / ".config" / "heroic" / "gog_store" / "installed.json", + Path.home() + / ".var" + / "app" + / "com.heroicgameslauncher.hgl" + / "config" + / "heroic" + / "gog_store" + / "installed.json", + ): + if not candidate.is_file(): + continue + try: + with open(candidate, encoding="utf-8") as f: + data = json.load(f) + for game in data.get("installed", []): + app_name = game.get("appName", "") + install_path = game.get("install_path") or game.get("installPath", "") + if app_name and install_path: + games[str(app_name)] = Path(install_path) + except (json.JSONDecodeError, OSError) as e: + print( + f'Unable to parse Heroic GOG installed games from "{candidate}": {e}', + file=sys.stderr, + ) + + return games + + def find_games() -> dict[str, Path]: - # List the game IDs from the registry: + # List the game IDs from the registry (Windows): game_ids: list[str] = [] try: with winreg.OpenKey( @@ -18,7 +56,8 @@ def find_games() -> dict[str, Path]: if game_key.isdigit(): game_ids.append(game_key) except FileNotFoundError: - return {} + # Windows registry not available; try Heroic GOG on Linux. + return _find_heroic_gog_games() # For each game, query the path: games: dict[str, Path] = {} |
