This commit is contained in:
4sval
2022-11-01 14:09:06 +01:00
parent 525718d35c
commit 3e41fba8b0
4 changed files with 39 additions and 8 deletions

View File

@@ -120,6 +120,7 @@ public class GameSelectorViewModel : ViewModel
yield return GetRockstarGamesGame("GTA III - Definitive Edition", "\\Gameface\\Content\\Paks");
yield return GetRockstarGamesGame("GTA San Andreas - Definitive Edition", "\\Gameface\\Content\\Paks");
yield return GetRockstarGamesGame("GTA Vice City - Definitive Edition", "\\Gameface\\Content\\Paks");
yield return GetLevelInfiniteGame("tof_launcher", "\\Hotta\\Content\\Paks");
}
private LauncherInstalled _launcherInstalled;
@@ -199,6 +200,28 @@ public class GameSelectorViewModel : ViewModel
return null;
}
private DetectedGame GetLevelInfiniteGame(string key, string pakDirectory)
{
var installLocation = string.Empty;
var displayName = string.Empty;
try
{
installLocation = App.GetRegistryValue($@"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{key}", "GameInstallPath", RegistryHive.CurrentUser);
displayName = App.GetRegistryValue($@"Software\Microsoft\Windows\CurrentVersion\Uninstall\{key}", "DisplayName", RegistryHive.CurrentUser);
}
catch
{
// ignored
}
if (!string.IsNullOrEmpty(installLocation))
return new DetectedGame { GameName = displayName, GameDirectory = $"{installLocation}{pakDirectory}" };
Log.Warning("Could not find {GameName} in the registry", key);
return null;
}
private T GetDriveLauncherInstalls<T>(string jsonFile)
{
foreach (var drive in DriveInfo.GetDrives())