Merge pull request #82 from dungeonsworkshop/launcher-pr

Added automatic support for Minecraft Dungeons
This commit is contained in:
Valentin 2020-06-18 11:49:03 +02:00 committed by GitHub
commit 808a8fc9ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 62 additions and 1 deletions

View File

@ -6,7 +6,8 @@
Fortnite,
Valorant,
DeadByDaylight,
Borderlands3
Borderlands3,
MinecraftDungeons
}
public enum EFModel

View File

@ -78,6 +78,7 @@
<None Remove="Resources\key.png" />
<None Remove="Resources\lock-open-variant.ico" />
<None Remove="Resources\magnify.png" />
<None Remove="Resources\minecraftdungeons.ico" />
<None Remove="Resources\open-in-new.png" />
<None Remove="Resources\pause.png" />
<None Remove="Resources\paypal.png" />
@ -181,6 +182,7 @@
<Resource Include="Resources\key.png" />
<Resource Include="Resources\lock-open-variant.ico" />
<Resource Include="Resources\magnify.png" />
<Resource Include="Resources\minecraftdungeons.ico" />
<Resource Include="Resources\open-in-new.png" />
<Resource Include="Resources\pause.png" />
<Resource Include="Resources\paypal.png" />

View File

@ -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",
};

View File

@ -0,0 +1,7 @@
namespace FModel.Grabber.Paks
{
public class LauncherSettings
{
public string productLibraryDir;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View File

@ -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,
};

View File

@ -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";
}

View File

@ -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<LauncherSettings>(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<string, FPakEntry> tempFiles, out Dictionary<string, FPakEntry> files, string mount)
{

View File

@ -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();
}