mirror of
https://github.com/4sval/FModel.git
synced 2026-03-21 17:24:26 -05:00
Added support for Valorant new sound structure
This commit is contained in:
parent
dab19587eb
commit
c8422a005e
|
|
@ -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<string, object> Map;
|
||||
|
||||
internal UAkAudioEvent(PackageReader reader)
|
||||
{
|
||||
_ = new UObject(reader, true);
|
||||
Map = new Dictionary<string, object>(1)
|
||||
{
|
||||
{ "MaxAttenuationRadius", reader.ReadFloat() }
|
||||
};
|
||||
}
|
||||
|
||||
public object this[string key] => Map[key];
|
||||
public IEnumerable<string> Keys => Map.Keys;
|
||||
public IEnumerable<object> Values => Map.Values;
|
||||
public int Count => Map.Count;
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool ContainsKey(string key) => Map.ContainsKey(key);
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public IEnumerator<KeyValuePair<string, object>> 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);
|
||||
}
|
||||
}
|
||||
40
FModel/PakReader/Parsers/Class/UAkMediaAssetData.cs
Normal file
40
FModel/PakReader/Parsers/Class/UAkMediaAssetData.cs
Normal file
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
16
FModel/PakReader/Parsers/Objects/FAkMediaDataChunk.cs
Normal file
16
FModel/PakReader/Parsers/Objects/FAkMediaDataChunk.cs
Normal file
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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),
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -279,14 +279,6 @@
|
|||
<data name="ContributorsF" xml:space="preserve">
|
||||
<value>Contribuidoras</value>
|
||||
</data>
|
||||
<data name="ContributorsFDetails" xml:space="preserve">
|
||||
<value>• Waddlesworth • Maiky
|
||||
• FunGames • Not Officer
|
||||
• PsychoPast • TSG
|
||||
• GMatrixGames • Jackson
|
||||
• XTigerHyperX • FireMonkey</value>
|
||||
<comment>Do not translate</comment>
|
||||
</data>
|
||||
<data name="CopySuccess" xml:space="preserve">
|
||||
<value>Copiado!</value>
|
||||
</data>
|
||||
|
|
@ -345,14 +337,6 @@
|
|||
<data name="DonatorsF" xml:space="preserve">
|
||||
<value>Doadores</value>
|
||||
</data>
|
||||
<data name="DonatorsFDetails" xml:space="preserve">
|
||||
<value>• Yanteh • Maiky
|
||||
• FunGames • HYPEX ♥
|
||||
• Alexander • Netu ♥
|
||||
• SexyNutella • imatrix
|
||||
• Frenzy Leaks • LlamaLeaks</value>
|
||||
<comment>Do not translate</comment>
|
||||
</data>
|
||||
<data name="DownloadError" xml:space="preserve">
|
||||
<value>Erro Ao Fazer Download De {0}</value>
|
||||
</data>
|
||||
|
|
@ -738,9 +722,7 @@ FModel Lançador</value>
|
|||
<comment>General Settings Window</comment>
|
||||
</data>
|
||||
<data name="PathChangedRestart" xml:space="preserve">
|
||||
<value>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)</value>
|
||||
<value>FModel está prestes a reiniciar porque você aplicou seu (s) novo (s) caminho (s)</value>
|
||||
<comment>General Settings Window</comment>
|
||||
</data>
|
||||
<data name="pause" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
|
|
@ -933,14 +915,6 @@ FModel está prestes a reiniciar porque você aplicou seu (s) novo (s) caminho (
|
|||
<data name="TranslatorsF" xml:space="preserve">
|
||||
<value>Tradutores</value>
|
||||
</data>
|
||||
<data name="TranslatorsFDetails" xml:space="preserve">
|
||||
<value>• 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</value>
|
||||
<comment>Do not translate</comment>
|
||||
</data>
|
||||
<data name="Turkish" xml:space="preserve">
|
||||
<value>Turco</value>
|
||||
</data>
|
||||
|
|
@ -1063,9 +1037,6 @@ FModel está prestes a reiniciar porque você aplicou seu (s) novo (s) caminho (
|
|||
<data name="Xml" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Xml.xshd;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="Trello" xml:space="preserve">
|
||||
<value>Trello</value>
|
||||
</data>
|
||||
<data name="trello1" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\trello.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
/// <summary>
|
||||
/// IMPORTANT: i believe Upgrade doesn't like int32 so use int64 (maybe because it's for x64?) for all int values
|
||||
|
|
|
|||
|
|
@ -219,6 +219,23 @@ namespace FModel.Utils
|
|||
return p;
|
||||
}
|
||||
|
||||
var ak = p.GetExport<UAkMediaAssetData>();
|
||||
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<Window>(Properties.Resources.AudioPlayer))
|
||||
new AudioPlayer().LoadFile(ak.Sound, entry.GetNameWithoutExtension() + ".wem", mount + entry.GetPathWithoutFile());
|
||||
else
|
||||
((AudioPlayer)FWindows.GetOpenedWindow<Window>(Properties.Resources.AudioPlayer)).LoadFile(ak.Sound, entry.GetNameWithoutExtension() + ".wem", mount + entry.GetPathWithoutFile());
|
||||
});
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
// Sound
|
||||
var s = p.GetExport<USoundWave>();
|
||||
if (s != null && (s.AudioFormat.String.Equals("OGG") || s.AudioFormat.String.Equals("OGG10000-1-1-1-1-1")))
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user