mirror of
https://github.com/4sval/FModel.git
synced 2026-06-22 07:50:10 -05:00
hidden vgm + Fortnite 2.4.3 texture support
This commit is contained in:
parent
4d794e8fc8
commit
0bdceb5dd4
|
|
@ -93,6 +93,7 @@ namespace FModel
|
|||
if (Properties.Settings.Default.UseDiscordRpc) DiscordIntegration.StartClient();
|
||||
await AesGrabber.Load(Properties.Settings.Default.ReloadAesKeys).ConfigureAwait(false);
|
||||
await CdnDataGrabber.DoCDNStuff().ConfigureAwait(false);
|
||||
await Folders.DownloadAndExtractVgm().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private void AeConfiguration()
|
||||
|
|
|
|||
|
|
@ -32,20 +32,17 @@ namespace PakReader.Parsers.Class
|
|||
{
|
||||
var data = new List<FTexturePlatformData>(1); // Probably gonna be only one texture anyway
|
||||
var PixelFormatName = reader.ReadFName();
|
||||
if (FModel.Globals.Game.Version < EPakVersion.INDEX_ENCRYPTION)
|
||||
while (!PixelFormatName.IsNone)
|
||||
{
|
||||
_ = reader.ReadInt32(); // SkipOffset
|
||||
if (FModel.Globals.Game.Version >= EPakVersion.RELATIVE_CHUNK_OFFSETS)
|
||||
_ = reader.ReadInt32(); // SkipOffsetH
|
||||
|
||||
data.Add(new FTexturePlatformData(reader, ubulk, bulkOffset));
|
||||
reader.ReadFName();
|
||||
}
|
||||
else
|
||||
{
|
||||
while (!PixelFormatName.IsNone)
|
||||
{
|
||||
_ = reader.ReadInt64(); // SkipOffset
|
||||
data.Add(new FTexturePlatformData(reader, ubulk, bulkOffset));
|
||||
PixelFormatName = reader.ReadFName();
|
||||
}
|
||||
PixelFormatName = reader.ReadFName();
|
||||
|
||||
if (FModel.Globals.Game.Version < EPakVersion.RELATIVE_CHUNK_OFFSETS)
|
||||
break;
|
||||
}
|
||||
PlatformDatas = data.ToArray();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,12 +4,6 @@ namespace PakReader.Parsers.Objects
|
|||
{
|
||||
public readonly struct FByteBulkData : IUStruct
|
||||
{
|
||||
// Memory saving, we don't need this
|
||||
//uint BulkDataFlags;
|
||||
//long ElementCount;
|
||||
//long BulkDataOffsetInFile;
|
||||
//long BulkDataSizeOnDisk;
|
||||
|
||||
public readonly byte[] Data;
|
||||
|
||||
internal FByteBulkData(BinaryReader reader, Stream ubulk, long ubulkOffset)
|
||||
|
|
@ -21,12 +15,23 @@ namespace PakReader.Parsers.Objects
|
|||
var BulkDataOffsetInFile = reader.ReadInt64();
|
||||
|
||||
Data = null;
|
||||
if ((BulkDataFlags & (uint)EBulkDataFlags.BULKDATA_ForceInlinePayload) != 0 && ElementCount > 0)
|
||||
if ((BulkDataFlags & 0x20) != 0 || ElementCount == 0)
|
||||
return;
|
||||
if ((BulkDataFlags & (uint)EBulkDataFlags.BULKDATA_PayloadAtEndOfFile) != 0)
|
||||
{
|
||||
Data = reader.ReadBytes((int)ElementCount);
|
||||
long rememberMe = reader.BaseStream.Position;
|
||||
if (BulkDataOffsetInFile + ElementCount <= reader.BaseStream.Length)
|
||||
{
|
||||
reader.BaseStream.Seek(BulkDataOffsetInFile, SeekOrigin.Begin);
|
||||
Data = reader.ReadBytes(ElementCount);
|
||||
}
|
||||
reader.BaseStream.Seek(rememberMe, SeekOrigin.Begin);
|
||||
}
|
||||
|
||||
if ((BulkDataFlags & (uint)EBulkDataFlags.BULKDATA_PayloadInSeperateFile) != 0)
|
||||
if ((BulkDataFlags & (uint)EBulkDataFlags.BULKDATA_OptionalPayload) != 0) //.uptnl
|
||||
return;
|
||||
if ((BulkDataFlags & (uint)EBulkDataFlags.BULKDATA_ForceInlinePayload) != 0) //.uexp
|
||||
Data = reader.ReadBytes(ElementCount);
|
||||
if ((BulkDataFlags & (uint)EBulkDataFlags.BULKDATA_PayloadInSeperateFile) != 0) //.ubulk
|
||||
{
|
||||
if (ubulk != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -253,6 +253,7 @@ namespace PakReader.Parsers.Objects
|
|||
int stop = Name.LastIndexOf(".") - start;
|
||||
return Name.Substring(start, stop);
|
||||
}
|
||||
public string GetFirstFolder() => Name.Substring(Name.StartsWith('/') ? 1 : 0, Name.IndexOf('/'));
|
||||
|
||||
public override string ToString() => Name;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -267,7 +267,7 @@ namespace FModel.Utils
|
|||
((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
|
||||
else if (s != null)
|
||||
{
|
||||
string path = Properties.Settings.Default.OutputPath + "\\Sounds\\" + mount + entry.GetPathWithoutExtension() + "." + s.AudioFormat.String.ToLowerInvariant();
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
using FModel.Logger;
|
||||
using FModel.Windows.CustomNotifier;
|
||||
using Ionic.Zip;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FModel.Utils
|
||||
{
|
||||
|
|
@ -90,6 +92,25 @@ namespace FModel.Utils
|
|||
Directory.CreateDirectory(Properties.Settings.Default.OutputPath + "\\Logs\\");
|
||||
}
|
||||
|
||||
public static async Task DownloadAndExtractVgm()
|
||||
{
|
||||
if (!Directory.Exists(Properties.Settings.Default.OutputPath + "\\Vgm\\"))
|
||||
{
|
||||
DirectoryInfo vgm = Directory.CreateDirectory(Properties.Settings.Default.OutputPath + "\\Vgm\\");
|
||||
vgm.Attributes = FileAttributes.Directory | FileAttributes.Hidden;
|
||||
|
||||
string zipFile = $"{vgm.FullName}test.zip";
|
||||
using var client = new HttpClientDownloadWithProgress("https://github.com/losnoco/vgmstream/releases/latest/download/test.zip", zipFile);
|
||||
await client.StartDownload().ConfigureAwait(false);
|
||||
if (new FileInfo(zipFile).Length > 0)
|
||||
{
|
||||
ZipFile zip = ZipFile.Read(zipFile);
|
||||
foreach (ZipEntry e in zip)
|
||||
e.Extract(vgm.FullName, ExtractExistingFileAction.OverwriteSilently);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void CheckWatermarks()
|
||||
{
|
||||
bool bSave = false;
|
||||
|
|
|
|||
|
|
@ -179,8 +179,7 @@ namespace FModel.Utils
|
|||
return string.Empty;
|
||||
}
|
||||
|
||||
public static void Merge(Dictionary<string, FPakEntry> tempFiles, out Dictionary<string, FPakEntry> files,
|
||||
string mount)
|
||||
public static void Merge(Dictionary<string, FPakEntry> tempFiles, out Dictionary<string, FPakEntry> files, string mount)
|
||||
{
|
||||
files = new Dictionary<string, FPakEntry>();
|
||||
foreach (FPakEntry entry in tempFiles.Values)
|
||||
|
|
@ -226,6 +225,8 @@ namespace FModel.Utils
|
|||
}
|
||||
|
||||
files[mount + entry.GetPathWithoutExtension()] = entry;
|
||||
if (Globals.Game.ActualGame == EGame.Unknown)
|
||||
Folders.SetGameName((mount.Length == 1 ? entry.GetFirstFolder() : mount) + "\\Content\\Paks");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ namespace FModel.ViewModels.MenuItem
|
|||
Stopwatch downloadTimer = Stopwatch.StartNew();
|
||||
StatusBarVm.statusBarViewModel.Set($"{Properties.Resources.Downloading} {Header}", Properties.Resources.Waiting);
|
||||
|
||||
string path = $"{Properties.Settings.Default.OutputPath}//Backups//{Header}";
|
||||
string path = $"{Properties.Settings.Default.OutputPath}\\Backups\\{Header}";
|
||||
using var client = new HttpClientDownloadWithProgress(DownloadUrl, path);
|
||||
client.ProgressChanged += (totalFileSize, totalBytesDownloaded, progressPercentage) =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -112,6 +112,6 @@ namespace FModel.ViewModels.MenuItem
|
|||
public static IEnumerable<PakFileReader> GetPakFileReaders(this ObservableCollection<dynamic> o) =>
|
||||
Application.Current.Dispatcher.Invoke(() => o.GetMenuItemWithPakFiles().Select(x => x.PakFile));
|
||||
public static IEnumerable<PakFileReader> GetDynamicPakFileReaders(this ObservableCollection<dynamic> o) =>
|
||||
Application.Current.Dispatcher.Invoke(() => o.GetPakFileReaders().Where(x => !x.Info.EncryptionKeyGuid.Equals(new FGuid(0u, 0u, 0u, 0u))));
|
||||
Application.Current.Dispatcher.Invoke(() => o.GetPakFileReaders().Where(x => x.Info.bEncryptedIndex && !x.Info.EncryptionKeyGuid.Equals(new FGuid(0u, 0u, 0u, 0u))));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ namespace FModel.Windows.SoundPlayer
|
|||
/// </summary>
|
||||
private bool TryVGMStreamConvert(ListBoxViewModel2 selectedItem, out string wavFilePath)
|
||||
{
|
||||
if (File.Exists(Properties.Settings.Default.OutputPath + "\\vgmstream\\test.exe"))
|
||||
if (File.Exists(Properties.Settings.Default.OutputPath + "\\Vgm\\test.exe"))
|
||||
{
|
||||
Directory.CreateDirectory(Properties.Settings.Default.OutputPath + "\\Sounds\\" + selectedItem.Folder + "\\");
|
||||
File.WriteAllBytes(Properties.Settings.Default.OutputPath + "\\Sounds\\" + selectedItem.Folder + "\\" + selectedItem.Content, selectedItem.Data);
|
||||
|
|
@ -289,7 +289,7 @@ namespace FModel.Windows.SoundPlayer
|
|||
wavFilePath = Path.ChangeExtension(Properties.Settings.Default.OutputPath + "\\Sounds\\" + selectedItem.Folder + "\\" + selectedItem.Content, ".wav");
|
||||
var vgmstream = Process.Start(new ProcessStartInfo
|
||||
{
|
||||
FileName = Properties.Settings.Default.OutputPath + "\\vgmstream\\test.exe",
|
||||
FileName = Properties.Settings.Default.OutputPath + "\\Vgm\\test.exe",
|
||||
Arguments = $"-o \"{wavFilePath}\" \"{Properties.Settings.Default.OutputPath + "\\Sounds\\" + selectedItem.Folder + "\\" + selectedItem.Content}\"",
|
||||
UseShellExecute = false,
|
||||
RedirectStandardOutput = true,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user