GithubHelp home page GithubHelp logo

eliotvu / unreal-library Goto Github PK

View Code? Open in Web Editor NEW
348.0 21.0 84.0 1.79 MB

UnrealScript decompiler library for Unreal package files (.upk, .u, .uasset; etc), with support for Unreal Engine 1, 2, and 3

License: MIT License

C# 98.27% UnrealScript 1.61% Batchfile 0.11%
unreal-engine decompiler ue-explorer unreal unrealscript decompilation upk bytecode reverse-engineering deserializer

unreal-library's Introduction

Nuget Nuget

UELib

The Unreal library (UELib) provides you an API to read (parse/deserialize) the contents of Unreal Engine game package files such as .UDK, .UPK. Its main purpose is to decompile the UnrealScript byte-code to its original source-code.

It accomplishes this by reading the necessary Unreal data classes such as:

UObject, UField, UConst, UEnum, UProperty, UStruct, UFunction, UState, UClass, 
UTextBuffer, UMetaData, UPackage

Classes such as UStruct, UState, UClass, and UFunction contain the UnrealScript byte-code which we can deserialize in order to re-construct the byte-codes to its original UnrealScript source.

Additionally UELib is also capable of deserializing of many more data classes such as:

UFont, USound, UPalette, UTexture, 
UTexture2D, UTexture2DDynamic, UTexture2DComposite, UTexture3D, 
UTextureCube, UTextureFlipBook, UTextureMovie
UPrimitive, UPolys

How to use

To use this library you will need .NET Framework 4.8 (The library will move to .NET 6 or higher at version 2.0)

Install using either:

  • Package Manager:
    Install-Package Eliot.UELib
    using UELib;

    // Instantiates a FileStream and deserializes the package's header, will also auto-detected a suitable build to associate the package with.
    var package = UnrealLoader.LoadPackage(@"C:\Path\Package.upk", System.IO.FileAccess.Read);
    Console.WriteLine($"Version: {package.Summary.Version}");

    // Necessary if working with packages that have been cooked for a console platform, and IF the build was not properly auto-detected. 
    // package.CookerPlatform = BuildPlatform.Console;
    
    // Initializes the registered classes, constructs and deserializes(loads) the package objects.
    package.InitializePackage();

    // Now we can iterate over all the initialized objects, but beware! This includes fake-import objects.
    foreach (var obj in package.Objects)
    {
        // If positive then we have an export, or import if negative, if null, we are working with a 'None' object, but this shouldn't occur here.
        if ((int)obj > 0)
        {
            Console.WriteLine($"Export:");
        }
        else if ((int)obj < 0)
        {
            Console.WriteLine($"Import:");
        }

        Console.WriteLine($"ObjectIndex: {(int)obj}");
        Console.WriteLine($"Name: {obj.Name}");
        Console.WriteLine($"Class: {obj.Class?.Name}");
        Console.WriteLine($"Outer: {obj.Outer}");
        Console.WriteLine($"Path: {obj.GetReferencePath()}");
    }

If you're looking to modify the library for the sole purpose of modding UE Explorer, I recommend you to clone or fork this repository and install UE Explorer within your UELib/src/bin/Debug/ folder, or change the project's configuration to build inside of the UE Explorer's folder.

Compatible Games

This is a table of games that are confirmed to be compatible with the current state of UELib, the table is sorted by Package-Version.

