Skip to content

Commit 9cc0a5e

Browse files
Added locating Epic Games Launcher
1 parent 02bfca8 commit 9cc0a5e

4 files changed

Lines changed: 71 additions & 2 deletions

File tree

Source/HedgeModManager/ModdableGameLocator.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,16 @@ public static List<IModdableGame> LocateGames()
178178
Logger.Debug("Heroic not found!");
179179
}
180180

181+
if (!string.IsNullOrEmpty(epicLocator.EGLInstalledPath))
182+
{
183+
Logger.Debug($"Found LauncherInstalled.dat at: {epicLocator.EGLInstalledPath}");
184+
}
185+
else
186+
{
187+
if (OperatingSystem.IsWindows())
188+
Logger.Debug("EGL not found!");
189+
}
190+
181191
if (OperatingSystem.IsLinux())
182192
{
183193
Logger.Debug("XDG Data paths: " + string.Join(':', Paths.GetProgramDataPaths()));
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
namespace HedgeModManager.Epic;
2+
3+
public class EpicLauncherAppInstallEntry
4+
{
5+
public string? InstallLocation { get; set; }
6+
public string? NamespaceId { get; set; }
7+
public string? ItemId { get; set; }
8+
public string? ArtifactId { get; set; }
9+
public string? AppVersion { get; set; }
10+
public string? AppName { get; set; }
11+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace HedgeModManager.Epic;
2+
3+
public class EpicLauncherInstalled
4+
{
5+
public List<EpicLauncherAppInstallEntry> InstallationList { get; set; } = [];
6+
}

Source/Libraries/HedgeModManager.Epic/EpicLocator.cs

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
namespace HedgeModManager.Epic;
22
using Foundation;
3+
using Microsoft.Win32;
4+
using System.Runtime.Versioning;
35
using System.Text.Json;
46

57

@@ -18,8 +20,24 @@ public class EpicLocator : IGameLocator
1820
};
1921

2022
public List<string> HeroicRootPaths = [];
23+
public string? EGLInstalledPath { get; set; } = null;
2124

22-
public void LocateEpicRoots()
25+
[SupportedOSPlatform("windows")]
26+
public void LocateEGLRoot()
27+
{
28+
var eosKey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\\Epic Games\\EOS");
29+
if (eosKey?.GetValue("ModSdkMetadataDir") is string modSdkMetadataDir)
30+
{
31+
string installedPath = Path.Combine(modSdkMetadataDir, "..", "..", "..", "UnrealEngineLauncher", "LauncherInstalled.dat");
32+
33+
if (File.Exists(installedPath))
34+
{
35+
EGLInstalledPath = installedPath;
36+
}
37+
}
38+
}
39+
40+
public void LocateHeroicRoots()
2341
{
2442
var searchPaths = new List<string>();
2543
string userProfile = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
@@ -47,9 +65,33 @@ public void LocateEpicRoots()
4765

4866
public List<EpicGame> Locate()
4967
{
50-
LocateEpicRoots();
68+
if (OperatingSystem.IsWindows())
69+
{
70+
LocateEGLRoot();
71+
}
72+
73+
LocateHeroicRoots();
5174
var games = new List<EpicGame>();
5275

76+
// Epic Games Launcher
77+
if (EGLInstalledPath != null)
78+
{
79+
var installedApps = JsonSerializer.Deserialize<EpicLauncherInstalled>(File.ReadAllText(EGLInstalledPath));
80+
if (installedApps != null)
81+
{
82+
foreach (var app in installedApps.InstallationList)
83+
{
84+
games.Add(new EpicGame
85+
{
86+
ID = app.AppName ?? "NONE",
87+
Name = app.AppName ?? "NONE",
88+
Root = app.InstallLocation ?? "NONE",
89+
NativeOS = "Windows"
90+
});
91+
}
92+
}
93+
}
94+
5395
foreach (string rootPath in HeroicRootPaths)
5496
{
5597
string installedPath = Path.Combine(rootPath, "legendaryConfig", "legendary", "installed.json");

0 commit comments

Comments
 (0)