feat: add dlc dumper
This commit is contained in:
@@ -7,4 +7,6 @@ public static class Constants
|
||||
public static readonly string AESKey = "0x22B1639B548124925CF7B9CBAA09F9AC295FCF0324586D6B37EE1D42670B39B3";
|
||||
|
||||
public static readonly string[] BlacklistedCustomizationItems = ["NK_Torso01_Crew01Kraken"];
|
||||
|
||||
public static readonly string[] BlacklistedDLCNames = ["development"];
|
||||
}
|
||||
+66
-1
@@ -8,6 +8,7 @@ using CUE4Parse.UE4.Assets.Objects;
|
||||
using CUE4Parse.UE4.Objects.Core.Misc;
|
||||
using CUE4Parse.UE4.Versions;
|
||||
using CUE4Parse.UE4.VirtualFileSystem;
|
||||
using CUE4Parse.Utils;
|
||||
using Microsoft.Win32;
|
||||
using Newtonsoft.Json;
|
||||
class Dumper
|
||||
@@ -34,7 +35,6 @@ class Dumper
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* compression setup
|
||||
*/
|
||||
@@ -367,6 +367,71 @@ class Dumper
|
||||
|
||||
return JsonConvert.SerializeObject(perksSerialized, Formatting.Indented);
|
||||
}
|
||||
|
||||
public struct DLCInfo
|
||||
{
|
||||
public string name;
|
||||
public string? grdk;
|
||||
public string? egs;
|
||||
public string? steam;
|
||||
};
|
||||
|
||||
public string? DumpDLCs()
|
||||
{
|
||||
if (_dataPak == null || _provider == null) return null;
|
||||
|
||||
var searchPaths = _dataPak.Files.Keys.Where(x => x.Contains($"/DlcDB.uasset", StringComparison.OrdinalIgnoreCase)).ToList();
|
||||
|
||||
var dlcs = new List<DLCInfo>();
|
||||
|
||||
foreach (var path in searchPaths)
|
||||
{
|
||||
var cleanPath = path.Contains('.') ? path.Substring(0, path.LastIndexOf('.')) : path;
|
||||
if (_provider.TryLoadPackageObject<UDataTable>(cleanPath, out var dataTable))
|
||||
{
|
||||
foreach (var row in dataTable.RowMap)
|
||||
{
|
||||
/*
|
||||
* props
|
||||
*/
|
||||
var props = row.Value.Properties;
|
||||
|
||||
FPropertyTag? steamIdProp = row.Value.Properties.FirstOrDefault(p => p.Name.Text == "DlcIdSteam");
|
||||
FPropertyTag? grdkIdProp = row.Value.Properties.FirstOrDefault(p => p.Name.Text == "DlcIdGRDK");
|
||||
FPropertyTag? epicIdProp = row.Value.Properties.FirstOrDefault(p => p.Name.Text == "DlcIdEpic");
|
||||
|
||||
/*
|
||||
* real data
|
||||
*/
|
||||
string dlcName = row.Key.Text;
|
||||
if (Constants.BlacklistedDLCNames.Contains(dlcName)) continue;
|
||||
|
||||
string? steamId = null, grdkId = null, epicId = null;
|
||||
|
||||
if (steamIdProp != null && steamIdProp.Tag != null)
|
||||
steamId = steamIdProp.Tag.GetValue<string>();
|
||||
|
||||
if (grdkIdProp != null && grdkIdProp.Tag != null)
|
||||
grdkId = grdkIdProp.Tag.GetValue<string>();
|
||||
|
||||
if (epicIdProp != null && epicIdProp.Tag != null)
|
||||
epicId = epicIdProp.Tag.GetValue<string>();
|
||||
|
||||
var info = new DLCInfo
|
||||
{
|
||||
name = dlcName,
|
||||
steam = steamId,
|
||||
grdk = grdkId,
|
||||
egs = epicId
|
||||
};
|
||||
|
||||
dlcs.Add(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return JsonConvert.SerializeObject(dlcs, Formatting.Indented);
|
||||
}
|
||||
private string? getGamePath()
|
||||
{
|
||||
const string packagesPath = @"Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\Repository\Packages";
|
||||
|
||||
@@ -65,6 +65,16 @@ else
|
||||
Console.WriteLine("Failed to dump perks");
|
||||
}
|
||||
|
||||
string? dlcsJSON = dumper.DumpDLCs();
|
||||
if (dlcsJSON != null)
|
||||
{
|
||||
File.WriteAllText("dlcs.json", dlcsJSON);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Failed to dump dlcs");
|
||||
}
|
||||
|
||||
Console.WriteLine("Dumper finished");
|
||||
|
||||
return 0;
|
||||
Reference in New Issue
Block a user