Name Engine:Branch Package/Licensee Support State
Unreal 100-226 61/000
Star Trek: The Next Generation: Klingon Honor Guard 219 61/000
X-COM: Alliance 200-220 61/000 Bad output at the start of functions (BeginFunctionToken)
Dr. Brain: Action Reaction 224 63-68/000
Nerf Arena Blast 225 63-68/000
The Wheel of Time 225:WoT 63-68/000
Unreal Mission Pack: Return to Na Pali 226b 68/000
Unreal Tournament 338-436 68-69/000
Deus Ex 400-436 68/000
Jazz Jackrabbit 3D 400 68/000
Duke Nukem Forever (2001) 613 68/002 UStruct offsets are off leading to bad output code
Rune 400 69/000
Unrealty 405 69/000
X-COM: Enforcer 420 69/000
Tactical Ops: Assault on Terror 436 69/000
Star Trek: Deep Space Nine: The Fallen 338 73/000
Harry Potter and the Sorcerer's Stone 436 76/000
Harry Potter and the Chamber of Secrets 433 79/000
Disney's Brother Bear 433 80/000 Link
Mobile Forces 436 81-83/000, 69
Clive Barker's Undying 420 72-85/000 Versions 72 to 83 are not auto detected.
Thief: Deadly Shadows 777:Flesh 95/133 LinkedData not supported
Deus Ex: Invisible War 777:Flesh 95/069 LinkedData not supported
XIII 829 100/058
Postal 2: Paradise Lost 1417 118/002
Tom Clancy's Splinter Cell 829 100/017
Tom Clancy's Rainbow Six 3: Raven Shield 600-927 118/012-014
Unreal Tournament 2003 1077-2225 119/025
Devastation 600-? 118-120/004-008
Unreal II: The Awakening 829-2001 126/2609
Unreal II: eXpanded MultiPlayer 2226 126/000 Custom features are not decompiled
Unreal Tournament 2004 3120-3369 128/029
America's Army 2 3339 128/032:033 2.5, 2.6, 2.8
America's Army (Arcade) 3339 128/032 2.6
Red Orchestra: Ostfront 41-45 3323-3369 128/029
Killing Floor 3369 128/029
Battle Territory: Battery 3369 128/029?
Vanguard: Saga of Heroes Unknown 129/035
Harry Potter and the Prisoner of Azkaban 2226 129/000 Link
Shrek 2 2226 129
Shark Tale 2226 129/003
Lemony Snicket's A Series of Unfortunate Events 2226 129/003
Swat 4 2226:Vengeance 129/027
Tribes: Vengeance 2226:Vengeance 130/027
Bioshock 2226:Vengeance 130-141/056
Bioshock 2 2226:Vengeance 143/059
Unreal Championship 2: Liandri Conflict 3323 151/002 Third-party
The Chronicles of Spellborn 3323 159/029
Duke Nukem Forever (2011) Unknown 156/036 Extraction is required
Roboblitz 2306 369/006
Medal of Honor: Airborne 2859 421/011
Frontlines: Fuel of War 2917 433/052 Poor output of functions
Army of Two 3004 445/079 Overall quality has not been verified
Mortal Kombat Komplete Edition 2605 472/046
Stargate Worlds 3004 486/007
Gears of War 3329 490/009
Unreal Tournament 3 3809 512/000
Mirrors Edge 3716 536/043
Alpha Protocol 3857 539/091
APB: All Points Bulletin 3908 547/028-032
X-Men Origins: Wolverine 4206 568/101 Overall quality has not been verified
Gears of War 2 4638 575/000
CrimeCraft 4701 576/005
Batman: Arkham Asylum 4701 576/21
Medal of Honor (2010) 100075??? 581/058 Bad byte-codes
Singularity 4869 584/126
MoonBase Alpha 4947 587/000
Saw Unknown 584/003
The Exiled Realm of Arborea or TERA 4206 610/014
Monday Night Combat 5697 638/000
DC Universe Online 5859 638/6405
Unreal Development Kit 5860-12791 664-868
Blacklight: Tango Down 6165 673/002
Dungeons & Dragons: Daggerdale 6165 674/000
Dungeon Defenders 6262 678/002
Alice Madness Returns 6760 690/000
The Ball 6699 706/000
Bioshock Infinite 6829 727/075
Bulletstorm 7052 742/029
Red Orchestra 2: Heroes of Stalingrad 7258 765/Unknown
Rising Storm 2: Vietnam 7258 765/771
Aliens: Colonial Marines 4170 787/047
Infinity Blade 1 7595 788/001 Console
Dishonored 9099 801/030
Tribes: Ascend 7748 805/Unknown
Tony Hawk's Pro Skater HD
Rock of Ages 7748 805/000
Batman: Arkham City 7748 805/101
Batman: Arkham Origins 7748 807/138 Not verified
Sanctum 7876 810/000
AntiChamber 7977 812/000
Waves 8171 813/000
Super Monday Night Combat 8364 820/000
Gears of War 3 8653 828/000
Quantum Conundrum 8623 832/32870
Borderlands 4871 Unknown
Borderlands 2 8623/023 832/056
Remember Me 8623 832/021
The Haunted: Hells Reach 8788 841/000
Asura's Wrath 8788 841/000 -zlib; platform needs to be set to console.
Blacklight Retribution 8788-10499 841-864/002
Infinity Blade 2 9059 842-864/001 Console
Q.U.B.E 8916 845/000
DmC: Devil May Cry 8916 845/004
XCOM: Enemy Unknown 8916 845/059
Gears of War: Judgement 10566 846/000
InMomentum 8980 848/000
Unmechanical 9249 852/000
Deadlight 9375 854/000
Land of the Dead 9375 854/000
Ravaged 9641 859/000
The Five Cores 9656 859/000
Painkiller HD 9953 860/000
Chivalry: Medieval Warfare 10246 860/000
Hawken 10681 860/004
Rocket League 10897 867/009 (868/032 has not been tested) Decryption required
Styx: Master of Shadows 10499 860/004
Batman: Arkham Knight 863/32995 Not verified
Infinity Blade 3 868/000 Console
Guilty Gear Xrd 10246 868/003 Decryption required
Bombshell 11767 870/000
Orcs Must Die! Unchained 20430 870/000
Gal*Gun: Double Peace 10897 871/000
Might & Magic Heroes VII 12161 868/004 (Signature and custom features are not supported)
A Hat in Time 12097 877-893/005
Shadow Complex Remastered 10897 893/001
Soldier Front 2 6712 904/009
Rise of the Triad 10508 Unknown
Outlast 12046 Unknown
Sherlock Holmes: Crimes and Punishments 10897 Unknown
Alien Rage 7255 Unknown

