mirror of
https://github.com/4sval/FModel.git
synced 2026-04-01 06:35:36 -05:00
added EGL2 1.3 or newer support
This commit is contained in:
parent
9fdd2a866e
commit
c9aee79f43
|
|
@ -1,13 +0,0 @@
|
|||
namespace PakReader.Parsers.Objects
|
||||
{
|
||||
public readonly struct FFloatCurve : IUStruct
|
||||
{
|
||||
/** Curve data for float. */
|
||||
public readonly FRichCurveKey[] FloatCurve; // actually FRichCurve
|
||||
|
||||
internal FFloatCurve(PackageReader reader)
|
||||
{
|
||||
FloatCurve = reader.ReadTArray(() => new FRichCurveKey(reader));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
namespace PakReader.Parsers.Objects
|
||||
{
|
||||
public readonly struct FRawCurveTracks : IUStruct
|
||||
{
|
||||
public readonly FFloatCurve[] FloatCurves;
|
||||
public readonly FVectorCurve[] VectorCurves;
|
||||
public readonly FTransformCurve[] TransformCurves;
|
||||
|
||||
internal FRawCurveTracks(PackageReader reader)
|
||||
{
|
||||
FloatCurves = reader.ReadTArray(() => new FFloatCurve(reader));
|
||||
VectorCurves = reader.ReadTArray(() => new FVectorCurve(reader));
|
||||
TransformCurves = reader.ReadTArray(() => new FTransformCurve(reader));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
namespace PakReader.Parsers.Objects
|
||||
{
|
||||
public readonly struct FTransformCurve : IUStruct
|
||||
{
|
||||
/** Curve data for each transform. */
|
||||
public readonly FVectorCurve TranslationCurve;
|
||||
|
||||
internal FTransformCurve(PackageReader reader)
|
||||
{
|
||||
TranslationCurve = new FVectorCurve(reader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
namespace PakReader.Parsers.Objects
|
||||
{
|
||||
public readonly struct FVectorCurve : IUStruct
|
||||
{
|
||||
/** Curve data for float. */
|
||||
public readonly FRichCurveKey[] FloatCurves; // actually FRichCurve
|
||||
|
||||
internal FVectorCurve(PackageReader reader)
|
||||
{
|
||||
FloatCurves = new FRichCurveKey[3];
|
||||
for (int i = 0; i < FloatCurves.Length; i++)
|
||||
{
|
||||
FloatCurves[i] = new FRichCurveKey(reader);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -51,7 +51,6 @@ namespace PakReader.Parsers.Objects
|
|||
"VectorMaterialInput" => new FVectorMaterialInput(reader),
|
||||
"ColorMaterialInput" => new FColorMaterialInput(reader),
|
||||
"ExpressionInput" => new FMaterialInput(reader),
|
||||
//"RawCurveTracks" => new FRawCurveTracks(reader),
|
||||
_ => new UObject(reader, true),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,60 @@
|
|||
namespace FModel.Utils
|
||||
using FModel.Logger;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace FModel.Utils
|
||||
{
|
||||
/// <summary>
|
||||
/// https://github.com/WorkingRobot/EGL2/blob/60c06ed0fb2a5e7c0798c401d7de57b6151716d8/gui/settings.cpp#L81
|
||||
/// </summary>
|
||||
static class EGL2
|
||||
{
|
||||
const uint FILE_CONFIG_MAGIC = 0xE6219B27;
|
||||
const ushort FILE_CONFIG_VERSION = (ushort)ESettingsVersion.Latest;
|
||||
const uint FILE_CONFIG_MAGIC = 0x279B21E6;
|
||||
const ushort FILE_CONFIG_VERSION = (ushort)ESettingsVersion.Version13;
|
||||
|
||||
public static string GetEGL2PakFilesPath()
|
||||
{
|
||||
string configFile = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\EGL2\\config";
|
||||
if (File.Exists(configFile))
|
||||
{
|
||||
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 file magic");
|
||||
|
||||
if (reader.ReadUInt16BE() != FILE_CONFIG_VERSION)
|
||||
throw new FileLoadException("Invalid egl2 version");
|
||||
|
||||
int stringLength = reader.ReadUInt16BE();
|
||||
string cacheDirectory = Encoding.UTF8.GetString(reader.ReadBytes(stringLength));
|
||||
if (Directory.Exists(cacheDirectory + "\\game\\FortniteGame\\Content\\Paks"))
|
||||
{
|
||||
return cacheDirectory + "\\game\\FortniteGame\\Content\\Paks";
|
||||
}
|
||||
}
|
||||
|
||||
DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[EGL2]", "Fortnite not found");
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
private static ushort ReadUInt16BE(this BinaryReader binRdr)
|
||||
{
|
||||
return BitConverter.ToUInt16(binRdr.ReadBytesRequired(sizeof(ushort)).Reverse(), 0);
|
||||
}
|
||||
|
||||
public static byte[] Reverse(this byte[] b)
|
||||
{
|
||||
Array.Reverse(b);
|
||||
return b;
|
||||
}
|
||||
|
||||
private static byte[] ReadBytesRequired(this BinaryReader binRdr, int byteCount)
|
||||
{
|
||||
var result = binRdr.ReadBytes(byteCount);
|
||||
|
||||
if (result.Length != byteCount)
|
||||
throw new EndOfStreamException(string.Format("{0} bytes required from stream, but only {1} returned.", byteCount, result.Length));
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public enum ESettingsVersion : ushort
|
||||
|
|
@ -18,7 +66,40 @@
|
|||
// Adds CommandArgs
|
||||
SimplifyPathsAndCmdLine,
|
||||
|
||||
// Adds ThreadCount, BufferCount, and UpdateInterval
|
||||
// Removes VerifyCache and EnableGaming
|
||||
Version13,
|
||||
|
||||
LatestPlusOne,
|
||||
Latest = LatestPlusOne - 1
|
||||
}
|
||||
|
||||
public enum ESettingsCompressionMethod : byte
|
||||
{
|
||||
Zstandard,
|
||||
LZ4,
|
||||
Decompressed
|
||||
}
|
||||
|
||||
public enum ESettingsCompressionLevel : byte
|
||||
{
|
||||
Fastest,
|
||||
Fast,
|
||||
Normal,
|
||||
Slow,
|
||||
Slowest
|
||||
}
|
||||
|
||||
public enum ESettingsUpdateInterval : byte
|
||||
{
|
||||
Second1,
|
||||
Second5,
|
||||
Second10,
|
||||
Second30,
|
||||
Minute1,
|
||||
Minute5,
|
||||
Minute10,
|
||||
Minute30,
|
||||
Hour1
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,19 +65,6 @@ namespace FModel.Utils
|
|||
return string.Empty;
|
||||
}
|
||||
|
||||
public static string GetEGL2PakFilesPath()
|
||||
{
|
||||
foreach (DriveInfo drive in DriveInfo.GetDrives())
|
||||
{
|
||||
string path = $"{drive.Name}FortniteGame\\Content\\Paks";
|
||||
if (Directory.Exists(path))
|
||||
return path;
|
||||
}
|
||||
|
||||
DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[EGL2]", "Fortnite not found");
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public static void Merge(Dictionary<string, FPakEntry> tempFiles, out Dictionary<string, FPakEntry> files, string mount)
|
||||
{
|
||||
files = new Dictionary<string, FPakEntry>();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using FModel.Logger;
|
||||
using FModel.Utils;
|
||||
using FModel.ViewModels.ComboBox;
|
||||
using FModel.Windows.CustomNotifier;
|
||||
using Ookii.Dialogs.Wpf;
|
||||
|
|
@ -30,7 +31,7 @@ namespace FModel.Windows.Launcher
|
|||
Games_CbBox.ItemsSource = ComboBoxVm.gamesCbViewModel;
|
||||
GamesPath_TxtBox.Text = Properties.Settings.Default.PakPath;
|
||||
|
||||
(_, string _, string fortniteFilesPath) = Utils.Paks.GetFortnitePakFilesPath();
|
||||
(_, string _, string fortniteFilesPath) = Paks.GetFortnitePakFilesPath();
|
||||
if (!string.IsNullOrEmpty(fortniteFilesPath))
|
||||
{
|
||||
DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[LauncherInstalled.dat]", $"Fortnite found at {fortniteFilesPath}");
|
||||
|
|
@ -38,7 +39,7 @@ namespace FModel.Windows.Launcher
|
|||
ComboBoxVm.gamesCbViewModel.Add(new ComboBoxViewModel { Id = i++, Content = "Fortnite", Property = fortniteFilesPath });
|
||||
}
|
||||
|
||||
string egl2FilesPath = Utils.Paks.GetEGL2PakFilesPath();
|
||||
string egl2FilesPath = EGL2.GetEGL2PakFilesPath();
|
||||
if (!string.IsNullOrEmpty(egl2FilesPath))
|
||||
{
|
||||
DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[EGL2]", $"Fortnite found at {egl2FilesPath}");
|
||||
|
|
@ -46,7 +47,7 @@ namespace FModel.Windows.Launcher
|
|||
ComboBoxVm.gamesCbViewModel.Add(new ComboBoxViewModel { Id = i++, Content = "Fortnite [EGL2]", Property = egl2FilesPath });
|
||||
}
|
||||
|
||||
string valorantFilesPath = Utils.Paks.GetValorantPakFilesPath();
|
||||
string valorantFilesPath = Paks.GetValorantPakFilesPath();
|
||||
if (!string.IsNullOrEmpty(valorantFilesPath))
|
||||
{
|
||||
DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[RiotClientInstalls.json]", $"Valorant found at {valorantFilesPath}");
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user