diff --git a/FModel/PakReader/Parsers/Class/UAkAudioEvent.cs b/FModel/PakReader/Parsers/Class/UAkAudioEvent.cs deleted file mode 100644 index e8f432dd..00000000 --- a/FModel/PakReader/Parsers/Class/UAkAudioEvent.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using System.Runtime.CompilerServices; - -namespace PakReader.Parsers.Class -{ - public sealed class UAkAudioEvent : IUExport - { - readonly Dictionary Map; - - internal UAkAudioEvent(PackageReader reader) - { - _ = new UObject(reader, true); - Map = new Dictionary(1) - { - { "MaxAttenuationRadius", reader.ReadFloat() } - }; - } - - public object this[string key] => Map[key]; - public IEnumerable Keys => Map.Keys; - public IEnumerable Values => Map.Values; - public int Count => Map.Count; - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool ContainsKey(string key) => Map.ContainsKey(key); - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public IEnumerator> GetEnumerator() => Map.GetEnumerator(); - [MethodImpl(MethodImplOptions.AggressiveInlining)] - IEnumerator IEnumerable.GetEnumerator() => Map.GetEnumerator(); - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryGetValue(string key, out object value) => Map.TryGetValue(key, out value); - } -} diff --git a/FModel/PakReader/Parsers/Class/UAkMediaAssetData.cs b/FModel/PakReader/Parsers/Class/UAkMediaAssetData.cs new file mode 100644 index 00000000..94312972 --- /dev/null +++ b/FModel/PakReader/Parsers/Class/UAkMediaAssetData.cs @@ -0,0 +1,40 @@ +using PakReader.Parsers.Objects; +using System; +using System.IO; +using System.Linq; + +namespace PakReader.Parsers.Class +{ + public sealed class UAkMediaAssetData : UObject + { + public FAkMediaDataChunk[] DataChunks { get; } + + byte[] sound; + public byte[] Sound + { + get + { + if (sound == null) + { + sound = new byte[this.DataChunks.Sum(x => x.Data.Data.Length)]; + int offset = 0; + for (int i = 0; i < this.DataChunks.Length; i++) + { + Buffer.BlockCopy(this.DataChunks[i].Data.Data, 0, sound, offset, this.DataChunks[i].Data.Data.Length); + offset += this.DataChunks[i].Data.Data.Length; + } + } + return sound; + } + } + + internal UAkMediaAssetData(PackageReader reader, Stream ubulk, long bulkOffset) : base(reader) + { + DataChunks = new FAkMediaDataChunk[reader.ReadInt32()]; + for (int i = 0; i < DataChunks.Length; ++i) + { + DataChunks[i] = new FAkMediaDataChunk(reader, ubulk, bulkOffset); + } + } + } +} diff --git a/FModel/PakReader/Parsers/Objects/FAkMediaDataChunk.cs b/FModel/PakReader/Parsers/Objects/FAkMediaDataChunk.cs new file mode 100644 index 00000000..30b15729 --- /dev/null +++ b/FModel/PakReader/Parsers/Objects/FAkMediaDataChunk.cs @@ -0,0 +1,16 @@ +using System.IO; + +namespace PakReader.Parsers.Objects +{ + public readonly struct FAkMediaDataChunk : IUStruct + { + public readonly FByteBulkData Data; + public readonly bool IsPrefetch; + + internal FAkMediaDataChunk(PackageReader reader, Stream ubulk, long bulkOffset) + { + IsPrefetch = reader.ReadInt32() != 0; + Data = new FByteBulkData(reader, ubulk, bulkOffset); + } + } +} diff --git a/FModel/PakReader/Parsers/PackageReader.cs b/FModel/PakReader/Parsers/PackageReader.cs index 7c61514d..b3ba3fd2 100644 --- a/FModel/PakReader/Parsers/PackageReader.cs +++ b/FModel/PakReader/Parsers/PackageReader.cs @@ -57,7 +57,7 @@ namespace PakReader.Parsers "FontFace" => new UFontFace(this, ubulk), "SoundWave" => new USoundWave(this, ubulk, ExportMap.Sum(e => e.SerialSize) + PackageFileSummary.TotalHeaderSize), "StringTable" => new UStringTable(this), - //"AkAudioEvent" => new UAkAudioEvent(this), + "AkMediaAssetData" => new UAkMediaAssetData(this, ubulk, ExportMap.Sum(e => e.SerialSize) + PackageFileSummary.TotalHeaderSize), _ => new UObject(this), }; diff --git a/FModel/Properties/Resources.pt-PT.resx b/FModel/Properties/Resources.pt-PT.resx index e5e8d6e4..29995e51 100644 --- a/FModel/Properties/Resources.pt-PT.resx +++ b/FModel/Properties/Resources.pt-PT.resx @@ -279,14 +279,6 @@ Contribuidoras - - • Waddlesworth • Maiky -• FunGames • Not Officer -• PsychoPast • TSG -• GMatrixGames • Jackson -• XTigerHyperX • FireMonkey - Do not translate - Copiado! @@ -345,14 +337,6 @@ Doadores - - • Yanteh • Maiky -• FunGames • HYPEX ♥ -• Alexander • Netu ♥ -• SexyNutella • imatrix -• Frenzy Leaks • LlamaLeaks - Do not translate - Erro Ao Fazer Download De {0} @@ -738,9 +722,7 @@ FModel Lançador General Settings Window - FModel Está Prestes A Reiniciar Porque Você Aplicou Seu (s) Novo (s) Caminho ( -FModel está prestes a reiniciar porque você aplicou seu (s) novo (s) caminho -FModel está prestes a reiniciar porque você aplicou seu (s) novo (s) caminho (s) + FModel está prestes a reiniciar porque você aplicou seu (s) novo (s) caminho (s) General Settings Window @@ -933,14 +915,6 @@ FModel está prestes a reiniciar porque você aplicou seu (s) novo (s) caminho ( Tradutores - - • EN: Asval#2291 • FR: Asval#2291 -• DE: FunGames#6822 • IT: arianaglande#5581 -• ES: Maiky.M#9879 • AR: PsychoPast#0001 -• JA: FNJPNews#7820 • RU: Seawod#4311 -• CN: GMatrixGames#6929 - Do not translate - Turco @@ -1063,9 +1037,6 @@ FModel está prestes a reiniciar porque você aplicou seu (s) novo (s) caminho ( ..\Resources\Xml.xshd;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Trello - ..\Resources\trello.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/FModel/Properties/Settings.cs b/FModel/Properties/Settings.cs index dfa638f3..153f0445 100644 --- a/FModel/Properties/Settings.cs +++ b/FModel/Properties/Settings.cs @@ -11,7 +11,6 @@ namespace FModel.Properties public sealed partial class Settings { private static string _userSettings = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\FModel\\DoNotDelete.json"; - private static readonly Regex _pakFileRegex = new Regex(@"^FortniteGame/Content/Paks/pakchunk(?:0|10.*|\w+)-WindowsClient\.pak$", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant); /// /// IMPORTANT: i believe Upgrade doesn't like int32 so use int64 (maybe because it's for x64?) for all int values diff --git a/FModel/Utils/Assets.cs b/FModel/Utils/Assets.cs index ba8a74ac..1ca584e7 100644 --- a/FModel/Utils/Assets.cs +++ b/FModel/Utils/Assets.cs @@ -219,6 +219,23 @@ namespace FModel.Utils return p; } + var ak = p.GetExport(); + if (ak != null) + { + if (Properties.Settings.Default.AutoOpenSounds) + { + Application.Current.Dispatcher.Invoke(delegate + { + DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[Window]", $"Opening Audio Player for {entry.GetNameWithExtension()}"); + if (!FWindows.IsWindowOpen(Properties.Resources.AudioPlayer)) + new AudioPlayer().LoadFile(ak.Sound, entry.GetNameWithoutExtension() + ".wem", mount + entry.GetPathWithoutFile()); + else + ((AudioPlayer)FWindows.GetOpenedWindow(Properties.Resources.AudioPlayer)).LoadFile(ak.Sound, entry.GetNameWithoutExtension() + ".wem", mount + entry.GetPathWithoutFile()); + }); + } + return p; + } + // Sound var s = p.GetExport(); if (s != null && (s.AudioFormat.String.Equals("OGG") || s.AudioFormat.String.Equals("OGG10000-1-1-1-1-1"))) diff --git a/FModel/Utils/EGL2.cs b/FModel/Utils/EGL2.cs index 6e896231..1b760102 100644 --- a/FModel/Utils/EGL2.cs +++ b/FModel/Utils/EGL2.cs @@ -18,10 +18,10 @@ namespace FModel.Utils using Stream stream = new BufferedStream(new FileInfo(configFile).Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite)); using BinaryReader reader = new BinaryReader(stream, Encoding.Default); if (reader.ReadUInt32() != FILE_CONFIG_MAGIC) - throw new FileLoadException("Invalid EGL2 Config Magic"); + return string.Empty; if (reader.ReadUInt16BE() < FILE_CONFIG_VERSION) - throw new FileLoadException("Invalid EGL2 Config Version"); + return string.Empty; int stringLength = reader.ReadUInt16BE(); string cacheDirectory = Encoding.UTF8.GetString(reader.ReadBytes(stringLength)); diff --git a/FModel/Windows/SoundPlayer/AudioPlayer.xaml.cs b/FModel/Windows/SoundPlayer/AudioPlayer.xaml.cs index 9d63728d..817a6e70 100644 --- a/FModel/Windows/SoundPlayer/AudioPlayer.xaml.cs +++ b/FModel/Windows/SoundPlayer/AudioPlayer.xaml.cs @@ -121,6 +121,18 @@ namespace FModel.Windows.SoundPlayer } } + public void LoadFile(byte[] sound, string assetName, string gameFolder) + { + Focus(); + ListBoxVm.soundFiles.Add(new ListBoxViewModel2 + { + Content = assetName, + Data = sound, + FullPath = string.Empty, + Folder = gameFolder + }); + } + public void LoadFile(string filepath) { ListBoxViewModel2 item = ListBoxVm.soundFiles.Where(x => x.FullPath.Equals(filepath)).FirstOrDefault();