Beware, opening an unsupported package could crash your system! Make sure you have saved everything before opening any file!

Note UE3 production-ready packages are often compressed and must first be decompressed, Unreal Package Decompressor by Gildor is a tool that can decompress most packages for you; for some games you need a specialized decompressor, see for example RLUPKTool.

Want to add support for a game? See adding support for new Unreal classes

Do you know a game that is compatible but is not listed here? Click on the top right to edit this file!

How to contribute

  • Open an issue
  • Or make a pull-request by creating a fork of this repository, create a new branch and commit your changes to that particular branch, so that I can easily merge your changes.

Special thanks to

unreal-library's People

Contributors

dazombiekiller avatar dependabot[bot] avatar eideren avatar eliotvu avatar etkramer avatar hanfling avatar hox8 avatar hyenacoding avatar robojumper avatar thefoof avatar un-drew avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unreal-library's Issues

Chivalry Medival Warfare - not fully supported?

Hello and thank you for such a lovely software!

I've tried to fix a bug in existing CWM mod, but upon opening the .u file, I get red colors on objects with info "Deserialization failed by the following exception" regarding end of stream read.

From your forums I see that:

XCom: Enemy Unknown
Bioshock Infinite
Chivarly: Medieval Warfare
Are supported.

Did something changed since the last supported version? Do I need to enter some custom Version/Licensee?

Regards

LZX and ZLIB compression ...

... I need some different files for testing (LZX: Xbox, ZLIB: PS) - if you guys can send me, I will appreciate.

Eliot@ LZO decompression is ready - I can send you the files (...or just give me the access...).
After decompression Americas Army 4 is fully supported.

So far:
AAO250
AAO285
AA3
AA4
Unreal Championship 2
Mass Effect 1

FixToken() but for Flags?

Hey, would you mind adding something like FixToken() but for Flags, so they can be replaced easily?
I don't really know C# but i have had some progress adding support for a game.
Thanks

References to contained archetypes in the defaultproperties block are not decompiled

Normally, if a reference to an archetype occurs UELib will decompile and inline that archetypes declaration if its outer matches the current context. However for some reason this is not always the case e.g.

begin object name=Default__BCAI_EnemyBossDus01 class=BCAI_EnemyBossDus01
    ReactionManager=BCAIReactionManager'Default__BCAI_EnemyBossDus01.ReactionManager0'
object end

Array Property and UnrealConfig.VariableTypes

Its not an issue but more like a question.
My problem is how to Deserialize Property of array type.
I manage to deserialize the static mesh structure
https://github.com/Menta2L/Unreal-Library/blob/master/Engine/UnStaticMesh.cs
but
according to the UDK that structure should have a property Materials witch is an array with several properties like
[
bNoDynamicShadowCast=false,
EnableCollisionforShadow=false,
EnableCollision=true,
Material=Aden_caslte_door_T.Aden_c_door01
]
Right now when i call
var str = property.Decompile();
its always returns /* Array type was not detected. */
so my guess is that i should use UnrealConfig.VariableTypes to define that "material type" somehow.

Is it possible to create a wiki page to give use example how we can use UnrealConfig.VariableTypes

Index Out of Range error

Thank you for creating this tool. It's helped us make massive strides in regards to modding quire a few games. However, when attempting to decompile certain unsupported classes, Unreal Explorer will display the following error:

image (1)

If possible could you please look into seeing if this can be resolved? It would mean we could a lot more stuff such as editing Arkham's playable character packages which still contain a lot of cut content that we would like to restore.

Thank you again for all the wonderful work you've done for all the modding communities.

The size is not equal how to bypass?

The size from content tab of SkeletalMeshes or Textures is not equal, it needs be the same size in bytes to import this new binary table.
Do you know how to bypass this error in UE Explorer? I wish to import it with different size. Okey I should use Hex workshop or any Hex to localize start offsets and end offsets to replace with new data of the same file extension but I want to do this with UE explorer automatically. Also do you think it will work ingame? Do you think that most modern games has integrity checking for executables and game achieve files?

Feature - XXX Unreal console package

Hello do you have any plans to add new feature for loading packages from any Unreal 3 games ported to both 7th gen consoles?
I know you may ask why we try mod games with Xenia Canary or with other emulators, so we want to move SkeletalMesh data from XXX to UPK by exporting and importing this tables in the same size in bytes. I hope it will work once you add support
But you don't need to do that I just asking.

