EliotVU / Unreal-Library

UnrealScript decompiler library for Unreal package files (.upk, .u, .uasset; etc), with support for Unreal Engine 1, 2, and 3
MIT License
367 stars 86 forks source link

Decryption support broken? #90

Closed AN3Orik closed 3 weeks ago

AN3Orik commented 3 weeks ago

Hi there. I'm trying to add custom package encryption support via adding attributes like a for AA2:

[Build(128, 32u, BuildGeneration.AGP)] [BuildEngineBranch(typeof(EngineBranchAA2))]
AA2_2_5,

But when i'm trying to load package for tests like a:

var package = UnrealLoader.LoadPackage(@"sometestpackage.upk", UnrealPackage.GameBuild.BuildName.AA2_2_6);

Package failed to decode because Decoder is null:

image

Question: BuildEngineBranch attribute isn't working at current version or a doing smthng wrong? Because i'm looking at methods PackageTests.AA2.cs and seeing this:

[TestMethod]
public void TestPackageDecryptionAAA2_6()
{
    // Skip test if the dev is not in possess of this game.
    if (!Directory.Exists(PackagesPath))
    {
        Console.Error.Write($"Couldn't find packages path '{PackagesPath}'");
        return;
    }

    using var linker = UnrealLoader.LoadPackage(EncryptedCorePackagePath, UnrealPackage.GameBuild.BuildName.AA2_2_6);
    Assert.IsNotNull(linker);
    Assert.AreEqual(UnrealPackage.GameBuild.BuildName.AA2_2_6, linker.Build.Name, "Incorrect package's build");
    Assert.AreEqual(typeof(EngineBranchAA2), linker.Branch.GetType(), "Incorrect package's branch");
}
AN3Orik commented 3 weeks ago

Ah, got it. File-wide encryption isn't supported at all.