Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add / extend game detection support for Epic Games (Heroic Games Launcher) #169

Merged
merged 6 commits into from
Jan 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ Game IDs can be found here:
- For Origin from `C:\ProgramData\Origin\LocalContent` (.mfst files)
- For Epic Games (`AppName`) from:
- `C:\ProgramData\Epic\EpicGamesLauncher\Data\Manifests\` (.item files)
- or: `C:\ProgramData\Epic\EpicGamesLauncher\UnrealEngineLauncher\LauncherInstalled.dat`
- or `C:\ProgramData\Epic\EpicGamesLauncher\UnrealEngineLauncher\LauncherInstalled.dat`
- or [Unofficial EGS ID DB](https://erri120.github.io/egs-db/)
- For Legendary (alt. Epic launcher) via command `legendary list-games`
or from: `%USERPROFILE%\.config\legendary\installed.json`
- For EA Desktop from `<EA Games install location>\<game title>\__Installer\installerdata.xml`
Expand Down
18 changes: 12 additions & 6 deletions epic_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ def find_epic_games() -> Iterable[tuple[str, Path]]:
winreg.HKEY_LOCAL_MACHINE,
r"Software\Wow6432Node\Epic Games\EpicGamesLauncher",
) as key:
epic_app_data_path, _ = winreg.QueryValueEx(key, "AppDataPath")
epic_data_path, _ = winreg.QueryValueEx(key, "AppDataPath")
except FileNotFoundError:
return
epic_data_path = r"%ProgramData%\Epic\EpicGamesLauncher\Data"

manifests_path = Path(os.path.expandvars(epic_app_data_path)).joinpath("Manifests")
manifests_path = Path(os.path.expandvars(epic_data_path)).joinpath("Manifests")
if manifests_path.exists():
for manifest_file_path in manifests_path.glob("*.item"):
try:
Expand All @@ -38,10 +38,10 @@ def find_epic_games() -> Iterable[tuple[str, Path]]:
)


def find_legendary_games() -> Iterable[tuple[str, Path]]:
def find_legendary_games(config_path: str | None = None) -> Iterable[tuple[str, Path]]:
# Based on legendary source:
# https://github.com/derrod/legendary/blob/master/legendary/lfs/lgndry.py
if config_path := os.environ.get("XDG_CONFIG_HOME"):
if config_path := config_path or os.environ.get("XDG_CONFIG_HOME"):
legendary_config_path = Path(config_path, "legendary")
else:
legendary_config_path = Path("~/.config/legendary").expanduser()
Expand All @@ -61,8 +61,14 @@ def find_legendary_games() -> Iterable[tuple[str, Path]]:
)


def find_heroic_games():
return find_legendary_games(os.path.expandvars(r"%AppData%\heroic\legendaryConfig"))


def find_games() -> dict[str, Path]:
return dict(itertools.chain(find_epic_games(), find_legendary_games()))
return dict(
itertools.chain(find_epic_games(), find_legendary_games(), find_heroic_games())
)


if __name__ == "__main__":
Expand Down
1 change: 1 addition & 0 deletions games/game_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class ControlGame(BasicGame):
GameNexusId = 2936
GameSteamId = 870780
GameGogId = 2049187585
GameEpicId = "calluna"
GameBinary = "Control.exe"
GameDataPath = ""

Expand Down
1 change: 1 addition & 0 deletions games/game_cyberpunk2077.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ class Cyberpunk2077Game(BasicGame):
GameSaveExtension = "dat"
GameSteamId = 1091500
GameGogId = 1423049311
GameEpicId = "77f2b98e2cef40c8a7437518bf420e47"
GameSupportURL = (
r"https://github.com/ModOrganizer2/modorganizer-basic_games/wiki/"
"Game:-Cyberpunk-2077"
Expand Down
1 change: 1 addition & 0 deletions games/game_subnautica-below-zero.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class SubnauticaBelowZeroGame(game_subnautica.SubnauticaGame):
GameShortName = "subnauticabelowzero"
GameNexusName = "subnauticabelowzero"
GameSteamId = 848450
GameEpicId = "foxglove"
GameBinary = "SubnauticaZero.exe"
GameDataPath = "_ROOT"
GameDocumentsDirectory = "%GAME_PATH%"
Expand Down
Loading