Killing Floor .u encrypted

First of all, thank you so much for this tool, is awesome, I just wanna add few things I've seen.

There are a lot of "UnresolvedNativeFunction_" functions, but I have no problem with that, I search Unreal functions and I can realize it, if it is Canvas.UnresolvedNativeFunction_99(Caption, W, H) I realize it is StrLen.

And another is:

                    // End:0xC98
                    if(TotalAmmo > 0)
                    {
                        // End:0xE0F
                        MagCount = NativeFunctionToken(ArgumentOutOfRangeException);
                        // Failed to format nests!:System.ArgumentOutOfRangeException: El índice estaba fuera del intervalo. Debe ser un valor no negativo e inferior al tamaño de la colección.
Nombre del parámetro: index
   en System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   en UELib.Core.UStruct.UByteCodeDecompiler.DecompileNests(Boolean outputAllRemainingNests)
   en UELib.Core.UStruct.UByteCodeDecompiler.Decompile()
                        // 15 & Type:If Position:3599
                        // Failed to format remaining nests!:System.ArgumentOutOfRangeException: El índice estaba fuera del intervalo. Debe ser un valor no negativo e inferior al tamaño de la colección.
Nombre del parámetro: index
   en System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   en UELib.Core.UStruct.UByteCodeDecompiler.DecompileNests(Boolean outputAllRemainingNests)
   en UELib.Core.UStruct.UByteCodeDecompiler.Decompile()
                        // 15 & Type:If Position:3599
}

Regards

Faster read/write mechanism

I've been slowly optimizing (and adding massive amounts of missing classes/structures/etc) to the library, and thought I'd share at least the base performance enhancing drug.

Deserialization times are incredibly slow once you start loading more and more classes (such as actors, components, etc), that have special serialization requirements. Mostly due to the fact that you are allocating lists, arrays, doing single-reads at a time, when you should be doing things in "bulk". (Such as TArray.SerializeBulk())

The following is the meat and potatoes for the reading (and partial writing) using much faster mechanisms, and proper support for structure-based reads, rather than per-field reads (which are slow)

https://gist.github.com/6c32846e50e029a6042c367052f3133a

Unfortunately, since the UE Explorer isn't "open source", I have to manage my own custom build of it, while I do a lot of cleanup, and reworking a lot of the UElib internals due to lack of support for a lot of the engine serialization tasks (such as components, custom serialization, bulk data, and non-default properties that you need tangible access to, rather than just string data). I'd offer a pull request, but it will cause a lot of "taint" to the library as you know it.

Update support for APB: All Points Bulletin

The support for APB: All Points Bulletin is drastically outdated due the game developers having developed protections to protect the game's data files.

This issue is open for anyone to take, I personally lack the knowledge for this game to know what needs work or let alone know which compression or encryption they used, you are free to send a pull request to fix this but make sure you assign yourself to this issue before doing so!

Decompile properties of type "Name" with quotes

The UnrealScript compiler standard way of assigning a string of the type "Name" to a name property is done by just passing the identifier (without spaces) like so SomeNameProperty=MyNameWithNoSpacesEtc, in general a "Name" type is a special unique string that gets stored only once in memory and is case-insensitive, normally the engine forbids special characters and white space characters.

But despite that, sometimes white space characters or even special characters are present anyway, which may cause issues if the user wants to re-compile the code.

Solution: Always wrap "Name" types using double quotes.

For some reason you cannot wrap names with single quotes in the defaultproperties block, despite this being the only way to write them in an UnrealScript context!

Buggy defaultproperties for stripped Killing Floor 1 packages

I know this is a bit difficult to fix, but it takes too much time to manually do batchexport stripped pckages just for defaultproperties blocks, then compare and copy-paste them to UE Lib exported classes. Most of the time defaultproperties are fine, but in some cases your decompiler fails to show array contents / prints wrong subobject name.

Example 1, weapon class:

 // Stripped
// Decompiled with UE Explorer.
defaultproperties
{
  FireModeClass=class'W_AK47Fire'
  PickupClass=class'W_AK47Pickup'
}

This will compile fine and run, until you crash when try to shoot, since FireModeClass is a static array and code should be.

FireModeClass(0)=class'W_AK47Fire'

Or, example 2, GUIBuyMenu / UT2k4MainPage classes :

 // Stripped
// Decompiled with UE Explorer.
defaultproperties
{
  PanelClass=/* Array type was not detected. */
}

should be:

PanelClass(0)="CsHDMut.GUI_BuyMenuTab"

And a subobject ,example 3:

 // Stripped
