mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 20:19:49 +02:00
feat: some unpacker stuff
This commit is contained in:
1 parent
57287cea3a
commit
7098395323
3 files changed
+70
-17
No files matched your search
Vendored
+4
@@ -71,6 +71,10 @@
|
|||||||
"dxgi",
|
"dxgi",
|
||||||
"echarts",
|
"echarts",
|
||||||
"Everytime",
|
"Everytime",
|
||||||
|
"Exergizable",
|
||||||
|
"Exergize",
|
||||||
|
"Exergizing",
|
||||||
|
"Exergy",
|
||||||
"FASTNAME",
|
"FASTNAME",
|
||||||
"flexdirection",
|
"flexdirection",
|
||||||
"FOURCC",
|
"FOURCC",
|
||||||
|
|||||||
+1
-1
@@ -37,7 +37,7 @@
|
|||||||
"build:reviews": "cd packages/scripts && bun build:reviews",
|
"build:reviews": "cd packages/scripts && bun build:reviews",
|
||||||
"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",
|
||||||
"test:cli": "cd src/CLI && dotnet run"
|
"dev:cli:unpack": "cd src/CLI && dotnet run unpack \"C:/Program Files (x86)/Steam/steamapps/common/World of Tanks Blitz Playtest\""
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,38 +1,87 @@
|
|||||||
|
using CUE4Parse.Compression;
|
||||||
|
using CUE4Parse.FileProvider.Objects;
|
||||||
|
using CUE4Parse.UE4.Pak;
|
||||||
|
|
||||||
namespace CLI.Functions
|
namespace CLI.Functions
|
||||||
{
|
{
|
||||||
class Unpacker
|
class Unpacker
|
||||||
{
|
{
|
||||||
|
public static string ZlibPath = "../../temp/zlib.dll";
|
||||||
|
public static string VFSWriteDirectory = "../../temp/vfs/";
|
||||||
|
|
||||||
public static void Unpack(string[] args)
|
public static void Unpack(string[] args)
|
||||||
{
|
{
|
||||||
if (args.Length < 2)
|
if (args.Length < 2)
|
||||||
{
|
{
|
||||||
throw new ArgumentException("Missing required working directory argument");
|
throw new ArgumentException("Missing required initial paks directory");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (File.Exists(ZlibPath))
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Zlib found at {ZlibPath}; using that...");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Zlib not found; downloading to {ZlibPath}...");
|
||||||
|
ZlibHelper.DownloadDll(ZlibPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
ZlibHelper.Initialize(ZlibPath);
|
||||||
|
|
||||||
string workingDirectory = args[1];
|
string workingDirectory = args[1];
|
||||||
string paksDirectory = Path.Combine(workingDirectory, "Blitz/Content/Paks");
|
string paksDirectory = Path.Combine(workingDirectory, "Blitz/Content/Paks");
|
||||||
string[] files = Directory.GetFiles(paksDirectory, "*.pak");
|
string[] containers = Directory.GetFiles(paksDirectory, "*.pak");
|
||||||
|
|
||||||
foreach (string file in files)
|
foreach (string container in containers)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Reading \"{file}\"");
|
Exergy(container);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// BlitzVfs vfs = new();
|
public static void Exergy(string container)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Filtering {container}");
|
||||||
|
|
||||||
// vfs.Initialize();
|
PakFileReader reader = new(container);
|
||||||
|
|
||||||
// DefaultFileProvider provider = new(
|
reader.Mount();
|
||||||
// directory: new(
|
|
||||||
// "C:/Program Files (x86)/Steam/steamapps/common/World of Tanks Blitz Playtest"
|
|
||||||
// ),
|
|
||||||
// extraDirectories: [new DirectoryInfo("C:/Users/coola/AppData/Local/Blitz")],
|
|
||||||
// searchOption: SearchOption.AllDirectories,
|
|
||||||
// isCaseInsensitive: false,
|
|
||||||
// versions: new(game: EGame.GAME_UE5_3, platform: ETexturePlatform.DesktopMobile, ver: new())
|
|
||||||
// );
|
|
||||||
|
|
||||||
// provider.Initialize();
|
foreach (var file in reader.Files)
|
||||||
|
{
|
||||||
|
GameFile gameFile = file.Value;
|
||||||
|
bool exergizable = ShouldExergize(gameFile.Path);
|
||||||
|
|
||||||
|
if (!exergizable)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
string writePath = Path.Combine(VFSWriteDirectory, gameFile.Path);
|
||||||
|
|
||||||
|
if (File.Exists(writePath))
|
||||||
|
{
|
||||||
|
Console.WriteLine($"{gameFile.Path} already exists; skipping...");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine($"{gameFile.Path} writing from vfs...");
|
||||||
|
|
||||||
|
string? directory = Path.GetDirectoryName(writePath);
|
||||||
|
|
||||||
|
if (directory != null && !Directory.Exists(directory))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(directory);
|
||||||
|
}
|
||||||
|
|
||||||
|
File.WriteAllBytes(writePath, gameFile.Read());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string[] ExergizableFiles = ["Blitz/Config/DefaultDlc.ini"];
|
||||||
|
|
||||||
|
public static bool ShouldExergize(string path)
|
||||||
|
{
|
||||||
|
return ExergizableFiles.Contains(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user