added Borderlands 3 support (no dynamic pak fix atm)

This commit is contained in:
iAmAsval 2020-06-10 01:28:27 +02:00
parent 9e60c55337
commit 091c5aa189
19 changed files with 71 additions and 87 deletions

View File

@ -1,30 +0,0 @@
using PakReader.Parsers.Class;
using PakReader.Parsers.PropertyTagData;
using SkiaSharp;
using System;
using System.Windows;
namespace FModel.Creator
{
public class BaseValorant
{
public SKBitmap FallbackImage;
public SKBitmap IconImage;
public string DisplayName;
public string Description;
public int Size = 512; // keep it 512 (or a multiple of 512) if you don't want blurry icons
public BaseValorant()
{
FallbackImage = SKBitmap.Decode(Application.GetResourceStream(new Uri("pack://application:,,,/Resources/T_Placeholder_Item_Image.png")).Stream);
IconImage = FallbackImage;
DisplayName = "";
Description = "";
}
public BaseValorant(IUExport export, string assetFolder, ref string assetName) : this()
{
//if (export.GetExport<ArrayProperty>("ExplicitAssets") is ArrayProperty explicitAssets)
}
}
}

View File

@ -1,10 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace FModel.Creator.Characters
{
class PrimaryAsset
{
}
}

View File

@ -7,7 +7,6 @@ using FModel.ViewModels.ImageBox;
using PakReader.Parsers.Class;
using SkiaSharp;
using System.IO;
using System.Text.RegularExpressions;
namespace FModel.Creator
{
@ -202,27 +201,5 @@ namespace FModel.Creator
}
return false;
}
public static bool TryDrawValorantIcon(string assetPath, string exportType, IUExport export)
{
var d = new DirectoryInfo(assetPath);
string assetName = d.Name;
string assetFolder = d.Parent.Name;
//if (Regex.Match(exportType, $"{assetName.Substring(0, assetName.LastIndexOf("."))}_C", RegexOptions.IgnoreCase).Success)
//{
// BaseValorant icon = new BaseValorant(export, assetFolder, ref assetName);
// using (var ret = new SKBitmap(icon.Size, icon.Size, SKColorType.Rgba8888, SKAlphaType.Premul))
// using (var c = new SKCanvas(ret))
// {
// Watermark.DrawWatermark(c); // watermark should only be applied on icons with width = 512
// ImageBoxVm.imageBoxViewModel.Set(ret, assetName);
// }
// return true;
//}
return false;
}
}
}

View File

@ -5,7 +5,8 @@
Unknown,
Fortnite,
Valorant,
DeadByDaylight
DeadByDaylight,
Borderlands3
}
public enum EFModel

View File

@ -38,6 +38,7 @@
<None Remove="Resources\api-off.ico" />
<None Remove="Resources\api.ico" />
<None Remove="Resources\backup-restore.png" />
<None Remove="Resources\borderlands3.ico" />
<None Remove="Resources\bug.png" />
<None Remove="Resources\BurbankBigCondensed-Bold.ttf" />
<None Remove="Resources\cast-audio.png" />
@ -142,6 +143,7 @@
<Resource Include="Resources\api-off.ico" />
<Resource Include="Resources\api.ico" />
<Resource Include="Resources\backup-restore.png" />
<Resource Include="Resources\borderlands3.ico" />
<Resource Include="Resources\bug.png" />
<Resource Include="Resources\BurbankBigCondensed-Bold.ttf" />
<Resource Include="Resources\cast-audio.png" />

View File

@ -45,6 +45,19 @@ namespace FModel
ActualGame = game;
Version = version;
}
public string GetName()
{
return ActualGame switch
{
EGame.Fortnite => "Fortnite",
EGame.Valorant => "Valorant",
EGame.DeadByDaylight => "Dead By Daylight",
EGame.Borderlands3 => "Borderlands 3",
EGame.Unknown => "Unknown",
_ => "Unknown",
};
}
}
static class FColors

View File