// Decompiled with UE Explorer.
defaultproperties
{
  begin object name=InventoryBox class=GUI_BuyMenuInvListBox
    OnCreateComponent=InternalOnCreateComponent
    WinTop=0.0708410
    WinLeft=0.0001080
    WinWidth=0.3282040
    WinHeight=0.5218560
  object end
  // Reference: GUI_BuyMenuInvListBox'GUI_BuyMenuTab.InventoryBox'
  InvSelect=InventoryBox
  begin object name=SaleBox class=GUI_BuyMenuSaleListBox
    OnCreateComponent=InternalOnCreateComponent
    WinTop=0.0643120
    WinLeft=0.6726320
    WinWidth=0.3258570
    WinHeight=0.6740390
  object end
  // Reference: GUI_BuyMenuSaleListBox'GUI_BuyMenuTab.SaleBox'
  SaleSelect=SaleBox
}

Where OnCreateComponent, SaleSelect should have names from commented section.

Possible Arkham Asylum support?

Arkham Asylum packages currently crash at ConstructObjects() - "Exports" is not set to an instance of an object. The last line printed to the console is "CompressionFlags:2".

Splinter Cell Double Agent script load crash

When opening a Splinter Cell Double Agent script file, it crashes with the following exception:

Array dimensions exceeded supported range.

Thrown by:LoadPackage
   at UEExplorer.UI.Tabs.UC_PackageExplorer.LoadPackage()
   at UEExplorer.UI.ProgramForm.LoadFile(String fileName)System.OutOfMemoryException: Array dimensions exceeded supported range.
   at System.Collections.Generic.List`1..ctor(Int32 capacity)
   at UELib.UnrealStreamImplementations.ReadArray[T](IUnrealStream stream, UArray`1& array, Int32 count)
   at UELib.UnrealPackage.Deserialize(UPackageStream stream)
   at UELib.UnrealLoader.LoadPackage(String packagePath, FileAccess fileAccess)
   at UEExplorer.UI.Tabs.UC_PackageExplorer.LoadPack
age()

SCDA uses unreal version 2.5 according to wikipedia.

Example file: Core.txt

I'm a .Net developer. I could take a poke around with some pointers.

Floating imprecision

Floats are sometimes not formatted properly, especially if they have many decimals e.g.

Script: splashSize = 0.000025 * Mass * (250 - 0.5 * Velocity.Z);
Compiled->Decompiled to: splashSize = (2.5E-05 * Mass) * (float(250) - (0.5 * Velocity.Z));

The decompilation of floats is handled at PropertyDisplay

Solution: Changing the format to "F7" outputs 0.0000250, however this also outputs BobDamping=0.96 as BobDamping=0.9600000, using "G7" gives us a compact output, but it doesn't fix the first problem 👎🏻

Should we just strip the trailing zeros? Or is there a way to get the results of F7 in a compact form like G7?

DD2 Support

                /// <summary>
                /// 688/117
                /// </summary>
                [Build(688, 117)]
                DungeonDefenders2,

SerialOffset is always 0 for export table items.

How to calculate:
SerialOffset = Package.HeaderSize + Sum of SerialSize of previous items
or:

#if DUNGEONDEFENDERS2
            if (stream.Package.Build == UnrealPackage.GameBuild.BuildName.DungeonDefenders2)
            {
                if (stream.Package.Exports.Count == 0)
                {
                    SerialOffset = (int)(stream.Package.HeaderSize);
                }
                else
                {
                    var PreviousExportTableItem = stream.Package.Exports[stream.Package.Exports.Count - 1];
                    SerialOffset = (int)(PreviousExportTableItem.SerialOffset+ PreviousExportTableItem.SerialSize);                    
                }
            }
#endif   

Sorry for leaving this as an issue. I can branch when I have the time; if needed.
Maybe also someone else has a better idea how to do the trick? Espiacally because of the long->int casting ...

UT2 enclosed structure bug

Good afternoon, I hasten to report a bug. Watching incorrect parsing of properties enclosed in structure: Matrix> Plane> Vector> Float> BinaryReader.ReadSingle Reads the number is greater than 4 bytes. Follow the "matrix" properties are not deserialized.

Lineage2 UNR TerrainInfo

Batman Arkham Knight - Support

Hey can you add support for this latest Rocksteady game? It contain a lot of unknown classes made by devs to register. I do sometimes Hex pathing so it may be helpful for our modding community also for reverse engineering, Please :)

Decompression interface

I was interested to see an Lineage 2 files Unfortunately they are encrypted. I already manage to decrypt them and read them via Unreal-Library but for that i had to modify several of your functions.
So my suggestions is to Implement kind of interface inside Unreal-Library UPackageStream for decryption so people will be able to implement such a functionality in theirs own classes

Running UE via command line?

Thanks so much for this decompiler! It's been working wonders. I was curious to know if you can run this via command line? I'm looking to write a batch script that will export a bunch of .uc files from a .upk.

Support for Batman: Arkham Knight

