mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 18:57:03 +02:00
feat: custom provider
This commit is contained in:
1 parent
0b7f717057
commit
6c1c088d44
2 files changed
+53
-29
No files matched your search
@@ -0,0 +1,49 @@
|
||||
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 BlitzFileProvider(string directory)
|
||||
: base(
|
||||
directory: directory,
|
||||
searchOption: SearchOption.AllDirectories,
|
||||
versions: new(EGame.GAME_UE5_5),
|
||||
pathComparer: StringComparer.OrdinalIgnoreCase
|
||||
)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
+4
-29
@@ -1,31 +1,20 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using CUE4Parse.Compression;
|
||||
using CUE4Parse.FileProvider;
|
||||
using CUE4Parse.MappingsProvider;
|
||||
using CUE4Parse.UE4.Versions;
|
||||
using Microsoft.JavaScript.NodeApi;
|
||||
|
||||
namespace game.src.classes;
|
||||
|
||||
[JSExport]
|
||||
public class BlitzProvider
|
||||
public class GameInterface
|
||||
{
|
||||
private readonly DefaultFileProvider provider;
|
||||
private readonly BlitzFileProvider provider;
|
||||
|
||||
public string[] files;
|
||||
public string[] tanksDirectoryNations;
|
||||
|
||||
public BlitzProvider(string directory)
|
||||
public GameInterface(string directory)
|
||||
{
|
||||
provider = new(
|
||||
directory: directory,
|
||||
searchOption: SearchOption.AllDirectories,
|
||||
versions: new(EGame.GAME_UE5_5),
|
||||
pathComparer: StringComparer.OrdinalIgnoreCase
|
||||
)
|
||||
{
|
||||
MappingsContainer = new FileUsmapTypeMappingsProvider("../../packages/closed/blitz.usmap"),
|
||||
};
|
||||
provider = new(directory);
|
||||
|
||||
provider.Initialize();
|
||||
provider.Mount();
|
||||
@@ -47,22 +36,8 @@ public class BlitzProvider
|
||||
OodleHelper.DownloadOodleDll($"temp/oodle.{libraryExtension}");
|
||||
OodleHelper.Initialize($"temp/oodle.{libraryExtension}");
|
||||
|
||||
// Console.WriteLine(
|
||||
// provider.Files.Keys.Contains(
|
||||
// "Blitz/Content/Tanks/USA/A97_M41_Bulldog/PDA_A97_M41_Bulldog.uasset"
|
||||
// )
|
||||
// );
|
||||
|
||||
// var pda = provider.LoadPackageObject(
|
||||
// "Blitz/Content/Tanks/USA/A97_M41_Bulldog/PDA_A97_M41_Bulldog.PDA_A97_M41_Bulldog"
|
||||
// );
|
||||
|
||||
// Console.WriteLine(pda);
|
||||
|
||||
files = [.. provider.Files.Keys];
|
||||
|
||||
Console.WriteLine(string.Join("\n", files));
|
||||
|
||||
var tanksBase = "Blitz/Content/Tanks/";
|
||||
tanksDirectoryNations =
|
||||
[
|
||||
Reference in new issue
Block a user