mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
consumable icons
This commit is contained in:
1 parent
f58d06b3c3
commit
0cb4aadec3
6 files changed
+96
-19
No files matched your search
@@ -10,12 +10,21 @@ using CUE4Parse.UE4.Objects.UObject;
|
||||
using CUE4Parse.UE4.Versions;
|
||||
using CUE4Parse.Utils;
|
||||
using SkiaSharp;
|
||||
using CUE4Parse.UE4.Readers;
|
||||
using CUE4Parse.UE4.AssetRegistry;
|
||||
using System.Text.RegularExpressions;
|
||||
using CUE4Parse.UE4.Assets.Exports;
|
||||
|
||||
namespace BlitzKit.Game.Models;
|
||||
|
||||
public class BlitzFileProvider : DefaultFileProvider
|
||||
public partial class BlitzFileProvider : DefaultFileProvider
|
||||
{
|
||||
public BlitzFileProvider(string directory, string map)
|
||||
[GeneratedRegex(@"\(GameplayTags=\(\(TagName=""(.+)""\)\)\)")]
|
||||
private static partial Regex GameplayTagsRegex();
|
||||
|
||||
private readonly Dictionary<string, string> discovered = [];
|
||||
|
||||
public BlitzFileProvider(string directory, string map, string temp)
|
||||
: base(
|
||||
directory: directory,
|
||||
searchOption: SearchOption.AllDirectories,
|
||||
@@ -27,6 +36,38 @@ public class BlitzFileProvider : DefaultFileProvider
|
||||
|
||||
Initialize();
|
||||
Mount();
|
||||
|
||||
string oodlePath = $"{temp}/oodle.so";
|
||||
OodleHelper.DownloadOodleDll(ref oodlePath!);
|
||||
OodleHelper.Initialize(oodlePath);
|
||||
|
||||
if (TryGetGameFile("Blitz/AssetRegistry.bin", out var file))
|
||||
{
|
||||
var bytes = file.Read();
|
||||
var archive = new FByteArchive(file.Path, bytes, Versions);
|
||||
var state = new FAssetRegistryState(archive);
|
||||
|
||||
foreach (var asset in state.PreallocatedAssetDataBuffers)
|
||||
{
|
||||
if (asset.TagsAndValues.TryGetValue("DiscoveryTags", out var tags))
|
||||
{
|
||||
var match = GameplayTagsRegex().Match(tags);
|
||||
|
||||
if (!match.Success)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var tag = match.Groups[1].Value;
|
||||
discovered[tag] = asset.ObjectPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public T Discovered<T>(string path) where T : UObject
|
||||
{
|
||||
return LoadPackageObject<T>(discovered[path]);
|
||||
}
|
||||
|
||||
public UPrimaryDataAsset PDA(string path)
|
||||
|
||||
Reference in new issue
Block a user