Hi EliotVU, I'm not very well-versed in programming or game development, but I'm an Arkham Knight modder who is sort of desperate to find new advances in Arkham modding. I've created several mods through hex editing and creating Config/DLC files to create new custom skins, but I know there are significantly more possibilities using UE Explorer.

I would be extremely grateful if you could add further support for Batman: Arkham Knight as there is very little that is readable.
Although, I don't want to bother you for long, Thanks for your time.

Missing UE Explorer solution

If this project is still alive I can write decompression block but to do this I need entire source code - not only UElib. Let me know soon as possible.

Support for Advent Rising (PC)

When I try to open the game's files in UE-Explorer, it raises either "EndOfStreamException" or "ArgumentOutOfRangeException"

Advent Rising - samples.zip

I guess it might be caused by the filename length written in 32-bit value, not in byte, but it's just an unconfirmed assumption.
image

According to header, the package version is 146(?) - don't know if it's been dealt with before but I haven't been able to find it in the list of compatible ones.

XCOM issue with v1.3

When I try to load .upk files from the Long War or Long War Rebalanced mods for XCOM: Enemy Within (which, in my understanding, are pre-decrypted), I either get erroneous decompiled code, or I get an unhandled exception upon load.

If I load it in v1.27, it works fine. I don't have any further information currently, but if I can help track down this problem, please let me know how I can help.

Support for Duke Nukem Forever

Hi, i saw this library for UnrealScripts and i would like to ask if it's possible to add support for decompiling Duke Nukem Forever .u scripts. I'm asking this because right now there's an ongoing project aiming to restore the level editor of the release version, the project is progressing really well and it already features a script compiler, but the actual script editing is missing, so would be nice to have a way to decompile DNF .u scripts. Here's the Github repo of the DNF 2011 Editor restoration:

https://github.com/jmarshall23/DNF-reimposition

Crash while reading file from Battleborn

System.ArgumentOutOfRangeException: 'Non-negative number required.
Parameter name: value

it seems like the wrong value is passed to Skip

PoplarGame.zip (original compressed file, in case I made a mistake while unpacking)

Package Version:874/78
Build:Unknown
Header Size: 2890256
Package Flags:3769106441
Names Count:19449 Names Offset:1697 Exports Count:27451 Exports Offset:694012 Imports Count:1557 Imports Offset:650416
GUID:af56e64a-0059-45fe-b272-7ed2023e498a
Generations Count:131
EngineVersion:69149103
CookerVersion:65683
CompressionFlags:0
PackageSource:4136500508

Edit: confirmed I extracted it as LZO correctly, even if I change UELib to read it as a Borderlands 2 file it still crashes.

[Bug] References in defaultproperties are not deserialized properly

Every object references used in the defaultproperties are deserialized inline every time they are referenced
Decompiling UDK's SkeletalMeshActor for example yields this:

begin object name=SkeletalMeshComponent0 class=SkeletalMeshComponent
    Animations=AnimNodeSequence'Default__SkeletalMeshActorSpawnable.SkeletalMeshComponent0.AnimNodeSeq0'
    ReplacementPrimitive=none
    LightEnvironment=DynamicLightEnvironmentComponent'Default__SkeletalMeshActorSpawnable.MyLightEnvironment'
object end
// Reference: SkeletalMeshComponent'Default__SkeletalMeshActorSpawnable.SkeletalMeshComponent0'
SkeletalMeshComponent=SkeletalMeshComponent0
[...]
begin object name=SkeletalMeshComponent0 class=SkeletalMeshComponent
    Animations=AnimNodeSequence'Default__SkeletalMeshActorSpawnable.SkeletalMeshComponent0.AnimNodeSeq0'
    ReplacementPrimitive=none
    LightEnvironment=DynamicLightEnvironmentComponent'Default__SkeletalMeshActorSpawnable.MyLightEnvironment'
object end
// Reference: SkeletalMeshComponent'Default__SkeletalMeshActorSpawnable.SkeletalMeshComponent0'
Components(1)=SkeletalMeshComponent0
[...]
begin object name=SkeletalMeshComponent0 class=SkeletalMeshComponent
    Animations=AnimNodeSequence'Default__SkeletalMeshActorSpawnable.SkeletalMeshComponent0.AnimNodeSeq0'
    ReplacementPrimitive=none
    LightEnvironment=DynamicLightEnvironmentComponent'Default__SkeletalMeshActorSpawnable.MyLightEnvironment'
object end
// Reference: SkeletalMeshComponent'Default__SkeletalMeshActorSpawnable.SkeletalMeshComponent0'
CollisionComponent=SkeletalMeshComponent0

Whereas the source script only creates the object once and use the name reference each time.
The fix I have on my branch is too hacky I feel to create a PR here to fix this issue, sorry.

InvalidOperation when decompiling the defaultproperties of an array of bools

