mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-28 04:59:50 +01:00
feat: dir api
This commit is contained in:
1 parent
9546bf5bb7
commit
0139dd45c9
8 files changed
+114
-42
No files matched your search
@@ -0,0 +1,7 @@
|
|||||||
|
`Blitz/Config/DefaultGameplayTags.ini` seems to have an exhaustive list of all maps, tanks, sets, game modes, legendary camouflages, consumables, skills, quick commands, UI components, etc.
|
||||||
|
|
||||||
|
`Blitz/Config/DefaultGame.ini` seems to have all locales under the name of "Cultures"
|
||||||
|
|
||||||
|
`Blitz/Config/DefaultDlc.ini` contains DLC info; essentially extra `pak` containers
|
||||||
|
|
||||||
|
`Blitz/Content/TanksStuff/Common/DT_TankClasses.uasset` seems to have all tank classes
|
||||||
+1
-1
@@ -38,7 +38,7 @@
|
|||||||
"build:ids": "cd packages/scripts && bun build:ids",
|
"build:ids": "cd packages/scripts && bun build:ids",
|
||||||
"prunestrings": "cd packages/scripts && bun prunestrings",
|
"prunestrings": "cd packages/scripts && bun prunestrings",
|
||||||
"dev:cli:unpack": "cd src/CLI && dotnet run unpack \"C:/Program Files (x86)/Steam/steamapps/common/World of Tanks Blitz Playtest\" --no-overwrite",
|
"dev:cli:unpack": "cd src/CLI && dotnet run unpack \"C:/Program Files (x86)/Steam/steamapps/common/World of Tanks Blitz Playtest\" --no-overwrite",
|
||||||
"dev:cli:buildassets": "cd src/CLI && dotnet run buildassets"
|
"dev:cli:mangle": "cd src/CLI && dotnet run mangle"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
using CUE4Parse.FileProvider;
|
|
||||||
using CUE4Parse.FileProvider.Objects;
|
|
||||||
|
|
||||||
namespace CLI.Functions
|
|
||||||
{
|
|
||||||
public static class AssetsBuilder
|
|
||||||
{
|
|
||||||
private static readonly string LOCAL_USER = "coola";
|
|
||||||
private static readonly string LOCAL_DLC_CONTAINERS_PATH =
|
|
||||||
$"C:/Users/{LOCAL_USER}/AppData/Local/Blitz/Saved/PersistentDownloadDir/Dlc/PakCache";
|
|
||||||
private static readonly string LOCAL_BUNDLED_CONTAINERS_PATH =
|
|
||||||
"C:/Program Files (x86)/Steam/steamapps/common/World of Tanks Blitz Playtest/Blitz/Content/Paks";
|
|
||||||
|
|
||||||
public static void Build(string[] args)
|
|
||||||
{
|
|
||||||
DefaultFileProvider provider = new(
|
|
||||||
directory: new DirectoryInfo(LOCAL_DLC_CONTAINERS_PATH),
|
|
||||||
extraDirectories: [new(LOCAL_BUNDLED_CONTAINERS_PATH)],
|
|
||||||
searchOption: SearchOption.TopDirectoryOnly
|
|
||||||
);
|
|
||||||
|
|
||||||
provider.Initialize();
|
|
||||||
provider.Mount();
|
|
||||||
|
|
||||||
foreach (var file in provider.Files)
|
|
||||||
{
|
|
||||||
GameFile gameFile = file.Value;
|
|
||||||
Console.WriteLine(gameFile.Path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +1,23 @@
|
|||||||
|
using CLI.Models;
|
||||||
|
|
||||||
namespace CLI.Functions
|
namespace CLI.Functions
|
||||||
{
|
{
|
||||||
public static class Mangler
|
public static class Mangler
|
||||||
{
|
{
|
||||||
public static void Mangle() {
|
public static void Mangle()
|
||||||
|
{
|
||||||
|
BlitzProvider provider = new();
|
||||||
|
|
||||||
|
foreach (var nation in provider.RootDirectory.GetDirectory("Blitz/Content/Tanks").Directories)
|
||||||
|
{
|
||||||
|
if (nation.Key == "TankStub")
|
||||||
|
continue;
|
||||||
|
|
||||||
|
foreach (var tank in nation.Value.Directories)
|
||||||
|
{
|
||||||
|
Console.WriteLine(tank.Key);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -26,8 +26,6 @@ namespace CLI.Functions
|
|||||||
throw new ArgumentException("Missing required initial paks directory");
|
throw new ArgumentException("Missing required initial paks directory");
|
||||||
}
|
}
|
||||||
|
|
||||||
await AgnosticHelpers.Initialize();
|
|
||||||
|
|
||||||
UnpackDepot(args[1]);
|
UnpackDepot(args[1]);
|
||||||
await UnpackDLC();
|
await UnpackDLC();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,83 @@
|
|||||||
|
using CUE4Parse.FileProvider;
|
||||||
|
using CUE4Parse.FileProvider.Objects;
|
||||||
|
|
||||||
|
namespace CLI.Models
|
||||||
|
{
|
||||||
|
public class BlitzProvider : DefaultFileProvider
|
||||||
|
{
|
||||||
|
private static readonly string LOCAL_USER = "coola";
|
||||||
|
private static readonly string LOCAL_DLC_CONTAINERS_PATH =
|
||||||
|
$"C:/Users/{LOCAL_USER}/AppData/Local/Blitz/Saved/PersistentDownloadDir/Dlc/PakCache";
|
||||||
|
private static readonly string LOCAL_BUNDLED_CONTAINERS_PATH =
|
||||||
|
"C:/Program Files (x86)/Steam/steamapps/common/World of Tanks Blitz Playtest/Blitz/Content/Paks";
|
||||||
|
|
||||||
|
public readonly VfsDirectory RootDirectory = new();
|
||||||
|
|
||||||
|
public BlitzProvider()
|
||||||
|
: base(
|
||||||
|
directory: new DirectoryInfo(LOCAL_BUNDLED_CONTAINERS_PATH),
|
||||||
|
extraDirectories: [new(LOCAL_DLC_CONTAINERS_PATH)],
|
||||||
|
searchOption: SearchOption.TopDirectoryOnly
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Initialize();
|
||||||
|
Mount();
|
||||||
|
|
||||||
|
foreach (var file in Files)
|
||||||
|
{
|
||||||
|
var gameFile = file.Value;
|
||||||
|
var path = gameFile.Path.Split('/');
|
||||||
|
var lastPathSegment = path.Last();
|
||||||
|
var directory = RootDirectory;
|
||||||
|
|
||||||
|
foreach (var segment in path)
|
||||||
|
{
|
||||||
|
bool isLastSegment = lastPathSegment == segment;
|
||||||
|
|
||||||
|
if (isLastSegment)
|
||||||
|
{
|
||||||
|
directory.AddFile(segment, gameFile);
|
||||||
|
}
|
||||||
|
else if (directory.HasDirectory(segment))
|
||||||
|
{
|
||||||
|
directory = directory.GetDirectory(segment);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
VfsDirectory newDirectory = new();
|
||||||
|
directory.AddDirectory(segment, newDirectory);
|
||||||
|
directory = newDirectory;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class VfsDirectory
|
||||||
|
{
|
||||||
|
public Dictionary<string, VfsDirectory> Directories = [];
|
||||||
|
public Dictionary<string, GameFile> Files = [];
|
||||||
|
|
||||||
|
public void AddFile(string name, GameFile file) => Files.TryAdd(name, file);
|
||||||
|
|
||||||
|
public bool HasDirectory(string name) => Directories.ContainsKey(name);
|
||||||
|
|
||||||
|
public VfsDirectory GetDirectory(string name)
|
||||||
|
{
|
||||||
|
var segments = name.Split('/');
|
||||||
|
var directory = this;
|
||||||
|
|
||||||
|
foreach (var segment in segments)
|
||||||
|
{
|
||||||
|
directory = directory.GetImmediateDirectory(segment);
|
||||||
|
}
|
||||||
|
|
||||||
|
return directory;
|
||||||
|
}
|
||||||
|
|
||||||
|
private VfsDirectory GetImmediateDirectory(string name) => Directories[name];
|
||||||
|
|
||||||
|
public void AddDirectory(string name, VfsDirectory directory) =>
|
||||||
|
Directories.Add(name, directory);
|
||||||
|
}
|
||||||
|
}
|
||||||
+3
-6
@@ -1,4 +1,5 @@
|
|||||||
using CLI.Functions;
|
using CLI.Functions;
|
||||||
|
using CLI.Utils;
|
||||||
|
|
||||||
namespace CLI
|
namespace CLI
|
||||||
{
|
{
|
||||||
@@ -6,6 +7,8 @@ namespace CLI
|
|||||||
{
|
{
|
||||||
static async Task Main(string[] args)
|
static async Task Main(string[] args)
|
||||||
{
|
{
|
||||||
|
await AgnosticHelpers.Initialize();
|
||||||
|
|
||||||
switch (args[0])
|
switch (args[0])
|
||||||
{
|
{
|
||||||
case "unpack":
|
case "unpack":
|
||||||
@@ -20,12 +23,6 @@ namespace CLI
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case "buildassets":
|
|
||||||
{
|
|
||||||
AssetsBuilder.Build(args);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
throw new ArgumentException("Invalid command");
|
throw new ArgumentException("Invalid command");
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ namespace CLI.Utils
|
|||||||
|
|
||||||
public static async Task Initialize()
|
public static async Task Initialize()
|
||||||
{
|
{
|
||||||
|
if (!Directory.Exists(BINARY_DIR))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(BINARY_DIR);
|
||||||
|
}
|
||||||
|
|
||||||
InitializeZlib();
|
InitializeZlib();
|
||||||
await InitializeOodle();
|
await InitializeOodle();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user