mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 03:59:50 +02:00
feat: parsing
This commit is contained in:
1 parent
74a8df6842
commit
d6c1e8069d
5 files changed
+98
-8
No files matched your search
Vendored
+1
@@ -197,6 +197,7 @@
|
|||||||
"Unregistering",
|
"Unregistering",
|
||||||
"unrotate",
|
"unrotate",
|
||||||
"unwrapper",
|
"unwrapper",
|
||||||
|
"Usmap",
|
||||||
"vercel",
|
"vercel",
|
||||||
"vickers",
|
"vickers",
|
||||||
"vitepress",
|
"vitepress",
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
using BlitzKit.CLI.Models;
|
using BlitzKit.CLI.Models;
|
||||||
|
using BlitzKit.CLI.Utils;
|
||||||
|
using CUE4Parse.FileProvider.Objects;
|
||||||
|
|
||||||
namespace BlitzKit.CLI.Functions
|
namespace BlitzKit.CLI.Functions
|
||||||
{
|
{
|
||||||
@@ -15,9 +17,52 @@ namespace BlitzKit.CLI.Functions
|
|||||||
|
|
||||||
foreach (var tank in nation.Value.Directories)
|
foreach (var tank in nation.Value.Directories)
|
||||||
{
|
{
|
||||||
if (!tank.Value.HasFile($"DA_{tank.Key}_Attributes.uasset"))
|
if (tank.Key != "R90_IS_4")
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var attributeFileName = $"DA_{tank.Key}_Attributes.uasset";
|
||||||
|
var hasAttributesFile = tank.Value.HasFile(attributeFileName);
|
||||||
|
GameFile? attributes = null;
|
||||||
|
|
||||||
|
if (hasAttributesFile)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"{nation.Key}/{tank.Key}");
|
attributes = tank.Value.GetFile(attributeFileName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PrettyLog.Warn(
|
||||||
|
$"No attributes file found for {nation.Key}/{tank.Key}, it may be misspelled; finding any attributes file..."
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach (var file in tank.Value.Files)
|
||||||
|
{
|
||||||
|
if (file.Key.EndsWith("_Attributes.uasset"))
|
||||||
|
{
|
||||||
|
attributes = file.Value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (attributes == null)
|
||||||
|
{
|
||||||
|
PrettyLog.Error(
|
||||||
|
$"No suffixed attributes file found for {nation.Key}/{tank.Key}; skipping..."
|
||||||
|
);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var objects = provider.LoadAllObjects(attributes.Path);
|
||||||
|
var objectsCount = objects.Count();
|
||||||
|
|
||||||
|
if (objectsCount != 1)
|
||||||
|
{
|
||||||
|
throw new Exception($"Expected 1 object for attribute objects, got {objectsCount}");
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var obj in objects)
|
||||||
|
{
|
||||||
|
Console.WriteLine(obj.Properties);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
using CUE4Parse.FileProvider;
|
using CUE4Parse.FileProvider;
|
||||||
using CUE4Parse.FileProvider.Objects;
|
using CUE4Parse.FileProvider.Objects;
|
||||||
|
using CUE4Parse.MappingsProvider;
|
||||||
|
using CUE4Parse.UE4.Versions;
|
||||||
|
|
||||||
namespace BlitzKit.CLI.Models
|
namespace BlitzKit.CLI.Models
|
||||||
{
|
{
|
||||||
@@ -10,6 +12,8 @@ namespace BlitzKit.CLI.Models
|
|||||||
$"C:/Users/{LOCAL_USER}/AppData/Local/Blitz/Saved/PersistentDownloadDir/Dlc/PakCache";
|
$"C:/Users/{LOCAL_USER}/AppData/Local/Blitz/Saved/PersistentDownloadDir/Dlc/PakCache";
|
||||||
private static readonly string LOCAL_BUNDLED_CONTAINERS_PATH =
|
private static readonly string LOCAL_BUNDLED_CONTAINERS_PATH =
|
||||||
"C:/Program Files (x86)/Steam/steamapps/common/World of Tanks Blitz Playtest/Blitz/Content/Paks";
|
"C:/Program Files (x86)/Steam/steamapps/common/World of Tanks Blitz Playtest/Blitz/Content/Paks";
|
||||||
|
private static readonly string LOCAL_MAPPINGS_PATH =
|
||||||
|
"../../submodules/blitzkit-closed/blitz.usmap";
|
||||||
|
|
||||||
public readonly VfsDirectory RootDirectory = new();
|
public readonly VfsDirectory RootDirectory = new();
|
||||||
|
|
||||||
@@ -17,9 +21,12 @@ namespace BlitzKit.CLI.Models
|
|||||||
: base(
|
: base(
|
||||||
directory: new DirectoryInfo(LOCAL_BUNDLED_CONTAINERS_PATH),
|
directory: new DirectoryInfo(LOCAL_BUNDLED_CONTAINERS_PATH),
|
||||||
extraDirectories: [new(LOCAL_DLC_CONTAINERS_PATH)],
|
extraDirectories: [new(LOCAL_DLC_CONTAINERS_PATH)],
|
||||||
searchOption: SearchOption.TopDirectoryOnly
|
searchOption: SearchOption.TopDirectoryOnly,
|
||||||
|
versions: new(EGame.GAME_UE5_3)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
MappingsContainer = new FileUsmapTypeMappingsProvider(LOCAL_MAPPINGS_PATH);
|
||||||
|
|
||||||
Initialize();
|
Initialize();
|
||||||
Mount();
|
Mount();
|
||||||
|
|
||||||
@@ -62,7 +69,15 @@ namespace BlitzKit.CLI.Models
|
|||||||
|
|
||||||
public bool HasFile(string name) => Files.ContainsKey(name);
|
public bool HasFile(string name) => Files.ContainsKey(name);
|
||||||
|
|
||||||
public GameFile GetFile(string name) => Files[name];
|
public GameFile GetFile(string name)
|
||||||
|
{
|
||||||
|
var directoryPath = Path.GetDirectoryName(name);
|
||||||
|
var fileName = Path.GetFileName(name);
|
||||||
|
var directory =
|
||||||
|
directoryPath == null || directoryPath.Length == 0 ? this : GetDirectory(directoryPath);
|
||||||
|
|
||||||
|
return directory.Files[name];
|
||||||
|
}
|
||||||
|
|
||||||
public bool HasDirectory(string name) => Directories.ContainsKey(name);
|
public bool HasDirectory(string name) => Directories.ContainsKey(name);
|
||||||
|
|
||||||
@@ -73,14 +88,12 @@ namespace BlitzKit.CLI.Models
|
|||||||
|
|
||||||
foreach (var segment in segments)
|
foreach (var segment in segments)
|
||||||
{
|
{
|
||||||
directory = directory.GetImmediateDirectory(segment);
|
directory = directory.Directories[segment];
|
||||||
}
|
}
|
||||||
|
|
||||||
return directory;
|
return directory;
|
||||||
}
|
}
|
||||||
|
|
||||||
private VfsDirectory GetImmediateDirectory(string name) => Directories[name];
|
|
||||||
|
|
||||||
public void AddDirectory(string name, VfsDirectory directory) =>
|
public void AddDirectory(string name, VfsDirectory directory) =>
|
||||||
Directories.Add(name, directory);
|
Directories.Add(name, directory);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
namespace BlitzKit.CLI.Utils
|
||||||
|
{
|
||||||
|
public static class PrettyLog
|
||||||
|
{
|
||||||
|
public static void Log(string message)
|
||||||
|
{
|
||||||
|
Console.WriteLine(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Warn(string message)
|
||||||
|
{
|
||||||
|
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||||
|
Console.WriteLine(message);
|
||||||
|
Console.ResetColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Error(string message)
|
||||||
|
{
|
||||||
|
Console.ForegroundColor = ConsoleColor.Red;
|
||||||
|
Console.WriteLine(message);
|
||||||
|
Console.ResetColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Success(string message)
|
||||||
|
{
|
||||||
|
Console.ForegroundColor = ConsoleColor.Green;
|
||||||
|
Console.WriteLine(message);
|
||||||
|
Console.ResetColor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Submodule submodules/blitzkit-closed updated: c1d631764f...d79d47a6aa.
Reference in new issue
Block a user