Original code:

    BoolArray(0)=true
    BoolArray(1)=false

Decompilation output:

    BoolArray(0)=
/* Exception thrown while deserializing BoolArray
System.InvalidOperationException: Object waarvoor null is toegestaan, moet een waarde hebben.
   bij System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
   bij UELib.Core.UDefaultProperty.DeserializeDefaultPropertyValue(PropertyType type, DeserializeFlags& deserializeFlags) */
    BoolArray(1)=
/* Exception thrown while deserializing BoolArray
System.InvalidOperationException: Object waarvoor null is toegestaan, moet een waarde hebben.
   bij System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
   bij UELib.Core.UDefaultProperty.DeserializeDefaultPropertyValue(PropertyType type, DeserializeFlags& deserializeFlags) */

Cause: UE1, UE2 do not support an array of bools, but as of UE3 this had been supported, however the decompiler still assumes the UE2 behavior.

[Bug] Optional parameter default values are not deserialized properly

The default value is interpreted as part of the method body instead of as part of the function signature.
I.E. it outputs

function F( float fParam )
{
    fParam = 0;

While the source is:

function F( float fParam = 0 )
{

To fix this issue you would have to read the start of that function's bytecode, each optional parameter has a corresponding DefaultParameterToken or NothingToken, decompile those inline to the parameter declaration and, when deserializing the function body, skip past those and you are done.
I don't need to fix this issue so I won't do a PR for this one either, sorry.

Fails when unpacking rocket league UPK's

When attempting to decompile rocketleague UPK's the application crashes with multiple error messages.

When unpacking TAGame.upk

Thrown by:LoadPackage
   at UEExplorer.UI.Tabs.UC_PackageExplorer.LoadPackage()
   at UEExplorer.UI.ProgramForm.LoadFile(String fileName)System.OverflowException: Array dimensions exceeded supported range.
   at UELib.UnrealReader.ReadText()
   at UELib.UNameTableItem.Deserialize(IUnrealStream stream)
   at UELib.UnrealPackage.Deserialize(UPackageStream stream)
   at UELib.UnrealLoader.LoadPackage(String packagePath, FileAccess fileAccess)
   at UEExplorer.UI.Tabs.UC_PackageExplorer.LoadPackage()

When unpacking TAGame_LOC_INT.upk

Thrown by:LoadPackage
   at UEExplorer.UI.Tabs.UC_PackageExplorer.LoadPackage()
   at UEExplorer.UI.ProgramForm.LoadFile(String fileName)System.IO.EndOfStreamException: Unable to read beyond the end of the stream.
   at System.IO.BinaryReader.FillBuffer(Int32 numBytes)
   at System.IO.BinaryReader.ReadUInt64()
   at UELib.UNameTableItem.Deserialize(IUnrealStream stream)
   at UELib.UnrealPackage.Deserialize(UPackageStream stream)
   at UELib.UnrealLoader.LoadPackage(String packagePath, FileAccess fileAccess)
   at UEExplorer.UI.Tabs.UC_PackageExplorer.LoadPackage()

Support for Asura's Wrath (PS3/360)

Hey, I've been meaning to look at how Asura's Wrath game logic works and what dependencies it has on Unreal Engine 3, but for some reason the Unreal Explorer/Unreal Library cannot decompile any of the classes in the games main .XXX file. I stepped through the function that handles the decompilation with DnSpy midway through the decompilation and saw some errors. I decided to jot them down to see if these could be of any help getting support for it.

(This is my first time writing an issue on this site, so sorry if there any mistakes that are common in this!)

BCAI_EnemyBossCbt06

Unable to cast object of type 'UELib.Core.UNameProperty' to type 'UELib.Core.UTextBuffer'
StackTrace	" at UELib.UnrealStreamImplementations.ReadObject[T](IUnrealStream stream)\r\n   
                          at UELib.Core.UStruct.Deserialize()\r\n   
			  at UELib.Core.UFunction.Deserialize()\r\n   
			  at UELib.Core.UObject.BeginDeserializing()" string

Unable to cast object of type 'UELib.Core.UFunction' to type 'UELib.Core.UTextBuffer'
StackTrace	"   at UELib.UnrealStreamImplementations.ReadObject[T](IUnrealStream stream)\r\n   
                            at UELib.Core.UStruct.Deserialize()\r\n
			    at UELib.Core.UFunction.Deserialize()\r\n
			    at UELib.Core.UObject.BeginDeserializing()"	string

				
AnimNameEd(4042) 
System.IO.EndOfStreamException: Unable to read beyond the end of the stream.
StackTrace "   at System.IO.__Error.EndOfFile()\r\n   
               at System.IO.BinaryReader.FillBuffer(Int32 numBytes)\r\n   
               at System.IO.BinaryReader.ReadInt32()\r\n   
               at UELib.UnrealReader.ReadIndex()\r\n   
               at UELib.UnrealReader.ReadNameIndex(Int32& num)\r\n   
			   at UELib.UObjectStream.ReadNameIndex(Int32& num)\r\n   
			   at UELib.UnrealStreamImplementations.ReadNameReference(IUnrealStream stream)\r\n   
			   at UELib.Core.UProperty.Deserialize()\r\n   
			   at UELib.Core.UObject.BeginDeserializing()"

			   
AnimNameSt(4043) 
System.IO.EndOfStreamException: Unable to read beyond the end of the stream.
StackTrace "   at System.IO.__Error.EndOfFile()\r\n   
               at System.IO.BinaryReader.FillBuffer(Int32 numBytes)\r\n   
               at System.IO.BinaryReader.ReadInt32()\r\n   
               at UELib.UnrealReader.ReadIndex()\r\n   
               at UELib.UnrealReader.ReadNameIndex(Int32& num)\r\n   
			   at UELib.UObjectStream.ReadNameIndex(Int32& num)\r\n   
			   at UELib.UnrealStreamImplementations.ReadNameReference(IUnrealStream stream)\r\n   
			   at UELib.Core.UProperty.Deserialize()\r\n   
			   at UELib.Core.UObject.BeginDeserializing()"
	
HomingRate(4045)	
System.IO.EndOfStreamException: Unable to read beyond the end of the stream.
			   at System.IO.__Error.EndOfFile()
			   at System.IO.BinaryReader.FillBuffer(Int32 numBytes)
			   at System.IO.BinaryReader.ReadInt32()
			   at UELib.UnrealReader.ReadIndex()
			   at UELib.UnrealReader.ReadNameIndex(Int32& num)
			   at UELib.UObjectStream.ReadNameIndex(Int32& num)
			   at UELib.UnrealStreamImplementations.ReadNameReference(IUnrealStream stream)
			   at UELib.Core.UProperty.Deserialize()
			   at UELib.Core.UObject.BeginDeserializing()}	System.IO.EndOfStreamException

ExecBehaviorShockWave(4049)
System.InvalidCastException: Unable to cast object of type 'UELib.Core.UIntProperty' to type 'UELib.Core.UTextBuffer'.
			   at UELib.UnrealStreamImplementations.ReadObject[T](IUnrealStream stream)
			   at UELib.Core.UStruct.Deserialize()
			   at UELib.Core.UFunction.Deserialize()
			   at UELib.Core.UObject.BeginDeserializing()}	System.InvalidCastException

