aboutsummaryrefslogtreecommitdiff
path: root/libs/basic_games/gog_utils.py
diff options
context:
space:
mode:
authorSulfurNitride <SulfurNitride@users.noreply.github.com>2026-02-11 02:37:39 -0600
committerSulfurNitride <SulfurNitride@users.noreply.github.com>2026-02-11 02:37:39 -0600
commit7ee008e150bc5bcf76082d726f719ee0fdfda982 (patch)
tree27fb39be241fdb5ac2734c574de678977d1856d0 /libs/basic_games/gog_utils.py
Fluorine Manager: full Linux port of Mod Organizer 2
Complete native Linux port with FUSE-based virtual filesystem, Proton/umu-run integration, and Flatpak packaging. Key features: - FUSE VFS replacing Windows USVFS (in-process + standalone helper for Flatpak) - Proton/GE-Proton/umu-run launcher with env var forwarding - Flatpak support (sandbox-aware VFS, NXM handler, umu-run) - Wine prefix management UI - Case-insensitive path resolution for Linux filesystems - QSettings-safe INI handling (avoids Bethesda INI corruption) - Portable instance support with auto-generated launcher scripts 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.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/libs/basic_games/gog_utils.py b/libs/basic_games/gog_utils.py
new file mode 100644
index 0000000..e5e6d24
--- /dev/null
+++ b/libs/basic_games/gog_utils.py
@@ -0,0 +1,35 @@
+# Code adapted from EzioTheDeadPoet / erri120:
+# https://github.com/ModOrganizer2/modorganizer-basic_games/pull/5
+
+import winreg
+from pathlib import Path
+
+
+def find_games() -> dict[str, Path]:
+ # List the game IDs from the registry:
+ game_ids: list[str] = []
+ try:
+ with winreg.OpenKey(
+ winreg.HKEY_LOCAL_MACHINE, r"Software\Wow6432Node\GOG.com\Games"
+ ) as key:
+ nkeys = winreg.QueryInfoKey(key)[0]
+ for ik in range(nkeys):
+ game_key = winreg.EnumKey(key, ik)
+ if game_key.isdigit():
+ game_ids.append(game_key)
+ except FileNotFoundError:
+ return {}
+
+ # For each game, query the path:
+ games: dict[str, Path] = {}
+ for game_id in game_ids:
+ try:
+ with winreg.OpenKey(
+ winreg.HKEY_LOCAL_MACHINE,
+ f"Software\\Wow6432Node\\GOG.com\\Games\\{game_id}",
+ ) as key:
+ games[game_id] = Path(winreg.QueryValueEx(key, "path")[0])
+ except FileNotFoundError:
+ pass
+
+ return games