From 98e7760142e53956d3ea42e9ec2ab10eaefbe614 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Mon, 2 Feb 2026 17:24:20 -0600 Subject: [PATCH] feat: some syncronouse stuff --- packages/cue4parse | 2 +- .../game/src/classes/BlitzFileProvider.cs | 33 +-------------- packages/game/src/classes/GameInterface.cs | 13 +++++- .../src/classes/SynchronousFileProvider.cs | 40 +++++++++++++++++++ 4 files changed, 53 insertions(+), 35 deletions(-) create mode 100644 packages/game/src/classes/SynchronousFileProvider.cs diff --git a/packages/cue4parse b/packages/cue4parse index bf5380789..d2f6ce6e6 160000 --- a/packages/cue4parse +++ b/packages/cue4parse @@ -1 +1 @@ -Subproject commit bf5380789b108b5fc023014c1f5bd109615ded9d +Subproject commit d2f6ce6e618576dbbe7f6dd9ed3171f14513182a diff --git a/packages/game/src/classes/BlitzFileProvider.cs b/packages/game/src/classes/BlitzFileProvider.cs index b58f1b63f..49b9e631e 100644 --- a/packages/game/src/classes/BlitzFileProvider.cs +++ b/packages/game/src/classes/BlitzFileProvider.cs @@ -1,12 +1,9 @@ -using CUE4Parse.FileProvider; using CUE4Parse.MappingsProvider; -using CUE4Parse.UE4.Exceptions; using CUE4Parse.UE4.Versions; -using CUE4Parse.Utils; namespace game.src.classes; -public class BlitzFileProvider : DefaultFileProvider +public class BlitzFileProvider : SynchronousFileProvider { public BlitzFileProvider(string directory) : base( @@ -18,32 +15,4 @@ public class BlitzFileProvider : DefaultFileProvider { MappingsContainer = new FileUsmapTypeMappingsProvider("../../packages/closed/blitz.usmap"); } - - public new int Mount() - { - var countNewMounts = 0; - - foreach (var reader in _unloadedVfs.Keys) - { - if (reader.IsEncrypted && CustomEncryption == null || !reader.HasDirectoryIndex) - continue; - - try - { - reader.MountTo(Files, PathComparer); - _unloadedVfs.TryRemove(reader, out _); - countNewMounts++; - } - catch (InvalidAesKeyException) { } - catch (Exception e) - { - Log.Warning( - e, - $"Uncaught exception while loading file {reader.Path.SubstringAfterLast('/')}" - ); - } - } - - return countNewMounts; - } } diff --git a/packages/game/src/classes/GameInterface.cs b/packages/game/src/classes/GameInterface.cs index 77106277f..98a604349 100644 --- a/packages/game/src/classes/GameInterface.cs +++ b/packages/game/src/classes/GameInterface.cs @@ -33,8 +33,11 @@ public class GameInterface throw new Exception("Unsupported OS"); } - OodleHelper.DownloadOodleDll($"temp/oodle.{libraryExtension}"); - OodleHelper.Initialize($"temp/oodle.{libraryExtension}"); + Directory.CreateDirectory("../../temp"); + Console.WriteLine($"../..temp/oodle.{libraryExtension}"); + var bool1 = OodleHelper.DownloadOodleDll($"../..temp/oodle.{libraryExtension}"); + Console.WriteLine(bool1); + OodleHelper.Initialize($"../..temp/oodle.{libraryExtension}"); files = [.. provider.Files.Keys]; @@ -48,6 +51,12 @@ public class GameInterface .Where(nation => !nation.EndsWith(".uasset") && nation != "TankStub") .Distinct(), ]; + + var pda = provider.LoadPackageObject( + "Blitz/Content/Tanks/USA/A97_M41_Bulldog/PDA_A97_M41_Bulldog.PDA_A97_M41_Bulldog" + ); + + Console.WriteLine(pda); } public string[] Files => files; diff --git a/packages/game/src/classes/SynchronousFileProvider.cs b/packages/game/src/classes/SynchronousFileProvider.cs new file mode 100644 index 000000000..1125819e6 --- /dev/null +++ b/packages/game/src/classes/SynchronousFileProvider.cs @@ -0,0 +1,40 @@ +using CUE4Parse.FileProvider; +using CUE4Parse.UE4.Exceptions; +using CUE4Parse.UE4.Versions; +using CUE4Parse.Utils; + +public class SynchronousFileProvider( + string directory, + SearchOption searchOption, + VersionContainer? versions = null, + StringComparer? pathComparer = null +) : DefaultFileProvider(directory, searchOption, versions, pathComparer) +{ + public new int Mount() + { + var countNewMounts = 0; + + foreach (var reader in _unloadedVfs.Keys) + { + if (reader.IsEncrypted && CustomEncryption == null || !reader.HasDirectoryIndex) + continue; + + try + { + reader.MountTo(Files, PathComparer); + _unloadedVfs.TryRemove(reader, out _); + countNewMounts++; + } + catch (InvalidAesKeyException) { } + catch (Exception e) + { + Log.Warning( + e, + $"Uncaught exception while loading file {reader.Path.SubstringAfterLast('/')}" + ); + } + } + + return countNewMounts; + } +}