EndVajraMode(4063)
System.IO.EndOfStreamException: Unable to read beyond the end of the stream.
			   at System.IO.__Error.EndOfFile()
			   at System.IO.BinaryReader.FillBuffer(Int32 numBytes)
			   at System.IO.BinaryReader.ReadInt32()
			   at UELib.UnrealReader.ReadIndex()
			   at UELib.UnrealReader.ReadNameIndex(Int32& num)
			   at UELib.UObjectStream.ReadNameIndex(Int32& num)
			   at UELib.UnrealStreamImplementations.ReadNameReference(IUnrealStream stream)
			   at UELib.Core.UProperty.Deserialize()
			   at UELib.Core.UObject.BeginDeserializing()}	System.IO.EndOfStreamException

BCAI_EnemyBossCbt06(4083)
System.InvalidCastException: Unable to cast object of type 'UELib.Core.UFunction' to type 'UELib.Core.UTextBuffer'.
			   at UELib.UnrealStreamImplementations.ReadObject[T](IUnrealStream stream)
			   at UELib.Core.UStruct.Deserialize()
			   at UELib.Core.UState.Deserialize()
			   at UELib.Core.UClass.Deserialize()
			   at UELib.Core.UObject.BeginDeserializing()}	System.InvalidCastException

Small issue

Hey there Eliot, first of all, thanks again for the great app! This issue isn't really related to a bug or a problem with the app, it's more like a question, if solved it might be useful for someone else as well.

So basically, i've been trying to extract *.uc files from a file (this one specifically)

The problem i'm having is the following:
This is what the defaultproperties look like:

Sin título

when they should look like this:

Screenshot_2

So basically it's showing up as "L2EffectEmitter" instead of "L2EffectEmiter'L2EffectEmiter0'

I'm 100% doing something wrong here, do you perhaps know how to solve this?
Here's the Array Definition i'm using: Package.Class.PreshotAction:ObjectProperty

Also, when i see the script inside UE Explorer, the reference is there, but it isn't applied to the ShotAction line for whatever reason

// Reference: L2EffectEmitter'l2_14207_skill.L2EffectEmitter53'
ShotAction(0)=L2EffectEmitter53

Screenshot_1

PD: i can fix this by hand, but sadly, i'd have to do that manually for over 4000 files.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.