mirror of
https://github.com/4sval/FModel.git
synced 2026-04-22 01:27:43 -05:00
auto detection of pak8 UE4.22 or UE4.23 (hopefully)
This commit is contained in:
parent
2c3a05684e
commit
f05293187a
|
|
@ -161,7 +161,7 @@ namespace PakReader.Pak
|
|||
else
|
||||
{
|
||||
// https://github.com/EpicGames/UnrealEngine/blob/bf95c2cbc703123e08ab54e3ceccdd47e48d224a/Engine/Source/Runtime/PakFile/Private/IPlatformFilePak.cpp#L4509
|
||||
MountPoint = IndexReader.ReadFString();
|
||||
MountPoint = IndexReader.ReadFString() ?? "";
|
||||
if (MountPoint.StartsWith("../../.."))
|
||||
{
|
||||
MountPoint = MountPoint.Substring(8);
|
||||
|
|
@ -180,7 +180,7 @@ namespace PakReader.Pak
|
|||
tempFiles = new Dictionary<string, FPakEntry>(NumEntries);
|
||||
for (int i = 0; i < NumEntries; i++)
|
||||
{
|
||||
var entry = new FPakEntry(IndexReader, Info.Version, CaseSensitive, FileName);
|
||||
var entry = new FPakEntry(IndexReader, Info.Version, Info.SubVersion, CaseSensitive, FileName);
|
||||
// if there is no filter OR the filter passes
|
||||
if (filter == null || filter.CheckFilter(MountPoint + entry.Name, CaseSensitive))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ namespace PakReader.Parsers.Objects
|
|||
|
||||
public readonly int StructSize;
|
||||
|
||||
internal FPakEntry(BinaryReader reader, EPakVersion Version, bool caseSensitive, string pakName)
|
||||
internal FPakEntry(BinaryReader reader, EPakVersion Version, int SubVersion, bool caseSensitive, string pakName)
|
||||
{
|
||||
CompressionBlocks = null;
|
||||
CompressionBlockSize = 0;
|
||||
|
|
@ -66,7 +66,7 @@ namespace PakReader.Parsers.Objects
|
|||
}
|
||||
else
|
||||
{
|
||||
if (FModel.Globals.Game.ActualGame != FModel.EGame.Valorant && Version == EPakVersion.FNAME_BASED_COMPRESSION_METHOD)
|
||||
if (Version == EPakVersion.FNAME_BASED_COMPRESSION_METHOD && SubVersion == 0)
|
||||
CompressionMethodIndex = reader.ReadByte();
|
||||
else
|
||||
CompressionMethodIndex = reader.ReadUInt32();
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ namespace PakReader.Parsers.Objects
|
|||
|
||||
// Magic // 4 bytes
|
||||
public readonly EPakVersion Version; // 4 bytes
|
||||
public readonly int SubVersion;
|
||||
public readonly long IndexOffset; // 8 bytes
|
||||
public readonly long IndexSize; // 8 bytes
|
||||
public readonly FSHAHash IndexHash; // 20 bytes
|
||||
|
|
@ -46,10 +47,11 @@ namespace PakReader.Parsers.Objects
|
|||
// Serialize if version is at least EPakVersion.ENCRYPTION_KEY_GUID
|
||||
EncryptionKeyGuid = new FGuid(reader);
|
||||
bEncryptedIndex = reader.ReadByte() != 0;
|
||||
|
||||
|
||||
if (reader.ReadUInt32() != PAK_FILE_MAGIC)
|
||||
{
|
||||
Version = EPakVersion.INVALID;
|
||||
SubVersion = 0;
|
||||
IndexOffset = 0;
|
||||
IndexSize = 0;
|
||||
IndexHash = default;
|
||||
|
|
@ -60,6 +62,12 @@ namespace PakReader.Parsers.Objects
|
|||
}
|
||||
|
||||
Version = (EPakVersion)reader.ReadInt32();
|
||||
int b;
|
||||
if (maxNumCompressionMethods == 5 && Version == EPakVersion.FNAME_BASED_COMPRESSION_METHOD) // UE4.23
|
||||
b = (((int)Version) << 4) | (1);
|
||||
else
|
||||
b = (((int)Version) << 4) | (0);
|
||||
SubVersion = b & 15;
|
||||
IndexOffset = reader.ReadInt64();
|
||||
IndexSize = reader.ReadInt64();
|
||||
IndexHash = new FSHAHash(reader);
|
||||
|
|
|
|||
|
|
@ -257,6 +257,17 @@ namespace FModel.Utils
|
|||
}
|
||||
return p;
|
||||
}
|
||||
else if (s != null && (s.AudioFormat.String.Equals("OPUS") || s.AudioFormat.String.Equals("ADPCM")))
|
||||
{
|
||||
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().LoadFiles(new Dictionary<string, byte[]>(1) {{ entry.GetNameWithoutExtension() + "." + s.AudioFormat.String.ToLowerInvariant(), s.Sound }}, entry.GetPathWithoutFile());
|
||||
else
|
||||
((AudioPlayer)FWindows.GetOpenedWindow<Window>(Properties.Resources.AudioPlayer)).LoadFiles(new Dictionary<string, byte[]>(1) { { entry.GetNameWithoutExtension() + "." + s.AudioFormat.String.ToLowerInvariant(), s.Sound } }, entry.GetPathWithoutFile());
|
||||
});
|
||||
}
|
||||
else if (s != null) // ADPCM and others
|
||||
{
|
||||
string path = Properties.Settings.Default.OutputPath + "\\Sounds\\" + mount + entry.GetPathWithoutExtension() + "." + s.AudioFormat.String.ToLowerInvariant();
|
||||
|
|
|
|||
|
|
@ -80,7 +80,12 @@ namespace FModel.Windows.SoundPlayer
|
|||
{
|
||||
Focus();
|
||||
|
||||
ListBoxVm.soundFiles.Clear();
|
||||
if (files.Count > 5)
|
||||
{
|
||||
ListBoxVm.soundFiles.Clear();
|
||||
if (output.HasMedia) output.Stop();
|
||||
}
|
||||
|
||||
foreach (var (key, value) in files)
|
||||
{
|
||||
ListBoxVm.soundFiles.Add(new ListBoxViewModel2
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user