@ -14,7 +14,7 @@ namespace FModel.Grabber.Aes
{
if (NetworkInterface.GetIsNetworkAvailable())
{
(_, string fortniteVersion, string _) = Utils.Paks.GetFortnitePakFilesPath();
(_, string fortniteVersion, string _) = Utils.Paks.GetUEGameFilesPath("Fortnite");
BenResponse data = await Endpoints.GetJsonEndpoint<BenResponse>(Endpoints.BENBOT_AES, fortniteVersion).ConfigureAwait(false);
return data;
}

View File

@ -87,13 +87,10 @@ namespace PakReader
{
reader.ReadUInt32(); // StrHash
}
var Namespace = reader.ReadFString();
string Namespace = reader.ReadFString();
var Entries = new Dictionary<string, string>();
// Read key count
uint KeyCount = reader.ReadUInt32();
Dictionary<string, string> Entries = new Dictionary<string, string>((int)KeyCount);
for (uint j = 0; j < KeyCount; j++)
{
// Read key
@ -139,7 +136,7 @@ namespace PakReader
}
Entries.Add(Key, EntryLocalizedString);
}
this.Entries.Add(Namespace, Entries);
this.Entries.Add(Namespace ?? "", Entries);
}
}

View File

@ -64,11 +64,9 @@ namespace PakReader.Pak
}
public string GetFirstExportType() => ExportTypes[0];
public string GetSecondExportType() => ExportTypes.Length > 1 ? ExportTypes[1] : GetFirstExportType();
public IUExport[] GetAllExports() => Exports;
public IUExport GetFirstExport() => Exports[0];
public IUExport GetSecondExport() => Exports.Length > 1 ? Exports[1] : GetFirstExport();
public T GetExport<T>() where T : IUExport
{

View File

@ -64,9 +64,6 @@ namespace PakReader.Parsers.Objects
IndexSize = reader.ReadInt64();
IndexHash = new FSHAHash(reader);
// I'd do some version checking here, but I'd rather not care to check that you loaded a pak file from 2003
// https://github.com/EpicGames/UnrealEngine/blob/8b6414ae4bca5f93b878afadcc41ab518b09984f/Engine/Source/Runtime/PakFile/Public/IPlatformFilePak.h#L185
if (Version < EPakVersion.FNAME_BASED_COMPRESSION_METHOD)
{
CompressionMethods = new string[] { "Zlib", "Gzip", "Oodle" };

View File

@ -348,6 +348,16 @@ namespace FModel.Properties {
}
}
/// <summary>
/// Recherche une ressource localisée de type System.Drawing.Icon semblable à (Icône).
/// </summary>
public static System.Drawing.Icon borderlands3 {
get {
object obj = ResourceManager.GetObject("borderlands3", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Recherche une ressource localisée de type System.Drawing.Bitmap.
/// </summary>

View File

@ -1106,4 +1106,7 @@ It's now the most used free software to leak on Fortnite.</value>
<data name="ExportDirectory" xml:space="preserve">
<value>Export Directory</value>
</data>
<data name="borderlands3" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\borderlands3.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View File

@ -239,9 +239,7 @@ namespace FModel.Utils
}
// Creator Image
if (Globals.Game.ActualGame == EGame.Valorant && TryDrawValorantIcon(entry.Name, p.GetSecondExportType(), p.GetSecondExport()))
return p;
else if (TryDrawIcon(entry.Name, p.GetFirstExportType(), p.GetFirstExport()))
if (TryDrawIcon(entry.Name, p.GetFirstExportType(), p.GetFirstExport()))
return p;
}

View File

@ -27,6 +27,7 @@ namespace FModel.Utils
"FortniteGame" => EGame.Fortnite,
"ShooterGame" => EGame.Valorant,
"DeadByDaylight" => EGame.DeadByDaylight,
"OakGame" => EGame.Borderlands3,
_ => EGame.Unknown,
};
}
@ -40,6 +41,7 @@ namespace FModel.Utils
EGame.Fortnite => "FortniteGame",
EGame.Valorant => "ShooterGame",
EGame.DeadByDaylight => "DeadByDaylight",
EGame.Borderlands3 => "OakGame",
_ => string.Empty,
};

View File

