diff --git a/FModel/Enums.cs b/FModel/Enums.cs index d8d12490..4396f0ac 100644 --- a/FModel/Enums.cs +++ b/FModel/Enums.cs @@ -92,7 +92,9 @@ public enum FGame [Description("Sea of Thieves")] Athena, [Description("Your Beloved ™ Panda")] - PandaGame + PandaGame, + [Description("Tower of Fantasy")] + Hotta, } public enum ELoadingMode diff --git a/FModel/Settings/UserSettings.cs b/FModel/Settings/UserSettings.cs index 1292021c..09637b41 100644 --- a/FModel/Settings/UserSettings.cs +++ b/FModel/Settings/UserSettings.cs @@ -283,7 +283,8 @@ namespace FModel.Settings {FGame.PortalWars, Constants._NO_PRESET_TRIGGER}, {FGame.Gameface, Constants._NO_PRESET_TRIGGER}, {FGame.Athena, Constants._NO_PRESET_TRIGGER}, - {FGame.PandaGame, Constants._NO_PRESET_TRIGGER} + {FGame.PandaGame, Constants._NO_PRESET_TRIGGER}, + {FGame.Hotta, Constants._NO_PRESET_TRIGGER}, }; public IDictionary Presets { @@ -312,7 +313,8 @@ namespace FModel.Settings {FGame.PortalWars, EGame.GAME_UE4_LATEST}, {FGame.Gameface, EGame.GAME_GTATheTrilogyDefinitiveEdition}, {FGame.Athena, EGame.GAME_SeaOfThieves}, - {FGame.PandaGame, EGame.GAME_UE4_26} + {FGame.PandaGame, EGame.GAME_UE4_26}, + {FGame.Hotta, EGame.GAME_TowerOfFantasy} }; public IDictionary OverridedGame { @@ -341,7 +343,8 @@ namespace FModel.Settings {FGame.PortalWars, null}, {FGame.Gameface, null}, {FGame.Athena, null}, - {FGame.PandaGame, null} + {FGame.PandaGame, null}, + {FGame.Hotta, null}, }; public IDictionary> OverridedCustomVersions { @@ -370,7 +373,8 @@ namespace FModel.Settings {FGame.PortalWars, null}, {FGame.Gameface, null}, {FGame.Athena, null}, - {FGame.PandaGame, null} + {FGame.PandaGame, null}, + {FGame.Hotta, null}, }; public IDictionary> OverridedOptions { @@ -405,7 +409,12 @@ namespace FModel.Settings {FGame.PortalWars, new FEndpoint[]{new (), new ()}}, {FGame.Gameface, new FEndpoint[]{new (), new ()}}, {FGame.Athena, new FEndpoint[]{new (), new ()}}, - {FGame.PandaGame, new FEndpoint[]{new (), new ()}} + {FGame.PandaGame, new FEndpoint[]{new (), new ()}}, + {FGame.Hotta, new [] + { + new FEndpoint("https://shimizu-izumi.github.io/fmodel/api/v1/aes/hotta.json", "$.['mainKey']") + } + } }; public IDictionary CustomEndpoints { @@ -482,6 +491,7 @@ namespace FModel.Settings {FGame.Gameface, new List()}, {FGame.Athena, new List()}, {FGame.PandaGame, new List()}, + {FGame.Hotta, new List()}, }; public IDictionary> CustomDirectories { diff --git a/FModel/ViewModels/GameSelectorViewModel.cs b/FModel/ViewModels/GameSelectorViewModel.cs index 569d0c46..d765630d 100644 --- a/FModel/ViewModels/GameSelectorViewModel.cs +++ b/FModel/ViewModels/GameSelectorViewModel.cs @@ -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(string jsonFile) { foreach (var drive in DriveInfo.GetDrives())