feat: some syncronouse stuff

This commit is contained in:
TrèsAbhi committed 2026-02-02 17:24:20 -06:00
1 parent 6c1c088d44
commit 98e7760142
4 files changed
+53 -35

No files matched your search

+1 -32
View File
@@ -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;
}
}
+11 -2
View File
@@ -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;
@@ -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;
}
}