@ -15,7 +15,7 @@ namespace FModel.Utils
/// 3. AppFilesPath
/// </summary>
/// <returns></returns>
public static (string, string, string) GetFortnitePakFilesPath()
public static (string, string, string) GetUEGameFilesPath(string game)
{
foreach (DriveInfo drive in DriveInfo.GetDrives())
{
@ -28,11 +28,11 @@ namespace FModel.Utils
{
foreach (InstallationList installationList in launcherDat.InstallationList)
{
if (installationList.AppName.Equals("Fortnite"))
return (installationList.AppName, installationList.AppVersion, $"{installationList.InstallLocation}\\FortniteGame\\Content\\Paks");
if (installationList.AppName.Equals(game))
return (installationList.AppName, installationList.AppVersion, installationList.InstallLocation);
}
DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[LauncherInstalled.dat]", "Fortnite not found");
DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[LauncherInstalled.dat]", $"{game} not found");
}
}
}
@ -41,6 +41,15 @@ namespace FModel.Utils
return (string.Empty, string.Empty, string.Empty);
}
public static string GetFortnitePakFilesPath()
{
(_, string _, string fortniteFilesPath) = GetUEGameFilesPath("Fortnite");
if (!string.IsNullOrEmpty(fortniteFilesPath))
return $"{fortniteFilesPath}\\FortniteGame\\Content\\Paks";
else
return string.Empty;
}
public static string GetValorantPakFilesPath()
{
foreach (DriveInfo drive in DriveInfo.GetDrives())
@ -65,6 +74,15 @@ namespace FModel.Utils
return string.Empty;
}
public static string GetBorderlands3PakFilesPath()
{
(_, string _, string borderlands3FilesPath) = GetUEGameFilesPath("Catnip");
if (!string.IsNullOrEmpty(borderlands3FilesPath))
return $"{borderlands3FilesPath}\\OakGame\\Content\\Paks";
else
return string.Empty;
}
public static void Merge(Dictionary<string, FPakEntry> tempFiles, out Dictionary<string, FPakEntry> files, string mount)
{
files = new Dictionary<string, FPakEntry>();

View File

@ -213,7 +213,7 @@ namespace FModel.ViewModels.MenuItem
{
DiscordIntegration.Update(
$"{Globals.CachedPakFiles.Count}/{MenuItems.pakFiles.GetPakCount()} {Properties.Resources.PakFiles}",
string.Format("{0} - {1}", Globals.Game.ActualGame,
string.Format("{0} - {1}", Globals.Game.GetName(),
mode == EPakLoader.All ? Properties.Resources.AllFiles :
mode == EPakLoader.New ? Properties.Resources.NewFiles :
mode == EPakLoader.Modified ? Properties.Resources.ModifiedFiles :

View File

@ -6,8 +6,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:FModel.ViewModels.Notifier"
xmlns:core="clr-namespace:ToastNotifications.Core;assembly=ToastNotifications"
mc:Ignorable="d" Background="#FF232930"
d:DesignHeight="60" d:DesignWidth="250"
mc:Ignorable="d"
d:DesignHeight="60" d:DesignWidth="250" MaxWidth="250" MaxHeight="60" Background="#FF232930"
d:DataContext="{d:DesignInstance vm:NotifierViewModel, IsDesignTimeCreatable=False}"
MouseLeftButtonUp="NotificationDisplayPart_MouseLeftButtonUp">
<Grid>

View File

@ -31,7 +31,7 @@ namespace FModel.Windows.Launcher
Games_CbBox.ItemsSource = ComboBoxVm.gamesCbViewModel;
GamesPath_TxtBox.Text = Properties.Settings.Default.PakPath;
(_, string _, string fortniteFilesPath) = Paks.GetFortnitePakFilesPath();
string fortniteFilesPath = Paks.GetFortnitePakFilesPath();
if (!string.IsNullOrEmpty(fortniteFilesPath))
{
DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[LauncherInstalled.dat]", $"Fortnite found at {fortniteFilesPath}");
@ -55,6 +55,14 @@ namespace FModel.Windows.Launcher
ComboBoxVm.gamesCbViewModel.Add(new ComboBoxViewModel { Id = i++, Content = "Valorant", Property = valorantFilesPath });
}
string borderlands3FilesPath = Paks.GetBorderlands3PakFilesPath();
if (!string.IsNullOrEmpty(borderlands3FilesPath))
{
DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[LauncherInstalled.dat]", $"Borderlands 3 found at {borderlands3FilesPath}");
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 });
}
Games_CbBox.SelectedItem = ComboBoxVm.gamesCbViewModel.Where(x => x.Property.ToString() == Properties.Settings.Default.PakPath).FirstOrDefault();
}