diff --git a/FModel/FModel.csproj b/FModel/FModel.csproj
index b151cddd..169c4db3 100644
--- a/FModel/FModel.csproj
+++ b/FModel/FModel.csproj
@@ -8,8 +8,8 @@
FModel.App
Asval
- 3.1.0.2
- 3.1.0.2
+ 3.1.0.3
+ 3.1.0.3
FModel.ico
https://github.com/iAmAsval/FModel
diff --git a/FModel/Grabber/Aes/AesData.cs b/FModel/Grabber/Aes/AesData.cs
index ee1039e3..c5d8d54c 100644
--- a/FModel/Grabber/Aes/AesData.cs
+++ b/FModel/Grabber/Aes/AesData.cs
@@ -15,10 +15,7 @@ namespace FModel.Grabber.Aes
if (NetworkInterface.GetIsNetworkAvailable())
{
(_, string fortniteVersion, string _) = Utils.Paks.GetFortnitePakFilesPath();
- BenResponse data = !string.IsNullOrEmpty(fortniteVersion)
- ? await Endpoints.GetJsonEndpoint(Endpoints.BENBOT_AES, fortniteVersion)
- .ConfigureAwait(false)
- : await Endpoints.GetJsonEndpoint(Endpoints.BENBOT_AES).ConfigureAwait(false);
+ BenResponse data = await Endpoints.GetJsonEndpoint(Endpoints.BENBOT_AES, fortniteVersion).ConfigureAwait(false);
return data;
}
else
diff --git a/FModel/MainWindow.xaml b/FModel/MainWindow.xaml
index 869af885..5399f247 100644
--- a/FModel/MainWindow.xaml
+++ b/FModel/MainWindow.xaml
@@ -11,7 +11,7 @@
Style="{StaticResource {x:Type Window}}"
Title="FModel"
Height="{Binding Source={x:Static SystemParameters.MaximizedPrimaryScreenHeight}, Converter={utils:Screens}, ConverterParameter='0.80' }"
- Width="{Binding Source={x:Static SystemParameters.MaximizedPrimaryScreenWidth}, Converter={utils:Screens}, ConverterParameter='0.75' }"
+ Width="{Binding Source={x:Static SystemParameters.MaximizedPrimaryScreenWidth}, Converter={utils:Screens}, ConverterParameter='0.70' }"
WindowStartupLocation="CenterScreen" Icon="FModel.ico"
Loaded="OnLoaded" Closing="OnClosing">
diff --git a/FModel/PakReader/Pak/PakFileReader.cs b/FModel/PakReader/Pak/PakFileReader.cs
index ab1eec42..7d856f72 100644
--- a/FModel/PakReader/Pak/PakFileReader.cs
+++ b/FModel/PakReader/Pak/PakFileReader.cs
@@ -443,11 +443,11 @@ namespace PakReader.Pak
{
if (!string.IsNullOrEmpty(path) && Entries.TryGetValue(CaseSensitive ? path : path.ToLowerInvariant(), out var entry))
{
- ret1 = entry.GetData(Stream, AesKey);
+ ret1 = entry.GetData(Stream, AesKey, Info.CompressionMethods);
if (entry.HasUexp())
{
- ret2 = entry.Uexp.GetData(Stream, AesKey);
- ret3 = entry.HasUbulk() ? entry.Ubulk.GetData(Stream, AesKey) : null;
+ ret2 = entry.Uexp.GetData(Stream, AesKey, Info.CompressionMethods);
+ ret3 = entry.HasUbulk() ? entry.Ubulk.GetData(Stream, AesKey, Info.CompressionMethods) : null;
return true;
}
else // return a fail but keep the uasset data
@@ -479,7 +479,7 @@ namespace PakReader.Pak
return false;
}
- public ReadOnlyMemory GetFile(string path) => Entries[CaseSensitive ? path : path.ToLowerInvariant()].GetData(Stream, AesKey);
+ public ReadOnlyMemory GetFile(string path) => Entries[CaseSensitive ? path : path.ToLowerInvariant()].GetData(Stream, AesKey, Info.CompressionMethods);
// IReadOnlyDictionary implementation (to prevent writing to the Entries dictionary
diff --git a/FModel/PakReader/Parsers/Objects/FPakEntry.cs b/FModel/PakReader/Parsers/Objects/FPakEntry.cs
index 6dfce403..8fa8583c 100644
--- a/FModel/PakReader/Parsers/Objects/FPakEntry.cs
+++ b/FModel/PakReader/Parsers/Objects/FPakEntry.cs
@@ -132,7 +132,7 @@ namespace PakReader.Parsers.Objects
StructSize = (int)GetSize(EPakVersion.LATEST, compressionMethodIndex, compressionBlocks != null ? (uint)compressionBlocks.Length : 0);
}
- public ArraySegment GetData(Stream stream, byte[] key)
+ public ArraySegment GetData(Stream stream, byte[] key, string[] compressionMethods)
{
lock (stream)
{
@@ -140,27 +140,42 @@ namespace PakReader.Parsers.Objects
if (Encrypted)
{
var data = new byte[(Size & 15) == 0 ? Size : ((Size / 16) + 1) * 16];
- stream.Read(data);
+ stream.Read(data, 0, data.Length);
byte[] decrypted = AESDecryptor.DecryptAES(data, key);
- if ((ECompressionFlags)CompressionMethodIndex == ECompressionFlags.COMPRESS_ZLIB) // zlib and pray
- decrypted = ZlibStream.UncompressBuffer(decrypted);
+ if (CompressionMethodIndex != 0U) Decompress(stream, compressionMethods, decrypted);
return new ArraySegment(decrypted, 0, (int)UncompressedSize);
}
else
{
var data = new byte[UncompressedSize];
- stream.Read(data);
-
- if ((ECompressionFlags)CompressionMethodIndex == ECompressionFlags.COMPRESS_ZLIB) // zlib and pray
- return new ArraySegment(ZlibStream.UncompressBuffer(data));
- else if ((ECompressionFlags)CompressionMethodIndex == ECompressionFlags.COMPRESS_None)
- return new ArraySegment(data);
+ if (CompressionMethodIndex == 0U)
+ stream.Read(data, 0, data.Length);
+ else
+ Decompress(stream, compressionMethods, data);
+
+ return new ArraySegment(data);
}
}
throw new NotImplementedException("Decompression not yet implemented");
}
+ private void Decompress(Stream stream, string[] compressionMethods, byte[] outData)
+ {
+ if (compressionMethods == null || compressionMethods.Length == 0)
+ throw new IndexOutOfRangeException("CompressionMethods are null or empty");
+
+ var compressionMethod = compressionMethods[CompressionMethodIndex - 1]; // -1 because we dont have 'NAME_None' in the array
+ Stream compressionStream = compressionMethod.ToLower() switch
+ {
+ "zlib" => new ZlibStream(stream, CompressionMode.Decompress, true),
+ "gzip" => new GZipStream(stream, CompressionMode.Decompress, true),
+ _ => throw new NotImplementedException($"Decompression not yet implemented ({compressionMethod})")
+ };
+ compressionStream.Read(outData, 0, outData.Length);
+ compressionStream.Dispose();
+ }
+
public static long GetSize(EPakVersion version, uint CompressionMethodIndex = 0, uint CompressionBlocksCount = 0)
{
long SerializedSize = sizeof(long) + sizeof(long) + sizeof(long) + 20;
diff --git a/FModel/Properties/Resources.Designer.cs b/FModel/Properties/Resources.Designer.cs
index f47894d6..0cf8fe74 100644
--- a/FModel/Properties/Resources.Designer.cs
+++ b/FModel/Properties/Resources.Designer.cs
@@ -768,8 +768,9 @@ namespace FModel.Properties {
}
///
- /// Recherche une chaîne localisée semblable à • Yanteh • FunGames
- ///• HYPEX • Alexander.
+ /// Recherche une chaîne localisée semblable à • Yanteh • Maiky
+ ///• FunGames • HYPEX
+ ///• Alexander.
///
public static string DonatorsFDetails {
get {
diff --git a/FModel/Properties/Resources.resx b/FModel/Properties/Resources.resx
index adbf4e1f..a0116ac1 100644
--- a/FModel/Properties/Resources.resx
+++ b/FModel/Properties/Resources.resx
@@ -361,8 +361,9 @@ It's now the most used free software to leak on Fortnite.
Donators
- • Yanteh • FunGames
-• HYPEX • Alexander
+ • Yanteh • Maiky
+• FunGames • HYPEX
+• Alexander
Do not translate
diff --git a/FModel/ViewModels/MenuItem/PakMenuItemViewModel.cs b/FModel/ViewModels/MenuItem/PakMenuItemViewModel.cs
index 4ea7fb85..d2033c0a 100644
--- a/FModel/ViewModels/MenuItem/PakMenuItemViewModel.cs
+++ b/FModel/ViewModels/MenuItem/PakMenuItemViewModel.cs
@@ -252,22 +252,19 @@ namespace FModel.ViewModels.MenuItem
DebugHelper.WriteLine("{0} {1} {2} {3}", "[FModel]", "[PakMenuItemViewModel]", "[Loader]", $"Backup file is {n}");
var oldFilesTemp = new Dictionary();
- using FileStream fileStream = new FileStream(ofd.FileName, FileMode.Open);
- BinaryReader checkReader = new BinaryReader(fileStream);
- bool isLz4 = checkReader.ReadUInt32() == 0x184D2204u;
- fileStream.Seek(0, SeekOrigin.Begin);
- var target = new MemoryStream();
- if (isLz4)
- {
- using LZ4DecoderStream compressionStream = LZ4Stream.Decode(fileStream);
- compressionStream.CopyTo(target);
- }
- else
- {
- fileStream.CopyTo(target);
- }
- using (target)
+ using (FileStream fileStream = new FileStream(ofd.FileName, FileMode.Open))
+ using (BinaryReader checkReader = new BinaryReader(fileStream))
+ using (MemoryStream target = new MemoryStream())
{
+ bool isLz4 = checkReader.ReadUInt32() == 0x184D2204u;
+ fileStream.Seek(0, SeekOrigin.Begin);
+ if (isLz4)
+ {
+ using LZ4DecoderStream compressionStream = LZ4Stream.Decode(fileStream);
+ compressionStream.CopyTo(target);
+ }
+ else fileStream.CopyTo(target);
+
target.Position = 0;
using BinaryReader reader = new BinaryReader(target);
while (reader.BaseStream.Position < reader.BaseStream.Length)