diff --git a/FModel/Enums.cs b/FModel/Enums.cs index 4a89ad01..0c616607 100644 --- a/FModel/Enums.cs +++ b/FModel/Enums.cs @@ -6,7 +6,8 @@ Fortnite, Valorant, DeadByDaylight, - Borderlands3 + Borderlands3, + MinecraftDungeons } public enum EFModel diff --git a/FModel/FModel.csproj b/FModel/FModel.csproj index e9b0e41f..91e9d8fa 100644 --- a/FModel/FModel.csproj +++ b/FModel/FModel.csproj @@ -78,6 +78,7 @@ + @@ -181,6 +182,7 @@ + diff --git a/FModel/Globals.cs b/FModel/Globals.cs index 37d6824b..2fd46140 100644 --- a/FModel/Globals.cs +++ b/FModel/Globals.cs @@ -54,6 +54,7 @@ namespace FModel EGame.Valorant => "Valorant", EGame.DeadByDaylight => "Dead By Daylight", EGame.Borderlands3 => "Borderlands 3", + EGame.MinecraftDungeons => "Minecraft Dungeons", EGame.Unknown => "Unknown", _ => "Unknown", }; diff --git a/FModel/Grabber/Paks/LauncherSettings.cs b/FModel/Grabber/Paks/LauncherSettings.cs new file mode 100644 index 00000000..458798fd --- /dev/null +++ b/FModel/Grabber/Paks/LauncherSettings.cs @@ -0,0 +1,7 @@ +namespace FModel.Grabber.Paks +{ + public class LauncherSettings + { + public string productLibraryDir; + } +} \ No newline at end of file diff --git a/FModel/Resources/minecraftdungeons.ico b/FModel/Resources/minecraftdungeons.ico new file mode 100644 index 00000000..f325f63f Binary files /dev/null and b/FModel/Resources/minecraftdungeons.ico differ diff --git a/FModel/Utils/Folders.cs b/FModel/Utils/Folders.cs index 4301c03c..95616dff 100644 --- a/FModel/Utils/Folders.cs +++ b/FModel/Utils/Folders.cs @@ -28,6 +28,7 @@ namespace FModel.Utils "ShooterGame" => EGame.Valorant, "DeadByDaylight" => EGame.DeadByDaylight, "OakGame" => EGame.Borderlands3, + "Dungeons" => EGame.MinecraftDungeons, _ => EGame.Unknown, }; } @@ -42,6 +43,7 @@ namespace FModel.Utils EGame.Valorant => "ShooterGame", EGame.DeadByDaylight => "DeadByDaylight", EGame.Borderlands3 => "OakGame", + EGame.MinecraftDungeons => "Dungeons", _ => string.Empty, }; diff --git a/FModel/Utils/Localizations.cs b/FModel/Utils/Localizations.cs index 53d0676c..e6f73b41 100644 --- a/FModel/Utils/Localizations.cs +++ b/FModel/Utils/Localizations.cs @@ -51,6 +51,8 @@ namespace FModel.Utils m = Regex.Match(mount + KvP.Value.Name, $"{gameName}/Content/Localization/Game/{langCode}/Game.locres", RegexOptions.IgnoreCase); else if (Globals.Game.ActualGame == EGame.DeadByDaylight) m = Regex.Match(mount + KvP.Value.Name, $"{gameName}/Content/Localization/{gameName}/{langCode}/{gameName}.locres", RegexOptions.IgnoreCase); + else if (Globals.Game.ActualGame == EGame.MinecraftDungeons) + m = Regex.Match(mount + KvP.Value.Name, $"{gameName}/Content/Localization/Game/{langCode}/Game.locres", RegexOptions.IgnoreCase); if (m != null && m.Success) { @@ -179,6 +181,25 @@ namespace FModel.Utils ELanguage.TraditionalChinese => "zh-Hant", _ => "en", }; + else if (Globals.Game.ActualGame == EGame.MinecraftDungeons) + return lang switch + { + //Swedish sv-SE + //Mexican Spanish es-MX + //Portugal Portuguese pt-PT + //British English en-GB + ELanguage.English => "en", + ELanguage.French => "fr-FR", + ELanguage.German => "de-DE", + ELanguage.Italian => "it-IT", + ELanguage.Spanish => "es-ES", + ELanguage.Japanese => "ja-JP", + ELanguage.Korean => "ko-KR", + ELanguage.Polish => "pl-PL", + ELanguage.PortugueseBrazil => "pt-BR", + ELanguage.Russian => "ru-RU", + _ => "en" + }; else return "en"; } diff --git a/FModel/Utils/Paks.cs b/FModel/Utils/Paks.cs index 2c37b19a..61b37e16 100644 --- a/FModel/Utils/Paks.cs +++ b/FModel/Utils/Paks.cs @@ -4,6 +4,7 @@ using Newtonsoft.Json; using PakReader.Parsers.Objects; using System.Collections.Generic; using System.IO; +using System; namespace FModel.Utils { @@ -82,6 +83,23 @@ namespace FModel.Utils else return string.Empty; } + + public static string GetMinecraftDungeonsPakFilesPath() + { + var appData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); + var install = $"{appData}/.minecraft_dungeons/launcher_settings.json"; + if (File.Exists(install)) + { + DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[launcher_settings.json]", install); + var launcherSettings = JsonConvert.DeserializeObject(File.ReadAllText(install)); + + if (launcherSettings.productLibraryDir != null) + if(!string.IsNullOrEmpty(launcherSettings.productLibraryDir)) + return $"{launcherSettings.productLibraryDir}\\dungeons\\dungeons\\Dungeons\\Content\\Paks"; + DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[launcher_settings.json]", "Minecraft Dungeons not found"); + } + return string.Empty; + } public static void Merge(Dictionary tempFiles, out Dictionary files, string mount) { diff --git a/FModel/Windows/Launcher/FLauncher.xaml.cs b/FModel/Windows/Launcher/FLauncher.xaml.cs index 86c2b17e..750fd035 100644 --- a/FModel/Windows/Launcher/FLauncher.xaml.cs +++ b/FModel/Windows/Launcher/FLauncher.xaml.cs @@ -62,6 +62,15 @@ namespace FModel.Windows.Launcher Globals.gNotifier.ShowCustomMessage("Borderlands 3", Properties.Resources.PathAutoDetected, "/FModel;component/Resources/borderlands3.ico"); ComboBoxVm.gamesCbViewModel.Add(new ComboBoxViewModel { Id = i++, Content = "Borderlands 3", Property = borderlands3FilesPath }); } + + string minecraftdungeonsFilesPath = Paks.GetMinecraftDungeonsPakFilesPath(); + if (!string.IsNullOrEmpty(minecraftdungeonsFilesPath)) + { + DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[launcher_settings.json]", $"Minecraft Dungeons found at {minecraftdungeonsFilesPath}"); + Globals.gNotifier.ShowCustomMessage("Minecraft Dungeons", Properties.Resources.PathAutoDetected, "/FModel;component/Resources/minecraftdungeons.ico"); + ComboBoxVm.gamesCbViewModel.Add(new ComboBoxViewModel { Id = i++, Content = "Minecraft Dungeons", Property = minecraftdungeonsFilesPath }); + } + Games_CbBox.SelectedItem = ComboBoxVm.gamesCbViewModel.Where(x => x.Property.ToString() == Properties.Settings.Default.PakPath).FirstOrDefault(); }