Skip to content

Commit

Permalink
Support Zlib compression (#4)
Browse files Browse the repository at this point in the history
* Support Zlib compression

Allow config file to specify path to zlib DLL

* Remove preprocessor conditional return for zlib check failure

* Fixup after merge conflict (provider initialization)

* Update BlueprintToCpp/Program.cs

authored-by: Ross Adamson
  • Loading branch information
rizzlesauce authored Jan 31, 2025
1 parent aaa7382 commit 3fa3ad9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 9 additions & 2 deletions BlueprintToCpp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ public static async Task Main(string[] args) {
return;
}

string zlibPath = config.ZlibPath;

EGame version = config.Version;
if (string.IsNullOrEmpty(version.ToString()) || version.ToString().Length < 1)
{
Expand All @@ -97,7 +99,7 @@ public static async Task Main(string[] args) {

string exeDirectory = AppDomain.CurrentDomain.BaseDirectory;

var provider = InitializeProvider(pakFolderPath, usmapPath, oodlePath, version);
var provider = InitializeProvider(pakFolderPath, usmapPath, oodlePath, zlibPath, version);
provider.ReadScriptData = true;
await LoadAesKeysAsync(provider,
"https://fortnitecentral.genxgames.gg/api/v1/aes"); // allow users to change the aes url?
Expand Down Expand Up @@ -559,10 +561,15 @@ gameplayTagsInArray.StructType is
}
}

static DefaultFileProvider InitializeProvider(string pakFolderPath, string usmapPath, string oodlePath, EGame version)
static DefaultFileProvider InitializeProvider(string pakFolderPath, string usmapPath, string oodlePath, string zlibPath, EGame version)
{
OodleHelper.Initialize(oodlePath);

if (!string.IsNullOrEmpty(zlibPath) && zlibPath.Length > 0)
{
ZlibHelper.Initialize(zlibPath);
}

var provider = new DefaultFileProvider(pakFolderPath, SearchOption.TopDirectoryOnly, true, new VersionContainer(version))
{
MappingsContainer = new FileUsmapTypeMappingsProvider(usmapPath)
Expand Down
2 changes: 2 additions & 0 deletions BlueprintToCpp/Utils/Properties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class Config
public string PakFolderPath { get; set; }
public string BlueprintPath { get; set; }
public string OodlePath { get; set; }
public string ZlibPath { get; set; }
public string UsmapPath { get; set; }

[JsonConverter(typeof(StringEnumConverter))]
Expand All @@ -29,6 +30,7 @@ public static Config LoadConfig(string path)
PakFolderPath = "",
BlueprintPath = "",
OodlePath = "",
ZlibPath = "",
UsmapPath = "",
Version = EGame.GAME_UE5_LATEST
};
Expand Down

0 comments on commit 3fa3ad9

Please sign in to comment.