mirror of
https://github.com/4sval/FModel.git
synced 2026-04-19 08:07:43 -05:00
enabled fortnite live thanks to @NotOfficer
This commit is contained in:
parent
67cc87f8f8
commit
712602b767
|
|
@ -7,9 +7,7 @@ using System.Threading.Tasks;
|
|||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
using EpicManifestParser.Objects;
|
||||
|
||||
using FModel.Grabber.Manifests;
|
||||
using FModel.Logger;
|
||||
using FModel.PakReader.IO;
|
||||
|
|
@ -22,7 +20,7 @@ namespace FModel.Grabber.Paks
|
|||
{
|
||||
static class PaksGrabber
|
||||
{
|
||||
private static readonly Regex _pakFileRegex = new Regex(@"^FortniteGame/Content/Paks/pakchunk(?:0|10.*|\w+)-WindowsClient\.(pak|ucas)$", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||
private static readonly Regex _pakFileRegex = new Regex(@"FortniteGame(/|\\)Content(/|\\)Paks(/|\\)(pakchunk(?:0|10.*|\w+)-WindowsClient|global)\.(pak|ucas)$", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||
|
||||
public static async Task PopulateMenu()
|
||||
{
|
||||
|
|
@ -110,7 +108,7 @@ namespace FModel.Grabber.Paks
|
|||
else if (pakFileName.EndsWith(".ucas"))
|
||||
{
|
||||
var utocStream = manifest.FileManifests.FirstOrDefault(x => x.Name.Equals(fileManifest.Name.Replace(".ucas", ".utoc")));
|
||||
var ioStore = new FFileIoStoreReader(pakFileName.SubstringAfterLast('\\'), utocStream.GetStream(), pakStream);
|
||||
var ioStore = new FFileIoStoreReader(pakFileName.SubstringAfterLast('\\'), pakFileName.SubstringBeforeLast('\\'), utocStream.GetStream(), pakStream);
|
||||
await Application.Current.Dispatcher.InvokeAsync(delegate
|
||||
{
|
||||
MenuItems.pakFiles.Add(new PakMenuItemViewModel
|
||||
|
|
@ -163,9 +161,14 @@ namespace FModel.Grabber.Paks
|
|||
Folders.SetGameName(Properties.Settings.Default.PakPath);
|
||||
|
||||
// paks
|
||||
string[] paks = Directory.GetFiles(Properties.Settings.Default.PakPath, "*.pak");
|
||||
string[] paks = Directory.GetFiles(Properties.Settings.Default.PakPath);
|
||||
for (int i = 0; i < paks.Length; i++)
|
||||
{
|
||||
if (!_pakFileRegex.IsMatch(paks[i]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var pakInfo = new FileInfo(paks[i]);
|
||||
if (pakInfo.Length == 365)
|
||||
{
|
||||
|
|
@ -174,22 +177,50 @@ namespace FModel.Grabber.Paks
|
|||
|
||||
if (!Utils.Paks.IsFileReadLocked(pakInfo))
|
||||
{
|
||||
PakFileReader pakFile = new PakFileReader(paks[i]);
|
||||
DebugHelper.WriteLine("{0} {1} {2} {3}", "[FModel]", "[PAK]", "[Registering]", $"{pakFile.FileName} with GUID {pakFile.Info.EncryptionKeyGuid.Hex}");
|
||||
if (i == 0)
|
||||
if (paks[i].EndsWith(".pak"))
|
||||
{
|
||||
Globals.Game.Version = pakFile.Info.Version;
|
||||
Globals.Game.SubVersion = pakFile.Info.SubVersion;
|
||||
}
|
||||
|
||||
await Application.Current.Dispatcher.InvokeAsync(delegate
|
||||
{
|
||||
MenuItems.pakFiles.Add(new PakMenuItemViewModel
|
||||
PakFileReader pakFile = new PakFileReader(paks[i]);
|
||||
DebugHelper.WriteLine("{0} {1} {2} {3}", "[FModel]", "[PAK]", "[Registering]", $"{pakFile.FileName} with GUID {pakFile.Info.EncryptionKeyGuid.Hex}");
|
||||
if (i == 0)
|
||||
{
|
||||
PakFile = pakFile,
|
||||
IsEnabled = false
|
||||
Globals.Game.Version = pakFile.Info.Version;
|
||||
Globals.Game.SubVersion = pakFile.Info.SubVersion;
|
||||
}
|
||||
|
||||
await Application.Current.Dispatcher.InvokeAsync(delegate
|
||||
{
|
||||
MenuItems.pakFiles.Add(new PakMenuItemViewModel
|
||||
{
|
||||
PakFile = pakFile,
|
||||
IsEnabled = false
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
else if (paks[i].EndsWith(".ucas"))
|
||||
{
|
||||
var utoc = paks[i].Replace(".ucas", ".utoc");
|
||||
if (!Utils.Paks.IsFileReadLocked(new FileInfo(utoc)))
|
||||
{
|
||||
var utocStream = new MemoryStream(await File.ReadAllBytesAsync(utoc));
|
||||
var ucasStream = File.OpenRead(paks[i]);
|
||||
var ioStore = new FFileIoStoreReader(paks[i].SubstringAfterLast('\\'), paks[i].SubstringBeforeLast('\\'), utocStream, ucasStream);
|
||||
DebugHelper.WriteLine("{0} {1} {2} {3}", "[FModel]", "[IO Store]", "[Registering]", $"{ioStore.FileName} with GUID {ioStore.TocResource.Header.EncryptionKeyGuid.Hex}");
|
||||
|
||||
await Application.Current.Dispatcher.InvokeAsync(delegate
|
||||
{
|
||||
MenuItems.pakFiles.Add(new PakMenuItemViewModel
|
||||
{
|
||||
IoStore = ioStore,
|
||||
IsEnabled = false
|
||||
});
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
FConsole.AppendText(string.Format(Properties.Resources.PakFileLocked, Path.GetFileNameWithoutExtension(utoc)), FColors.Red, true);
|
||||
DebugHelper.WriteLine("{0} {1} {2} {3}", "[FModel]", "[IO Store]", "[Locked]", utoc);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -202,28 +233,7 @@ namespace FModel.Grabber.Paks
|
|||
var utocs = Directory.GetFiles(Properties.Settings.Default.PakPath, "*.utoc");
|
||||
foreach (var utoc in utocs)
|
||||
{
|
||||
var ucas = utoc.Replace(".utoc", ".ucas");
|
||||
if (!Utils.Paks.IsFileReadLocked(new FileInfo(utoc)) && !Utils.Paks.IsFileReadLocked(new FileInfo(ucas)))
|
||||
{
|
||||
var utocStream = new MemoryStream(await File.ReadAllBytesAsync(utoc));
|
||||
var ucasStream = File.OpenRead(ucas);
|
||||
var ioStore = new FFileIoStoreReader(ucas.SubstringAfterLast('\\'), utocStream, ucasStream);
|
||||
DebugHelper.WriteLine("{0} {1} {2} {3}", "[FModel]", "[IO Store]", "[Registering]", $"{ioStore.FileName} with GUID {ioStore.TocResource.Header.EncryptionKeyGuid.Hex}");
|
||||
|
||||
await Application.Current.Dispatcher.InvokeAsync(delegate
|
||||
{
|
||||
MenuItems.pakFiles.Add(new PakMenuItemViewModel
|
||||
{
|
||||
IoStore = ioStore,
|
||||
IsEnabled = false
|
||||
});
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
FConsole.AppendText(string.Format(Properties.Resources.PakFileLocked, Path.GetFileNameWithoutExtension(utoc)), FColors.Red, true);
|
||||
DebugHelper.WriteLine("{0} {1} {2} {3}", "[FModel]", "[IO Store]", "[Locked]", utoc);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ namespace FModel.PakReader.IO
|
|||
public class FFileIoStoreReader : IReadOnlyDictionary<string, FIoStoreEntry>
|
||||
{
|
||||
public readonly string FileName;
|
||||
public readonly string Directory;
|
||||
public readonly FIoStoreTocResource TocResource;
|
||||
public readonly Dictionary<FIoChunkId, FIoOffsetAndLength> Toc;
|
||||
public readonly FFileIoStoreContainerFile ContainerFile;
|
||||
|
|
@ -49,9 +50,10 @@ namespace FModel.PakReader.IO
|
|||
public FIoDirectoryIndexResource _directoryIndex;
|
||||
private byte[] _directoryIndexBuffer;
|
||||
|
||||
public FFileIoStoreReader(string fileName, Stream tocStream, Stream containerStream, bool caseSensitive = true, EIoStoreTocReadOptions tocReadOptions = EIoStoreTocReadOptions.ReadDirectoryIndex)
|
||||
public FFileIoStoreReader(string fileName, string dir, Stream tocStream, Stream containerStream, bool caseSensitive = true, EIoStoreTocReadOptions tocReadOptions = EIoStoreTocReadOptions.ReadDirectoryIndex)
|
||||
{
|
||||
FileName = fileName;
|
||||
Directory = dir;
|
||||
CaseSensitive = caseSensitive;
|
||||
ContainerFile.FileHandle = containerStream;
|
||||
var tocResource = new FIoStoreTocResource(tocStream, tocReadOptions);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,9 @@ namespace FModel.PakReader.IO
|
|||
|
||||
public FIoStoreTocResource(Stream tocStream, EIoStoreTocReadOptions readOptions = EIoStoreTocReadOptions.Default)
|
||||
{
|
||||
using var reader = new BinaryReader(tocStream);
|
||||
var streamBuffer = new byte[tocStream.Length];
|
||||
tocStream.Read(streamBuffer, 0, streamBuffer.Length);
|
||||
using var reader = new BinaryReader(new MemoryStream(streamBuffer));
|
||||
Header = new FIoStoreTocHeader(reader);
|
||||
|
||||
var totalTocSize = tocStream.Length - FIoStoreTocHeader.SIZE;
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ namespace FModel.Utils
|
|||
string trigger;
|
||||
{
|
||||
if (Properties.Settings.Default.PakPath.EndsWith(".manifest"))
|
||||
trigger = $"{menuItem.PakFile.Directory.Replace('\\', '/')}/{fileName}";
|
||||
trigger = $"{(menuItem.IsPakFileReader ? menuItem.PakFile.Directory.Replace('\\', '/') : menuItem.IoStore.Directory.Replace('\\', '/'))}/{fileName}";
|
||||
else
|
||||
trigger = $"{Properties.Settings.Default.PakPath[Properties.Settings.Default.PakPath.LastIndexOf(Folders.GetGameName(), StringComparison.Ordinal)..].Replace("\\", "/")}/{fileName}";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ namespace FModel.Windows.Launcher
|
|||
ComboBoxVm.gamesCbViewModel.Add(new ComboBoxViewModel { Id = i++, Content = Properties.Resources.GameName_Fortnite + " [EGL2]", Property = egl2FilesPath });
|
||||
}
|
||||
|
||||
//ComboBoxVm.gamesCbViewModel.Add(new ComboBoxViewModel { Id = i++, Content = Properties.Resources.GameName_Fortnite + " [LIVE]", Property = "donotedit-youcanteditanyway-fn.manifest" });
|
||||
ComboBoxVm.gamesCbViewModel.Add(new ComboBoxViewModel { Id = i++, Content = Properties.Resources.GameName_Fortnite + " [LIVE]", Property = "donotedit-youcanteditanyway-fn.manifest" });
|
||||
|
||||
string valorantFilesPath = Paks.GetValorantPakFilesPath();
|
||||
if (!string.IsNullOrEmpty(valorantFilesPath))
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user