From b42a921737d24baca960bc20499e7028c6fe9b94 Mon Sep 17 00:00:00 2001 From: Eliot Date: Mon, 30 May 2022 18:57:27 +0200 Subject: [PATCH 01/64] Add missing --- src/Eliot.UELib.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Eliot.UELib.csproj b/src/Eliot.UELib.csproj index c3b1df75..13d5cd1f 100644 --- a/src/Eliot.UELib.csproj +++ b/src/Eliot.UELib.csproj @@ -11,6 +11,7 @@ UELib Eliot.UELib v4.8 + 7.3 512 From 58a5ed50274c50264a219fa7ff680529812d8ed0 Mon Sep 17 00:00:00 2001 From: Eliot Date: Wed, 8 Jun 2022 03:18:08 +0000 Subject: [PATCH 02/64] List Harry Potter 1 & 2 as supported --- README.md | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index b88ffccc..d00e5694 100644 --- a/README.md +++ b/README.md @@ -39,34 +39,36 @@ 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 | Package/Licensee | Support State | -| ------- | --------- | ------------------- | ----------------- +| Name | Engine:Branch | Package/Licensee | Support State | +| --------------------- | ---------------- | ------------------- | ----------------- | Unreal | 100-226 | 61/000 | | -| [Star Trek: The Next Generation: Klingon Honor Guard](Star%20Trek:%20The%20Next%20Generation:%20Klingon%20Honor%20Guard) | Unknown | 61/000 | | +| [Star Trek: The Next Generation: Klingon Honor Guard](Star%20Trek:%20The%20Next%20Generation:%20Klingon%20Honor%20Guard) | 219 | 61/000 | | | Unreal Mission Pack: Return to Na Pali | 226b | 68/000 | | | Unreal Tournament | 338-436 | 68/000 | | -| Deus Ex | Unknown | Unknown | | -| Thief: Deadly Shadows | Thief | 95/133 | LinkedData not supported | -| Deus Ex: Invisible War | Thief | 95/069 | LinkedData not supported | +| Deus Ex | 400-436 | 68/000 | | +| Harry Potter and the Sorcerer's Stone | 436 | 76/000 | | +| Harry Potter and the Chamber of Secrets | 433 | 79/000 | | +| Deus Ex: Invisible War | 777:Flesh | 95/069 | LinkedData not supported | +| Thief: Deadly Shadows | 777:Flesh | 95/133 | LinkedData not supported | | | | | | | | | | | -| XIII | Unknown | 100/058 | | -| Tom Clancy's Rainbow Six 3: Raven Shield | 600-? | 118/012:014 | | +| XIII | 829 | 100/058 | | +| Tom Clancy's Rainbow Six 3: Raven Shield | 600-927 | 118/012:014 | | | Unreal Tournament 2003 | 1077-2225 | 119/025 | | | 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 | 3369 | 128/032:033 | 2.5, 2.6, 2.8 | -| America's Army (Arcade) | 3369 | 128/032 | 2.6 | +| 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 | Unknown | Unknown | | -| Swat 4 | Vengeance | 129/027 | | -| Tribes: Vengeance | Vengeance | 130/027 | | -| Bioshock | Vengeance | 130-141/056 | | -| Bioshock 2 | Vengeance | 143/059 | | -| Unreal Championship 2: Liandri Conflict | 3323 | 151/002 | (Third-party) | -| The Chronicles of Spellborn | Unknown | 159/029 | | +| Battle Territory: Battery | 3369 | 128/029? | | +| 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](https://forums.beyondunreal.com/threads/unreal-championship-2-script-decompiler-release.206036/) | +| The Chronicles of Spellborn | 3323 | 159/029 | | | | | | | | | | | | | Roboblitz | 2306 | 369/006 | | @@ -87,7 +89,7 @@ This is a table of games that are confirmed to be compatible with the current st | 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 | 6094-12791 | 664-868 | | +| Unreal Development Kit | 5860-12791 | 664-868 | | | Blacklight: Tango Down | 6165 | 673/002 | | | Dungeons & Dragons: Daggerdale | 6165 | 674/000 | | | Dungeon Defenders | 6262 | 678/002 | Earlier releases only | @@ -123,7 +125,7 @@ This is a table of games that are confirmed to be compatible with the current st | Painkiller HD | 9953 | 860/000 | | | Hawken | 10681 | 860/004 | | | Guilty Gear Xrd | 10246 | 868/003 | [Decryption required](https://github.com/gdkchan/GGXrdRevelatorDec) | -| Gal*Gun: Double Peace | 10897 | 871/000 | | +| Gal\*Gun: Double Peace | 10897 | 871/000 | | | [Might & Magic Heroes VII](https://en.wikipedia.org/wiki/Might_%26_Magic_Heroes_VII) | 12161 | 868/004 | (Signature and custom features are not supported) | Soldier Front 2 | 6712 | 904/009 | | | Rise of the Triad | Unknown | Unknown | | From eb0203621e15ab2146896b94ec505e0e4133d9ab Mon Sep 17 00:00:00 2001 From: Eliot Date: Wed, 8 Jun 2022 04:14:35 +0000 Subject: [PATCH 03/64] Credits! --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index d00e5694..aab4e41a 100644 --- a/README.md +++ b/README.md @@ -141,3 +141,12 @@ saved everything before opening any file!** Want to add support for a game? See [adding support for new Unreal classes](https://github.com/EliotVU/Unreal-Library/wiki/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! + +Special thanks to +============== + + * Epic Games for [UDN: Packages](http://www.hypercoop.tk/infobase/archive/unrealtech/Packages.htm) (general package format) + * [Antonio Cordero Balcazar](https://github.com/acorderob) for [UTPT](https://www.acordero.org/projects/unreal-tournament-package-tool) (game support) and documentation (format) + * [Dmitry Jemerov](https://github.com/yole) for [unhood](https://github.com/yole/unhood) (early UE3 format) + * [Konstantin Nosov](https://github.com/gildor2) for providing help and [UE Viewer](http://www.gildor.org/en/projects/umodel) (game support) + * [Contributors](https://github.com/EliotVU/Unreal-Library/graphs/contributors) From a99e44a66833eaa112429dca8ee17045e995cfe9 Mon Sep 17 00:00:00 2001 From: Eliot Date: Wed, 8 Jun 2022 04:37:04 +0000 Subject: [PATCH 04/64] List "Postal 2: Paradise Lost" as compatible. --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index aab4e41a..eef9da30 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,8 @@ This is a table of games that are confirmed to be compatible with the current st | | | | | | | | | | | XIII | 829 | 100/058 | | -| Tom Clancy's Rainbow Six 3: Raven Shield | 600-927 | 118/012:014 | | +| Postal 2: Paradise Lost | 1417 | 118/002 | | +| Tom Clancy's Rainbow Six 3: Raven Shield | 600-927 | 118/012-014 | | | Unreal Tournament 2003 | 1077-2225 | 119/025 | | | Unreal II: The Awakening | 829-2001 | 126/2609 | | | Unreal II: eXpanded MultiPlayer | 2226 | 126/000 | Custom features are not decompiled | @@ -79,7 +80,7 @@ This is a table of games that are confirmed to be compatible with the current st | Unreal Tournament 3 | 3809 | 512/000 | | | Mirrors Edge | 3716 | 536/043 | | | Alpha Protocol | 3857 | 539/091 | | -| APB: All Points Bulletin | 3908 | 547/028:032 | | +| APB: All Points Bulletin | 3908 | 547/028-032 | | | Gears of War 2 | 4638 | 575/000 | | | CrimeCraft | 4701 | 576/005 | | | Medal of Honor (2010) | 100075??? | 581/058 | Bad byte-codes | From 66a078bc7edca2143bd161f0fd76c0e0990bbc0f Mon Sep 17 00:00:00 2001 From: Eliot Date: Wed, 8 Jun 2022 18:50:13 +0000 Subject: [PATCH 05/64] Update UE Explorer link to point to its repository --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index eef9da30..a84ad4ab 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Install using either: See [usage](https://github.com/EliotVU/Unreal-Library/wiki/Usage) for further instructions on how to use the library in your project. -If you're looking to modify the library for the sole purpose of modding [UE Explorer](https://eliotvu.com/portfolio/view/21/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. +If you're looking to modify the library for the sole purpose of modding [UE Explorer](https://github.com/UE-Explorer/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. Want to try out the [latest library release](https://github.com/EliotVU/Unreal-Library/releases)? Then you can simply save ```Eliot.UELib.dll``` to the folder where you have installed UE Explorer at. Note that the current release of UE Explorer is using version [1.2.7.1](https://github.com/EliotVU/Unreal-Library/releases/tag/release-1.2.7.1). From 1a05041a3e7e5164ed047494c29caca005ca9581 Mon Sep 17 00:00:00 2001 From: Eliot Date: Sun, 12 Jun 2022 16:49:03 +0000 Subject: [PATCH 06/64] Add "DmC: Devil May Cry" to the list --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a84ad4ab..9cc08f2f 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,7 @@ This is a table of games that are confirmed to be compatible with the current st | Blacklight Retribution | 8788-10499 | 841-864/002 | | | Infinity Blade 2 | 9059 | 842/001 | | | 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 | | From f347ad12cb86f0a356253d5b44bd87dcfd21f0a6 Mon Sep 17 00:00:00 2001 From: Eliot Date: Wed, 22 Jun 2022 12:04:52 +0000 Subject: [PATCH 07/64] List "X-Men Origins: Wolverine" as supported. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 9cc08f2f..036b01b0 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,7 @@ This is a table of games that are confirmed to be compatible with the current st | 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 | | | Medal of Honor (2010) | 100075??? | 581/058 | Bad byte-codes | From dc5e74c64b183936722428916146eadaa332f784 Mon Sep 17 00:00:00 2001 From: Eliot Date: Wed, 22 Jun 2022 12:11:57 +0000 Subject: [PATCH 08/64] Add "Army of Two" --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 036b01b0..f46b5674 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,7 @@ This is a table of games that are confirmed to be compatible with the current st | | | | | | Roboblitz | 2306 | 369/006 | | | Medal of Honor: Airborne | 2859 | 421/011 | | +| 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 | | From 01f5404cd3e899e8f5ef0e2065e64635d1bf6645 Mon Sep 17 00:00:00 2001 From: Eliot Date: Wed, 22 Jun 2022 12:18:57 +0000 Subject: [PATCH 09/64] Add "Land of the Dead" --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index f46b5674..1f27d803 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,7 @@ This is a table of games that are confirmed to be compatible with the current st | InMomentum | 8980 | 848/000 | | | [Unmechanical](http://unmechanical.net/) | 9249 | 852/000 | | | Deadlight | 9375 | 854/000 | | +| Land of the Dead | 9375 | 854/000 | | | Ravaged | 9641 | 859/000 | | | [The Five Cores](http://neeblagames.com/category/games/thefivecores/) | 9656 | 859/000 | | | Painkiller HD | 9953 | 860/000 | | From b5aa4688193993e7eb75fc315997f57f378381b6 Mon Sep 17 00:00:00 2001 From: Eliot Date: Wed, 22 Jun 2022 12:31:18 +0000 Subject: [PATCH 10/64] Add "Batman" series --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 1f27d803..6eb98585 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,7 @@ This is a table of games that are confirmed to be compatible with the current st | 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 | | @@ -105,6 +106,8 @@ This is a table of games that are confirmed to be compatible with the current st | [Dishonored](http://www.dishonored.com/) | 9099 | 801/030 | | | Tribes: Ascend | 7748 | 805/Unknown | | | Rock of Ages | 7748 | 805/000 | | +| Batman: Arkham City | 7748 | 805/101 | | +| Batman: Arkham Origins | | 807/138 | Not verified | | Sanctum | 7876 | 810/000 | | | AntiChamber | 7977 | 812/000 | | | Waves | 8171 | 813/000 | | @@ -129,6 +132,7 @@ This is a table of games that are confirmed to be compatible with the current st | [The Five Cores](http://neeblagames.com/category/games/thefivecores/) | 9656 | 859/000 | | | Painkiller HD | 9953 | 860/000 | | | Hawken | 10681 | 860/004 | | +| Batman: Arkham Knight | | 863/32995 | Not verified | | Guilty Gear Xrd | 10246 | 868/003 | [Decryption required](https://github.com/gdkchan/GGXrdRevelatorDec) | | Gal\*Gun: Double Peace | 10897 | 871/000 | | | [Might & Magic Heroes VII](https://en.wikipedia.org/wiki/Might_%26_Magic_Heroes_VII) | 12161 | 868/004 | (Signature and custom features are not supported) From 49ca201b309460bedbcd7ee69fa36d982bb4f471 Mon Sep 17 00:00:00 2001 From: Eliot Date: Wed, 22 Jun 2022 13:08:35 +0000 Subject: [PATCH 11/64] Add "Rune" --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6eb98585..e491f5a8 100644 --- a/README.md +++ b/README.md @@ -44,8 +44,9 @@ This is a table of games that are confirmed to be compatible with the current st | Unreal | 100-226 | 61/000 | | | [Star Trek: The Next Generation: Klingon Honor Guard](Star%20Trek:%20The%20Next%20Generation:%20Klingon%20Honor%20Guard) | 219 | 61/000 | | | Unreal Mission Pack: Return to Na Pali | 226b | 68/000 | | -| Unreal Tournament | 338-436 | 68/000 | | -| Deus Ex | 400-436 | 68/000 | | +| Unreal Tournament | 338-436 | 68-69/000 | | +| Deus Ex | 400-436 | 68/000 | | +| Rune | 436 | 69/000 | | | Harry Potter and the Sorcerer's Stone | 436 | 76/000 | | | Harry Potter and the Chamber of Secrets | 433 | 79/000 | | | Deus Ex: Invisible War | 777:Flesh | 95/069 | LinkedData not supported | From 20919a3db70e7921bdc30b857120c2bd4dd3017d Mon Sep 17 00:00:00 2001 From: Eliot Date: Thu, 23 Jun 2022 10:20:37 +0000 Subject: [PATCH 12/64] Add "Chivalry: Medieval Warfare" --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e491f5a8..46a5d42f 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,7 @@ This is a table of games that are confirmed to be compatible with the current st | Ravaged | 9641 | 859/000 | | | [The Five Cores](http://neeblagames.com/category/games/thefivecores/) | 9656 | 859/000 | | | Painkiller HD | 9953 | 860/000 | | +| Chivalry: Medieval Warfare | 10246 | 860/000 | | | Hawken | 10681 | 860/004 | | | Batman: Arkham Knight | | 863/32995 | Not verified | | Guilty Gear Xrd | 10246 | 868/003 | [Decryption required](https://github.com/gdkchan/GGXrdRevelatorDec) | From d39732b28c65add5dc75b8debe81f16e295367d4 Mon Sep 17 00:00:00 2001 From: Eliot Date: Wed, 29 Jun 2022 18:18:43 +0000 Subject: [PATCH 13/64] Add "Rising Storm 2: Vietnam" --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 46a5d42f..a61ab34c 100644 --- a/README.md +++ b/README.md @@ -143,6 +143,7 @@ This is a table of games that are confirmed to be compatible with the current st | Outlast | Unknown | Unknown | | | Sherlock Holmes: Crimes and Punishments | Unknown | Unknown | | | Alien Rage | Unknown | Unknown | | +| Rising Storm 2: Vietnam | Unknown | Unknown | | **Beware, opening an unsupported package could crash your system! Make sure you have saved everything before opening any file!** From bd9ffeae18f2b5a0100ad9d4be64c4ffebf4e6b5 Mon Sep 17 00:00:00 2001 From: Eliot Date: Wed, 13 Jul 2022 14:20:51 +0000 Subject: [PATCH 14/64] Add "Shadow Complex Remastered" --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a61ab34c..2234ef57 100644 --- a/README.md +++ b/README.md @@ -138,6 +138,7 @@ This is a table of games that are confirmed to be compatible with the current st | Guilty Gear Xrd | 10246 | 868/003 | [Decryption required](https://github.com/gdkchan/GGXrdRevelatorDec) | | Gal\*Gun: Double Peace | 10897 | 871/000 | | | [Might & Magic Heroes VII](https://en.wikipedia.org/wiki/Might_%26_Magic_Heroes_VII) | 12161 | 868/004 | (Signature and custom features are not supported) +| Shadow Complex Remastered | 10897 | 893/001 | | | Soldier Front 2 | 6712 | 904/009 | | | Rise of the Triad | Unknown | Unknown | | | Outlast | Unknown | Unknown | | From 3c77ab33d297e0d0d0c952975d161558b0bfc26f Mon Sep 17 00:00:00 2001 From: Eliot Date: Tue, 2 Aug 2022 13:41:24 +0000 Subject: [PATCH 15/64] Add "Duke Nukem Forever 2001" --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2234ef57..0dd56ddc 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ This is a table of games that are confirmed to be compatible with the current st | Unreal Mission Pack: Return to Na Pali | 226b | 68/000 | | | Unreal Tournament | 338-436 | 68-69/000 | | | Deus Ex | 400-436 | 68/000 | | +| Duke Nukem Forever (2001) | 613 | 68/002 | UStruct offsets are off leading to bad output code | | Rune | 436 | 69/000 | | | Harry Potter and the Sorcerer's Stone | 436 | 76/000 | | | Harry Potter and the Chamber of Secrets | 433 | 79/000 | | From f75e004820699d5704240059759c1a024ad22d7c Mon Sep 17 00:00:00 2001 From: Eliot Date: Fri, 5 Aug 2022 19:44:02 +0000 Subject: [PATCH 16/64] Update usage sample. --- README.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0dd56ddc..7c2dd26a 100644 --- a/README.md +++ b/README.md @@ -17,12 +17,29 @@ To use this library you will need [.NET Framework 4.8](https://dotnet.microsoft. Install using either: * Package Manager: + ``` Install-Package Eliot.UELib.dll ``` * NuGet: -See [usage](https://github.com/EliotVU/Unreal-Library/wiki/Usage) for further instructions on how to use the library in your project. +* Usage: See the [documentation](https://github.com/EliotVU/Unreal-Library/wiki/Usage) for more examples. + +```csharp + var package = UnrealLoader.LoadPackage(@"C:\Path\Package.upk", System.IO.FileAccess.Read); + Console.WriteLine($"Version: {package.Summary.Version}"); + + // Initializes the registered classes, constructs and deserializes(loads) the package objects. + package.InitializePackage(); + + // Now we can iterate all loaded objects, but beware! This includes fake-import objects. + foreach (var obj in package.Objects) + { + Console.WriteLine($"Name: {obj.Name}"); + Console.WriteLine($"Class: {obj.Class?.Name}"); + Console.WriteLine($"Outer: {obj.Outer}"); + } +``` If you're looking to modify the library for the sole purpose of modding [UE Explorer](https://github.com/UE-Explorer/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. From 0c3b1f083506ce5eb6d93a836d515db154a6e09d Mon Sep 17 00:00:00 2001 From: Eliot Date: Fri, 12 Aug 2022 18:33:18 +0000 Subject: [PATCH 17/64] Add "Harry Potter and the Prisoner of Azkaban" (UE2) --- README.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 7c2dd26a..e6d9eeae 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,7 @@ This is a table of games that are confirmed to be compatible with the current st | Red Orchestra: Ostfront 41-45 | 3323-3369 | 128/029 | | | Killing Floor | 3369 | 128/029 | | | Battle Territory: Battery | 3369 | 128/029? | | +| Harry Potter and the Prisoner of Azkaban | 2226 | 129/000 | [Link](https://github.com/metallicafan212/HarryPotterUnrealWiki/wiki/Main-Resources#hp3) | | Swat 4 | 2226:Vengeance | 129/027 | | | Tribes: Vengeance | 2226:Vengeance | 130/027 | | | Bioshock | 2226:Vengeance | 130-141/056 | | @@ -121,19 +122,19 @@ This is a table of games that are confirmed to be compatible with the current st | Bioshock Infinite | 6829 | 727/075 | | | Bulletstorm | 7052 | 742/029 | | | Red Orchestra 2: Heroes of Stalingrad | 7258 | 765/Unknown | | -| Aliens: Colonial Marines | Unknown | 787/047 | | +| Aliens: Colonial Marines | 4170 | 787/047 | | | [Dishonored](http://www.dishonored.com/) | 9099 | 801/030 | | | Tribes: Ascend | 7748 | 805/Unknown | | | Rock of Ages | 7748 | 805/000 | | | Batman: Arkham City | 7748 | 805/101 | | -| Batman: Arkham Origins | | 807/138 | Not verified | +| 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 | Unknown | Unknown | | +| Borderlands | 4871 | Unknown | | | Borderlands 2 | 8623/023 | 832/056 | | | Remember Me | 8623 | 832/021 | | | The Haunted: Hells Reach | 8788 | 841/000 | | @@ -158,11 +159,11 @@ This is a table of games that are confirmed to be compatible with the current st | [Might & Magic Heroes VII](https://en.wikipedia.org/wiki/Might_%26_Magic_Heroes_VII) | 12161 | 868/004 | (Signature and custom features are not supported) | Shadow Complex Remastered | 10897 | 893/001 | | | Soldier Front 2 | 6712 | 904/009 | | -| Rise of the Triad | Unknown | Unknown | | -| Outlast | Unknown | Unknown | | -| Sherlock Holmes: Crimes and Punishments | Unknown | Unknown | | -| Alien Rage | Unknown | Unknown | | -| Rising Storm 2: Vietnam | Unknown | Unknown | | +| Rise of the Triad | 10508 | Unknown | | +| Outlast | 12046 | Unknown | | +| Sherlock Holmes: Crimes and Punishments | 10897 | Unknown | | +| Alien Rage | 7255 | Unknown | | +| Rising Storm 2: Vietnam | 7258 | Unknown | | **Beware, opening an unsupported package could crash your system! Make sure you have saved everything before opening any file!** From 385c48389afb61af520e31950f8b24147122d1d1 Mon Sep 17 00:00:00 2001 From: Eliot Date: Fri, 12 Aug 2022 18:55:27 +0000 Subject: [PATCH 18/64] Add "Disney's Brother Bear" (UE1) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e6d9eeae..bf845bf3 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,7 @@ This is a table of games that are confirmed to be compatible with the current st | Rune | 436 | 69/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](https://github.com/metallicafan212/HarryPotterUnrealWiki/wiki/Main-Resources#other-kw-games) | | Deus Ex: Invisible War | 777:Flesh | 95/069 | LinkedData not supported | | Thief: Deadly Shadows | 777:Flesh | 95/133 | LinkedData not supported | | | | | | From 52855b102675023c4cc0aaa915060fd6a69f4330 Mon Sep 17 00:00:00 2001 From: Eliot Date: Sat, 13 Aug 2022 16:48:30 +0000 Subject: [PATCH 19/64] Add "X-COM Enforcer" (UE1) --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bf845bf3..7e70d7f2 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,8 @@ This is a table of games that are confirmed to be compatible with the current st | Unreal Tournament | 338-436 | 68-69/000 | | | Deus Ex | 400-436 | 68/000 | | | Duke Nukem Forever (2001) | 613 | 68/002 | UStruct offsets are off leading to bad output code | -| Rune | 436 | 69/000 | | +| Rune | 400 | 69/000 | | +| X-COM Enforcer | 420 | 69/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](https://github.com/metallicafan212/HarryPotterUnrealWiki/wiki/Main-Resources#other-kw-games) | From 1f7a897f829ac0b702a785e58dff1fad2091cefa Mon Sep 17 00:00:00 2001 From: Eliot Date: Sat, 13 Aug 2022 17:18:04 +0000 Subject: [PATCH 20/64] Add "X-COM: Alliance" (UE1) --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7e70d7f2..085a95a0 100644 --- a/README.md +++ b/README.md @@ -60,12 +60,13 @@ This is a table of games that are confirmed to be compatible with the current st | --------------------- | ---------------- | ------------------- | ----------------- | Unreal | 100-226 | 61/000 | | | [Star Trek: The Next Generation: Klingon Honor Guard](Star%20Trek:%20The%20Next%20Generation:%20Klingon%20Honor%20Guard) | 219 | 61/000 | | +| X-COM: Alliance | 200-220 | 61/000 | Bad output at the start of functions (BeginFunctionToken) | | Unreal Mission Pack: Return to Na Pali | 226b | 68/000 | | | Unreal Tournament | 338-436 | 68-69/000 | | | Deus Ex | 400-436 | 68/000 | | | Duke Nukem Forever (2001) | 613 | 68/002 | UStruct offsets are off leading to bad output code | | Rune | 400 | 69/000 | | -| X-COM Enforcer | 420 | 69/000 | | +| X-COM: Enforcer | 420 | 69/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](https://github.com/metallicafan212/HarryPotterUnrealWiki/wiki/Main-Resources#other-kw-games) | From 4f00e3d829ea95aafc091050ca2867365dc15017 Mon Sep 17 00:00:00 2001 From: Eliot Date: Sun, 14 Aug 2022 20:20:47 +0000 Subject: [PATCH 21/64] Add "Lemony Snicket's A Series of Unfortunate Events" (UE1) --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 085a95a0..b4e011cb 100644 --- a/README.md +++ b/README.md @@ -85,8 +85,9 @@ This is a table of games that are confirmed to be compatible with the current st | 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? | | +| Battle Territory: Battery | 3369 | 128/029? | | | Harry Potter and the Prisoner of Azkaban | 2226 | 129/000 | [Link](https://github.com/metallicafan212/HarryPotterUnrealWiki/wiki/Main-Resources#hp3) | +| 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 | | From dc2aa3c82f6f3c74a25b7c4ddd2948d07fcbb362 Mon Sep 17 00:00:00 2001 From: Eliot Date: Mon, 15 Aug 2022 17:35:39 +0000 Subject: [PATCH 22/64] Add "Jazz Jackrabbit 3D" (UE1) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b4e011cb..56d93491 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,7 @@ This is a table of games that are confirmed to be compatible with the current st | 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 | | | X-COM: Enforcer | 420 | 69/000 | | From ab2adb17a52210ec57937311cf47ec5ee2c7f068 Mon Sep 17 00:00:00 2001 From: Eliot Date: Mon, 22 Aug 2022 10:50:37 +0200 Subject: [PATCH 23/64] Add "Shrek 2" and "Shark Tale" (UE2) --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 56d93491..bdfa7ab2 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,8 @@ This is a table of games that are confirmed to be compatible with the current st | Killing Floor | 3369 | 128/029 | | | Battle Territory: Battery | 3369 | 128/029? | | | Harry Potter and the Prisoner of Azkaban | 2226 | 129/000 | [Link](https://github.com/metallicafan212/HarryPotterUnrealWiki/wiki/Main-Resources#hp3) | +| 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 | | From caf03f790bd456140ce1a2567dcde9d0c5a03dc2 Mon Sep 17 00:00:00 2001 From: Eliot Date: Mon, 22 Aug 2022 12:17:08 +0200 Subject: [PATCH 24/64] Update NuGet configuration. --- CHANGELOG.md | 10 +++++++++ src/Eliot.UELib.csproj | 14 ++++++++++-- src/Eliot.UELib.nuspec | 40 +++++++++++++++++----------------- src/Properties/AssemblyInfo.cs | 8 +++---- 4 files changed, 46 insertions(+), 26 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..567e0591 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,10 @@ +# [1.3.0.0](https://github.com/EliotVU/Unreal-Library/releases/tag/1.3.0.0) + +* Support for Vengeance which includes BioShock 1 & 2, Swat4, and Tribes: Vengeance +* Support for Batman series (to the release branch, incomplete). +* Support for Thief: Deadly Shadows and Deus Ex: Invisible War +* Support for [America's Army 2 (and Arcade)](https://github.com/EliotVU/Unreal-Library/commit/4ae2ae2d25d8101495f0a7ae8d080156fd4bd10f) +* Support for Unreal II: eXpanded MultiPlayer +* Support for [The Chronicles of Spellborn](https://github.com/EliotVU/Unreal-Library/commit/0747049acfcf258efdcee746bf236243c87edc37) +* Improved general support for UE1 (Unreal 1), UE2 (Rainbow Six etc) & UE2.5, and later UE3 (esp UDK). +* Fixes to DefaultProperties diff --git a/src/Eliot.UELib.csproj b/src/Eliot.UELib.csproj index 13d5cd1f..813d88e3 100644 --- a/src/Eliot.UELib.csproj +++ b/src/Eliot.UELib.csproj @@ -263,7 +263,17 @@ --> - - + Eliot.UELib.nuspec + $(NuspecProperties);configuration=$(Configuration) + $(NuspecProperties);version=$(Version) + $(NuspecProperties);id=$(PackageId) + $(NuspecProperties);author=$(Authors) + $(NuspecProperties);PackageProjectUrl=$(PackageProjectUrl) + $(NuspecProperties);Description=$(Description) + $(NuspecProperties);PackageReleaseNotes=$(PackageReleaseNotes) + $(NuspecProperties);Copyright=$(Copyright) + $(NuspecProperties);PackageTags=$(PackageTags) + $(NuspecProperties);RepositoryType=$(RepositoryType) + $(NuspecProperties);RepositoryUrl=$(RepositoryUrl) \ No newline at end of file diff --git a/src/Eliot.UELib.nuspec b/src/Eliot.UELib.nuspec index 63a7bea1..745b0118 100644 --- a/src/Eliot.UELib.nuspec +++ b/src/Eliot.UELib.nuspec @@ -1,23 +1,23 @@ - - Eliot.UELib.dll - $version$ - Eliot - Eliot - MIT - - https://github.com/EliotVU/Unreal-Library - false - UELib - A library for parsing data from games built with the Unreal Engine such as .u, and .upk files. - docs\README.md - Copyright (c) Eliot van Uytfanghe - UnrealEngine UnrealScript Decompiler UPK Explorer Viewer Exporter - - - - - - + + $id$ + $version$ + Eliot + Eliot + MIT + https://github.com/EliotVU/Unreal-Library + false + $title$ + $description$ + docs\README.md + docs\CHANGELOG.md + $copyright$ + UnrealEngine UnrealScript Decompiler UPK Explorer Viewer Exporter Bytecode + + + + + + \ No newline at end of file diff --git a/src/Properties/AssemblyInfo.cs b/src/Properties/AssemblyInfo.cs index de5fc5c0..b39fca42 100644 --- a/src/Properties/AssemblyInfo.cs +++ b/src/Properties/AssemblyInfo.cs @@ -5,8 +5,8 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("UELib")] -[assembly: AssemblyDescription("A library for parsing Unreal Engine packages.")] -[assembly: AssemblyConfiguration("")] +[assembly: AssemblyDescription("UnrealScript decompiler library for Unreal package files (.upk, .u, .uasset; etc), with support for Unreal Engine 1, 2, and 3.")] +[assembly: AssemblyConfiguration("Publish")] [assembly: AssemblyCompany("EliotVU")] [assembly: AssemblyProduct("UELib")] [assembly: AssemblyCopyright("© 2009-2022 Eliot van Uytfanghe. All rights reserved.")] @@ -31,5 +31,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.3.0.0")] -[assembly: AssemblyFileVersion("1.3.0.0")] \ No newline at end of file +[assembly: AssemblyVersion("1.3.0")] +[assembly: AssemblyFileVersion("1.3.0")] \ No newline at end of file From 04602912eaaba08e6f05ed7f8617ba25413de9c4 Mon Sep 17 00:00:00 2001 From: Eliot Date: Fri, 23 Sep 2022 23:58:32 +0200 Subject: [PATCH 25/64] Add "The Wheel of Time" (UE1) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index bdfa7ab2..37473488 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,7 @@ This is a table of games that are confirmed to be compatible with the current st | Unreal | 100-226 | 61/000 | | | [Star Trek: The Next Generation: Klingon Honor Guard](Star%20Trek:%20The%20Next%20Generation:%20Klingon%20Honor%20Guard) | 219 | 61/000 | | | X-COM: Alliance | 200-220 | 61/000 | Bad output at the start of functions (BeginFunctionToken) | +| 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 | | From 31de129fd04a17a550feb3fc2c07e6e2f7345557 Mon Sep 17 00:00:00 2001 From: Eliot Date: Sat, 24 Sep 2022 00:07:14 +0200 Subject: [PATCH 26/64] Add "Nerf Arena Blast" (UE1) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 37473488..6c8f44a6 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,7 @@ This is a table of games that are confirmed to be compatible with the current st | Unreal | 100-226 | 61/000 | | | [Star Trek: The Next Generation: Klingon Honor Guard](Star%20Trek:%20The%20Next%20Generation:%20Klingon%20Honor%20Guard) | 219 | 61/000 | | | X-COM: Alliance | 200-220 | 61/000 | Bad output at the start of functions (BeginFunctionToken) | +| 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 | | From d3db2419091a8744b701ad5d700a0befe5e1302e Mon Sep 17 00:00:00 2001 From: Eliot Date: Sat, 24 Sep 2022 00:10:05 +0200 Subject: [PATCH 27/64] Add "Dr. Brain: Action Reaction" (UE1) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6c8f44a6..03e87a61 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,7 @@ This is a table of games that are confirmed to be compatible with the current st | Unreal | 100-226 | 61/000 | | | [Star Trek: The Next Generation: Klingon Honor Guard](Star%20Trek:%20The%20Next%20Generation:%20Klingon%20Honor%20Guard) | 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 | | From 5efb60d17092d073ae93b68c1b915d9f41510f13 Mon Sep 17 00:00:00 2001 From: Eliot Date: Sat, 24 Sep 2022 15:47:38 +0200 Subject: [PATCH 28/64] Add "Tactical Ops: Assault on Terror" and "Unrealty" (UE1) --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 03e87a61..cab72b8c 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,9 @@ This is a table of games that are confirmed to be compatible with the current st | 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 | | | 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](https://github.com/metallicafan212/HarryPotterUnrealWiki/wiki/Main-Resources#other-kw-games) | From 6039266c71725ef6094b9684cdb48af13d285625 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 Oct 2022 00:05:36 +0000 Subject: [PATCH 29/64] Bump actions/setup-dotnet from 2 to 3 Bumps [actions/setup-dotnet](https://github.com/actions/setup-dotnet) from 2 to 3. - [Release notes](https://github.com/actions/setup-dotnet/releases) - [Commits](https://github.com/actions/setup-dotnet/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/setup-dotnet dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/publish.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 20ac38b2..e8855f55 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,7 +12,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Setup .NET - uses: actions/setup-dotnet@v2 + uses: actions/setup-dotnet@v3 with: dotnet-version: 5.0.x - name: Restore dependencies diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e37a851d..89ce356b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,7 +16,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Setup .NET - uses: actions/setup-dotnet@v2 + uses: actions/setup-dotnet@v3 with: # Legacy versions not supported? :( # 5.0 will likely not work yet due legacy dependencies... From a72a808cf4a957365c6900b531167349edb74f46 Mon Sep 17 00:00:00 2001 From: Eliot Date: Wed, 5 Oct 2022 12:28:15 +0200 Subject: [PATCH 30/64] Add "Star Trek: Deep Space Nine: The Fallen" (UE1) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index cab72b8c..e55e8402 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,7 @@ This is a table of games that are confirmed to be compatible with the current st | 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](https://github.com/metallicafan212/HarryPotterUnrealWiki/wiki/Main-Resources#other-kw-games) | From 5292177d86e2e3ebd62cdd7b87b193d3a54f746a Mon Sep 17 00:00:00 2001 From: Eliot Date: Wed, 5 Oct 2022 12:46:13 +0200 Subject: [PATCH 31/64] Add "Mobile Forces" (UE1) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e55e8402..2846742b 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,7 @@ This is a table of games that are confirmed to be compatible with the current st | 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](https://github.com/metallicafan212/HarryPotterUnrealWiki/wiki/Main-Resources#other-kw-games) | +| Mobile Forces | 436 | 81-83, 69 | | | Deus Ex: Invisible War | 777:Flesh | 95/069 | LinkedData not supported | | Thief: Deadly Shadows | 777:Flesh | 95/133 | LinkedData not supported | | | | | | From 7d539572193d3d9377b853b6df7977e75efc0d10 Mon Sep 17 00:00:00 2001 From: Eliot Date: Sun, 16 Oct 2022 12:14:20 +0200 Subject: [PATCH 32/64] Add "Clive Barker's Undying" (UE1) Specialized support has been committed in the "develop" branch of this repository. --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2846742b..cd1e070d 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,8 @@ This is a table of games that are confirmed to be compatible with the current st | 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](https://github.com/metallicafan212/HarryPotterUnrealWiki/wiki/Main-Resources#other-kw-games) | -| Mobile Forces | 436 | 81-83, 69 | | +| Mobile Forces | 436 | 81-83/000, 69 | | +| Clive Barker's Undying | 420 | 72-85/000 | Licensee modifications are supported in the "develop" branch. Versions 72 to 73 are not auto detected. | | Deus Ex: Invisible War | 777:Flesh | 95/069 | LinkedData not supported | | Thief: Deadly Shadows | 777:Flesh | 95/133 | LinkedData not supported | | | | | | From b2f97a0fcf8193c30f3e10bd311d88e5b8e0c662 Mon Sep 17 00:00:00 2001 From: Eliot Date: Sun, 16 Oct 2022 12:15:22 +0200 Subject: [PATCH 33/64] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cd1e070d..32446d4b 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ This is a table of games that are confirmed to be compatible with the current st | Harry Potter and the Chamber of Secrets | 433 | 79/000 | | | Disney's Brother Bear | 433 | 80/000 | [Link](https://github.com/metallicafan212/HarryPotterUnrealWiki/wiki/Main-Resources#other-kw-games) | | Mobile Forces | 436 | 81-83/000, 69 | | -| Clive Barker's Undying | 420 | 72-85/000 | Licensee modifications are supported in the "develop" branch. Versions 72 to 73 are not auto detected. | +| Clive Barker's Undying | 420 | 72-85/000 | Licensee modifications are supported in the "develop" branch. Versions 72 to 83 are not auto detected. | | Deus Ex: Invisible War | 777:Flesh | 95/069 | LinkedData not supported | | Thief: Deadly Shadows | 777:Flesh | 95/133 | LinkedData not supported | | | | | | From 366d706505dec6e1f19d0fca6d375fec63b96af7 Mon Sep 17 00:00:00 2001 From: Eliot Date: Mon, 17 Oct 2022 13:28:37 +0200 Subject: [PATCH 34/64] Add "Frontlines: Fuel of War" (UE3) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 32446d4b..d32fca6b 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,7 @@ This is a table of games that are confirmed to be compatible with the current st | | | | | | Roboblitz | 2306 | 369/006 | | | Medal of Honor: Airborne | 2859 | 421/011 | | +| Frontlines: Fuel of War | 2917 | 433/052 | Poor output of functions; better support in the "develop" branch | | Army of Two | 3004 | 445/079 | Overall quality has not been verified | | Mortal Kombat Komplete Edition | 2605 | 472/046 | | | Stargate Worlds | 3004 | 486/007 | | From 2df15089c4d250647c866da9e5c9c12b1f6f3983 Mon Sep 17 00:00:00 2001 From: Eliot Date: Thu, 3 Nov 2022 17:35:53 +0100 Subject: [PATCH 35/64] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d32fca6b..078513f0 100644 --- a/README.md +++ b/README.md @@ -138,6 +138,7 @@ This is a table of games that are confirmed to be compatible with the current st | 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 | | | [Dishonored](http://www.dishonored.com/) | 9099 | 801/030 | | | Tribes: Ascend | 7748 | 805/Unknown | | @@ -179,7 +180,6 @@ This is a table of games that are confirmed to be compatible with the current st | Outlast | 12046 | Unknown | | | Sherlock Holmes: Crimes and Punishments | 10897 | Unknown | | | Alien Rage | 7255 | Unknown | | -| Rising Storm 2: Vietnam | 7258 | Unknown | | **Beware, opening an unsupported package could crash your system! Make sure you have saved everything before opening any file!** From cc40832a503dcb6121e9d9a85ba1d95261375663 Mon Sep 17 00:00:00 2001 From: Eliot Date: Tue, 6 Dec 2022 18:30:56 +0100 Subject: [PATCH 36/64] Merge in UELib 1.4 fixes for Batman among other minor changes. --- src/ByteCodeDecompiler.cs | 16 +++++- src/Core/Classes/Props/UProperty.cs | 12 +++-- src/Core/Classes/UClass.cs | 6 ++- src/Core/Classes/UDefaultProperty.cs | 6 +-- src/Core/Classes/UObject.cs | 17 ++++--- src/Core/Classes/UState.cs | 11 +++-- src/Core/Classes/UStruct.cs | 17 +++++-- src/Core/Tables/UExportTableItem.cs | 4 +- src/Core/Tokens/FieldTokens.cs | 8 +-- src/Core/Tokens/FunctionTokens.cs | 31 ++++++------ src/Core/Tokens/JumpTokens.cs | 26 +++++++--- src/Core/Tokens/Token.cs | 35 +++++++++++++ src/UnrealBuild.cs | 73 +++++++++++++++++++++++++--- src/UnrealPackage.cs | 48 ++++++++++++++---- 14 files changed, 244 insertions(+), 66 deletions(-) diff --git a/src/ByteCodeDecompiler.cs b/src/ByteCodeDecompiler.cs index 7ff9cbf1..c0b8c7d3 100644 --- a/src/ByteCodeDecompiler.cs +++ b/src/ByteCodeDecompiler.cs @@ -6,6 +6,7 @@ using System.IO; using System.Runtime.CompilerServices; using UELib.Annotations; +using UELib.Flags; using UELib.Tokens; namespace UELib.Core @@ -504,7 +505,12 @@ private void DeserializeDebugToken() private NativeFunctionToken CreateNativeToken(ushort nativeIndex) { - var nativeTableItem = _Container.Package.NTLPackage?.FindTableItem(nativeIndex); + var nativeTableItem = _Container.Package.NTLPackage?.FindTableItem(nativeIndex) ?? new NativeTableItem + { + Type = FunctionType.Function, + Name = $"__NFUN_{nativeIndex}__", + ByteToken = nativeIndex + }; return new NativeFunctionToken { NativeItem = nativeTableItem @@ -1571,6 +1577,10 @@ public string Decompile() #endif } } + catch (EndOfStreamException) + { + break; + } catch (Exception e) { output.Append($"// ({e.GetType().Name})"); @@ -1591,6 +1601,10 @@ public string Decompile() } } } + catch (EndOfStreamException) + { + break; + } catch (Exception e) { output.AppendLine("\r\n" diff --git a/src/Core/Classes/Props/UProperty.cs b/src/Core/Classes/Props/UProperty.cs index 56ecb667..442c2cdf 100644 --- a/src/Core/Classes/Props/UProperty.cs +++ b/src/Core/Classes/Props/UProperty.cs @@ -88,18 +88,24 @@ protected override void Deserialize() } #endif int info = _Buffer.ReadInt32(); + Record("ArrayDim&ElementSize", info); ArrayDim = (ushort)(info & 0x0000FFFFU); - Record("ArrayDim", ArrayDim); Debug.Assert(ArrayDim <= 2048, "Bad array dim"); ElementSize = (ushort)(info >> 16); - Record("ElementSize", ElementSize); skipInfo: PropertyFlags = Package.Version >= 220 ? _Buffer.ReadUInt64() : _Buffer.ReadUInt32(); Record("PropertyFlags", PropertyFlags); - +#if BATMAN + if (Package.Build == BuildGeneration.RSS && + Package.LicenseeVersion >= 101) + { + PropertyFlags = (PropertyFlags & 0xFFFF0000) >> 24; + Record("PropertyFlags", (PropertyFlagsLO)PropertyFlags); + } +#endif #if XCOM2 if (Package.Build == UnrealPackage.GameBuild.BuildName.XCOM2WotC) { diff --git a/src/Core/Classes/UClass.cs b/src/Core/Classes/UClass.cs index e5526fb2..7a418eef 100644 --- a/src/Core/Classes/UClass.cs +++ b/src/Core/Classes/UClass.cs @@ -300,9 +300,13 @@ protected override void Deserialize() } } #if BATMAN - if (_Buffer.Package.Build == UnrealPackage.GameBuild.BuildName.BatmanUDK) + if (_Buffer.Package.Build == BuildGeneration.RSS) { _Buffer.Skip(sizeof(int)); + if (Package.Build == UnrealPackage.GameBuild.BuildName.Batman4) + { + _Buffer.Skip(sizeof(int)); + } } #endif if (Package.Version >= UnrealPackage.VDLLBIND) diff --git a/src/Core/Classes/UDefaultProperty.cs b/src/Core/Classes/UDefaultProperty.cs index 37e22b0a..c38fe6cb 100644 --- a/src/Core/Classes/UDefaultProperty.cs +++ b/src/Core/Classes/UDefaultProperty.cs @@ -188,7 +188,7 @@ private bool DeserializeNextTag() { if (_Buffer.Version < V3) return DeserializeTagUE1(); #if BATMAN - if (_Buffer.Package.Build == UnrealPackage.GameBuild.BuildName.BatmanUDK) + if (_Buffer.Package.Build == BuildGeneration.RSS) return DeserializeTagByOffset(); #endif return DeserializeTagUE3(); @@ -271,7 +271,7 @@ private bool DeserializeTagByOffset() Record(nameof(Type), Type.ToString()); if (Type == PropertyType.None) return true; - if (_Buffer.Package.Build.Generation != BuildGeneration.Batman3MP) + if (_Buffer.Package.Build != UnrealPackage.GameBuild.BuildName.Batman3MP) { ushort offset = _Buffer.ReadUInt16(); Record(nameof(offset), offset); @@ -291,7 +291,7 @@ private bool DeserializeTagByOffset() Type == PropertyType.StructProperty || Type == PropertyType.Vector || Type == PropertyType.Rotator || - (Type == PropertyType.BoolProperty && _Buffer.Package.Build.Generation == BuildGeneration.Batman4)) + (Type == PropertyType.BoolProperty && _Buffer.Package.Build == UnrealPackage.GameBuild.BuildName.Batman4)) { switch(Type) { diff --git a/src/Core/Classes/UObject.cs b/src/Core/Classes/UObject.cs index a4b52326..1d0b3606 100644 --- a/src/Core/Classes/UObject.cs +++ b/src/Core/Classes/UObject.cs @@ -244,16 +244,19 @@ protected virtual void Deserialize() StateFrame = new UStateFrame(); StateFrame.Deserialize(_Buffer); } - - if (_Buffer.Version >= UExportTableItem.VNetObjects -#if MKKE - && Package.Build != UnrealPackage.GameBuild.BuildName.MKKE +#if MKKE || BATMAN + if (Package.Build == UnrealPackage.GameBuild.BuildName.MKKE || + Package.Build == UnrealPackage.GameBuild.BuildName.Batman4) + { + goto skipNetIndex; + } #endif - ) + if (_Buffer.Version >= UExportTableItem.VNetObjects) { int netIndex = _Buffer.ReadInt32(); Record(nameof(netIndex), netIndex); } + skipNetIndex: // TODO: Serialize component data here //if( _Buffer.Version > 400 @@ -432,7 +435,9 @@ public string GetOuterName() [Pure] public string GetClassName() { - return Table.ClassName; + return ImportTable != null + ? ImportTable.ClassName + : Class?.Name ?? "Class"; } /// diff --git a/src/Core/Classes/UState.cs b/src/Core/Classes/UState.cs index 3cb96f65..20b74c65 100644 --- a/src/Core/Classes/UState.cs +++ b/src/Core/Classes/UState.cs @@ -67,7 +67,7 @@ protected override void Deserialize() } #endif - if (Package.Version < VProbeMaskReducedAndIgnoreMaskRemoved) + if (_Buffer.Version < VProbeMaskReducedAndIgnoreMaskRemoved) { ProbeMask = _Buffer.ReadUInt64(); Record(nameof(ProbeMask), ProbeMask); @@ -85,12 +85,13 @@ protected override void Deserialize() LabelTableOffset = _Buffer.ReadUInt16(); Record(nameof(LabelTableOffset), LabelTableOffset); - if (Package.Version >= VStateFlags) + if (_Buffer.Version >= VStateFlags) { -#if BORDERLANDS2 || TRANSFORMERS +#if BORDERLANDS2 || TRANSFORMERS || BATMAN // FIXME:Temp fix if (Package.Build == UnrealPackage.GameBuild.BuildName.Borderlands2 || - Package.Build == UnrealPackage.GameBuild.BuildName.Transformers) + Package.Build == UnrealPackage.GameBuild.BuildName.Transformers || + Package.Build == UnrealPackage.GameBuild.BuildName.Batman4) { _StateFlags = _Buffer.ReadUShort(); goto skipStateFlags; @@ -110,7 +111,7 @@ protected override void Deserialize() } #endif - if (Package.Version < VFuncMap) return; + if (_Buffer.Version < VFuncMap) return; _Buffer.ReadMap(out FuncMap); Record(nameof(FuncMap), FuncMap); } diff --git a/src/Core/Classes/UStruct.cs b/src/Core/Classes/UStruct.cs index ce84c8da..51db67eb 100644 --- a/src/Core/Classes/UStruct.cs +++ b/src/Core/Classes/UStruct.cs @@ -76,17 +76,27 @@ public partial class UStruct : UField protected override void Deserialize() { base.Deserialize(); - +#if BATMAN + if (Package.Build == UnrealPackage.GameBuild.BuildName.Batman4) + { + goto skipScriptText; + } +#endif // --SuperField if (!Package.IsConsoleCooked()) { ScriptText = _Buffer.ReadObject(); Record(nameof(ScriptText), ScriptText); } - + skipScriptText: Children = _Buffer.ReadObject(); Record(nameof(Children), Children); - +#if BATMAN + if (Package.Build == UnrealPackage.GameBuild.BuildName.Batman4) + { + goto serializeByteCode; + } +#endif // Moved to UFunction in UE3 if (Package.Version < VFriendlyNameMoved) { @@ -151,6 +161,7 @@ protected override void Deserialize() _Buffer.Skip(4); } #endif + serializeByteCode: ByteScriptSize = _Buffer.ReadInt32(); Record(nameof(ByteScriptSize), ByteScriptSize); const int vDataScriptSize = 639; diff --git a/src/Core/Tables/UExportTableItem.cs b/src/Core/Tables/UExportTableItem.cs index 2168dd3b..b65d31a8 100644 --- a/src/Core/Tables/UExportTableItem.cs +++ b/src/Core/Tables/UExportTableItem.cs @@ -143,9 +143,9 @@ public void Deserialize(IUnrealStream stream) } #if BATMAN - if (stream.Package.Build == UnrealPackage.GameBuild.BuildName.BatmanUDK) + if (stream.Package.Build == BuildGeneration.RSS) { - stream.Skip( sizeof(int) ); + stream.Skip(sizeof(int)); } #endif diff --git a/src/Core/Tokens/FieldTokens.cs b/src/Core/Tokens/FieldTokens.cs index f881bf4f..8855a3a6 100644 --- a/src/Core/Tokens/FieldTokens.cs +++ b/src/Core/Tokens/FieldTokens.cs @@ -95,8 +95,7 @@ public override void Deserialize(IUnrealStream stream) Decompiler.AlignSize(sizeof(int)); } - PropertyName = stream.ReadNameReference(); - Decompiler.AlignNameSize(); + PropertyName = ReadName(stream); // TODO: Corrigate version. Seen in version ~648(The Ball) may have been introduced earlier, but not prior 610. if (stream.Version > 610) @@ -170,10 +169,11 @@ public override string Decompile() public class InstanceDelegateToken : Token { + public UName DelegateName; + public override void Deserialize(IUnrealStream stream) { - stream.ReadNameIndex(); - Decompiler.AlignNameSize(); + DelegateName = ReadName(stream); } } } diff --git a/src/Core/Tokens/FunctionTokens.cs b/src/Core/Tokens/FunctionTokens.cs index 11bd6987..619d27ec 100644 --- a/src/Core/Tokens/FunctionTokens.cs +++ b/src/Core/Tokens/FunctionTokens.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Runtime.CompilerServices; using System.Text; namespace UELib.Core @@ -14,12 +15,19 @@ public class EndFunctionParmsToken : Token public abstract class FunctionToken : Token { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + protected UName DeserializeFunctionName(IUnrealStream stream) + { + return ReadName(stream); + } + protected void DeserializeCall() { DeserializeParms(); Decompiler.DeserializeDebugToken(); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] private void DeserializeParms() { #pragma warning disable 642 @@ -161,7 +169,7 @@ public override void Deserialize(IUnrealStream stream) Decompiler.AlignSize(sizeof(int)); } - Function = stream.ReadObject() as UFunction; + Function = stream.ReadObject(); Decompiler.AlignObjectSize(); DeserializeCall(); @@ -242,9 +250,7 @@ public override void Deserialize(IUnrealStream stream) Decompiler.AlignSize(sizeof(int)); } - FunctionName = stream.ReadNameReference(); - Decompiler.AlignNameSize(); - + FunctionName = DeserializeFunctionName(stream); DeserializeCall(); } @@ -261,9 +267,7 @@ public class GlobalFunctionToken : FunctionToken public override void Deserialize(IUnrealStream stream) { - FunctionName = stream.ReadNameReference(); - Decompiler.AlignNameSize(); - + FunctionName = DeserializeFunctionName(stream); DeserializeCall(); } @@ -276,24 +280,23 @@ public override string Decompile() public class DelegateFunctionToken : FunctionToken { + public byte? IsLocal; + public UProperty DelegateProperty; public UName FunctionName; public override void Deserialize(IUnrealStream stream) { // TODO: Corrigate Version - if (stream.Version > 180) + if (stream.Version >= 181) { - ++stream.Position; // ReadByte() + IsLocal = stream.ReadByte(); Decompiler.AlignSize(sizeof(byte)); } - // Delegate object index - stream.ReadObjectIndex(); + DelegateProperty = stream.ReadObject(); Decompiler.AlignObjectSize(); - FunctionName = stream.ReadNameReference(); - Decompiler.AlignNameSize(); - + FunctionName = DeserializeFunctionName(stream); DeserializeCall(); } diff --git a/src/Core/Tokens/JumpTokens.cs b/src/Core/Tokens/JumpTokens.cs index 8b67e4df..c179df95 100644 --- a/src/Core/Tokens/JumpTokens.cs +++ b/src/Core/Tokens/JumpTokens.cs @@ -574,18 +574,20 @@ public override string Decompile() public class ArrayIteratorToken : JumpToken { - protected bool HasSecondParm; + public byte WithIndexParam; public override void Deserialize(IUnrealStream stream) { // Expression DeserializeNext(); - // Param 1 + // Item param DeserializeNext(); - HasSecondParm = stream.ReadByte() > 0; + WithIndexParam = stream.ReadByte(); Decompiler.AlignSize(sizeof(byte)); + + // Index param DeserializeNext(); base.Deserialize(stream); @@ -598,10 +600,20 @@ public override string Decompile() Commentize(); // foreach ArrayVariable( Parameters ) - var output = $"foreach {DecompileNext()}({DecompileNext()}"; - output += (HasSecondParm ? ", " : string.Empty) + DecompileNext(); + string output; + if (WithIndexParam > 0) + { + output = $"foreach {DecompileNext()}({DecompileNext()}, {DecompileNext()})"; + } + else + { + output = $"foreach {DecompileNext()}({DecompileNext()})"; + // Skip Index param + GrabNextToken(); + } + Decompiler._CanAddSemicolon = false; - return $"{output})"; + return output; } } @@ -691,4 +703,4 @@ public override string Decompile() } } } -} \ No newline at end of file +} diff --git a/src/Core/Tokens/Token.cs b/src/Core/Tokens/Token.cs index 62bab382..462db95c 100644 --- a/src/Core/Tokens/Token.cs +++ b/src/Core/Tokens/Token.cs @@ -1,5 +1,6 @@ using System; using System.Diagnostics; +using System.Runtime.CompilerServices; namespace UELib.Core { @@ -74,11 +75,45 @@ protected Token GrabNextToken() return t; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] protected Token DeserializeNext() { return Decompiler.DeserializeNext(); } + /// + /// Wrapper for IUnrealStream.ReadNameReference to handle memory alignment as well as differences between builds. + /// + /// In Batman4 tokens with name references have been reduced to only serialize the index reference, except for NameConstToken among others. + /// + /// TODO: Maybe wrap the IUnrealStream underlying type instead, and implement all memory alignment logic in there. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + protected UName ReadName(IUnrealStream stream) + { + UName name; +#if BATMAN + // (Only for byte-codes) No int32 numeric followed after a name index for Batman4 + if (stream.Package.Build == UnrealPackage.GameBuild.BuildName.Batman4) + { + Decompiler.AlignSize(sizeof(int)); + int nameIndex = stream.ReadInt32(); + name = new UName(stream.Package.Names[nameIndex]); + return name; + } +#endif + Decompiler.AlignNameSize(); + name = stream.ReadNameReference(); + return name; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + protected T ReadObject(IUnrealStream stream) where T : UObject + { + Decompiler.AlignObjectSize(); + return stream.ReadObject(); + } + public override string ToString() { return diff --git a/src/UnrealBuild.cs b/src/UnrealBuild.cs index a38284e8..263f08aa 100644 --- a/src/UnrealBuild.cs +++ b/src/UnrealBuild.cs @@ -5,18 +5,75 @@ namespace UELib public enum BuildGeneration { Undefined, - + + /// + /// Unreal Engine 1 + /// + /// Not in use yet. + /// + UE1, + + /// + /// Unreal Engine 2 + /// + /// Not in use yet. + /// + UE2, + + /// + /// Heavily modified Unreal Engine 2 by Ion Storm for Thief: Deadly Shadows + /// Thief, + + /// + /// Unreal Engine 2 with some early UE3 upgrades. + /// UE2_5, - UE2X, + + /// + /// Heavily modified Unreal Engine 2.5 for Vengeance: Tribes; also used by Swat4 and BioShock. + /// Vengeance, + + /// + /// Heavily modified Unreal Engine 2.5 for Splinter Cell + /// + /// Not yet supported. + /// Lead, - - // Batman2+ use the same Engine spinoff, but it's still necessary to distinguish the builds by name. - Batman2, - Batman3, - Batman3MP, - Batman4 + + /// + /// Modified Unreal Engine 2 for Xbox e.g. Unreal Championship 2: The Liandri Conflict + /// + UE2X, + + /// + /// Unreal Engine 3 + /// + /// Not in use yet. + /// + UE3, + + /// + /// Rocksteady Studios + /// + /// Heavily modified Unreal Engine 3 for the Arkham series + /// + RSS, + + /// + /// High Moon Studios + /// + /// Heavily modified Unreal Engine 3 for Transformers and Deadpool etc + /// + HMS, + + /// + /// Unreal Engine 4 + /// + /// Not in use yet. + /// + UE4 } [Flags] diff --git a/src/UnrealPackage.cs b/src/UnrealPackage.cs index 7b5e3ee0..0599d8e7 100644 --- a/src/UnrealPackage.cs +++ b/src/UnrealPackage.cs @@ -501,17 +501,37 @@ public enum BuildName [Build(860, 4)] Hawken, /// - /// 805-6/101-3 - /// 807/137-8 + /// Batman: Arkham City + /// + /// 805/101 + /// + [Build(805, 101, BuildGeneration.RSS)] + Batman2, + + /// + /// Batman: Arkham Origins + /// + /// 806/103 + /// 807/137-138 + /// + [Build(806, 103, BuildGeneration.RSS)] + [Build(807, 807, 137, 138, BuildGeneration.RSS)] + Batman3, + + /// /// 807/104 - /// 863/32995 /// - [Build(805, 101, BuildGeneration.Batman2)] - [Build(806, 103, BuildGeneration.Batman3)] - [Build(807, 807, 137, 138, BuildGeneration.Batman3)] - [Build(807, 104, BuildGeneration.Batman3MP)] - [Build(863, 32995, BuildGeneration.Batman4)] - BatmanUDK, + [Build(807, 104, BuildGeneration.RSS)] + Batman3MP, + + /// + /// Batman: Arkham Knight + /// + /// 863/32995(227 & ~8000) + /// + [Build(863, 32995, BuildGeneration.RSS)] + //[OverridePackageVersion(863, 227)] + Batman4, /// /// 867/009:032 @@ -582,7 +602,17 @@ public GameBuild(UnrealPackage package) if (Name == BuildName.Unset) Name = package.LicenseeVersion == 0 ? BuildName.Default : BuildName.Unknown; } + + public static bool operator ==(GameBuild b, BuildGeneration gen) + { + return b.Generation == gen; + } + public static bool operator !=(GameBuild b, BuildGeneration gen) + { + return b.Generation != gen; + } + public static bool operator ==(GameBuild b, BuildName i) { return b != null && b.Name == i; From 69e827115e52aca827d243fb02130baeb7556ee2 Mon Sep 17 00:00:00 2001 From: Eliot Date: Sat, 28 May 2022 19:20:34 +0200 Subject: [PATCH 37/64] Fix: Swap InterfaceToBool with InterfaceToObject (cherry picked from commit ffaca763f2c83bf5fb312592db7c09fe367e66b1) --- src/UnrealTokens.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/UnrealTokens.cs b/src/UnrealTokens.cs index e678152f..adef027a 100644 --- a/src/UnrealTokens.cs +++ b/src/UnrealTokens.cs @@ -207,9 +207,9 @@ public enum CastToken : byte None = 0x00, #region UE3 - InterfaceToBool = 0x36, + InterfaceToObject = 0x36, InterfaceToString = 0x37, - InterfaceToObject = 0x38, + InterfaceToBool = 0x38, #endregion RotatorToVector = 0x39, // Redefined From 7988debd19457497a7e0923966417a57166a4224 Mon Sep 17 00:00:00 2001 From: Eliot Date: Tue, 6 Dec 2022 18:33:24 +0100 Subject: [PATCH 38/64] (Cherry pick) Put StateStack behind a package version (Fixes < UE3 map actors). --- src/Core/UStateFrame.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Core/UStateFrame.cs b/src/Core/UStateFrame.cs index 49f1d9c9..50ef56e0 100644 --- a/src/Core/UStateFrame.cs +++ b/src/Core/UStateFrame.cs @@ -8,6 +8,8 @@ namespace UELib.Core [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] public class UStateFrame : IUnrealSerializableClass { + // FIXME: Version, added somewhere between 186 ... 230 + private const int VStateStack = 187; private const int VLatentActionReduced = 566; public UStruct Node; @@ -28,7 +30,7 @@ public void Deserialize(IUnrealStream stream) LatentAction = stream.Version < VLatentActionReduced ? stream.ReadUInt32() : stream.ReadUInt16(); - stream.ReadArray(out StateStack); + if (stream.Version >= VStateStack) stream.ReadArray(out StateStack); if (Node != null) Offset = stream.ReadIndex(); } @@ -44,7 +46,7 @@ public void Serialize(IUnrealStream stream) ? LatentAction : (ushort)LatentAction ); - stream.Write(ref StateStack); + if (stream.Version >= VStateStack) stream.Write(ref StateStack); if (Node != null) stream.Write(Offset); } From 1c10f35d0e41d5b93f6142004cbed26a2a4d64a5 Mon Sep 17 00:00:00 2001 From: Eliot Date: Wed, 8 Jun 2022 06:55:51 +0200 Subject: [PATCH 39/64] (Transformers) Support UClass constructors. (cherry picked from commit b564102b2af94e1f244397c6538095d6e429f28f) (cherry picked from commit 09ef07d5e23a896ba24f7311fa482e0b6367a831) --- src/Core/Classes/UClass.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Core/Classes/UClass.cs b/src/Core/Classes/UClass.cs index 7a418eef..3f559f49 100644 --- a/src/Core/Classes/UClass.cs +++ b/src/Core/Classes/UClass.cs @@ -203,6 +203,7 @@ protected override void Deserialize() ) DeserializeHideCategories(); + // Seems to have been removed in transformer packages DeserializeComponentsMap(); // RoboBlitz(369) @@ -240,6 +241,20 @@ protected override void Deserialize() || Package.Version <= vHideCategoriesOldOrder || Package.Version >= 576) AutoExpandCategories = DeserializeGroup("AutoExpandCategories"); +#if TRANSFORMERS + if (Package.Build == UnrealPackage.GameBuild.BuildName.Transformers) + { + var constructorsCount = _Buffer.ReadInt32(); + Record("Constructors.Count", constructorsCount); + if (constructorsCount >= 0) + { + int numBytes = constructorsCount * 4; + AssertEOS(numBytes, "Constructors"); + _Buffer.Skip(numBytes); + } + } +#endif + if (Package.Version > 670) { AutoCollapseCategories = DeserializeGroup("AutoCollapseCategories"); @@ -283,7 +298,7 @@ protected override void Deserialize() } } - // FIXME: Found first in(V:655), Definitely not in APB and GoW 2 + // FIXME: Found first in(V:655, DLLBind?), Definitely not in APB and GoW 2 // TODO: Corrigate Version if (Package.Version > 575 && Package.Version < 673 #if TERA From 7190a8084f62f6763aaa945377ba526b1d26c544 Mon Sep 17 00:00:00 2001 From: Eliot Date: Wed, 8 Jun 2022 09:36:06 +0200 Subject: [PATCH 40/64] Use shorthand Build == BuildGeneration (cherry picked from commit 354ff5ec720a87c593ab0900447a9824b9756e58) --- src/Core/Classes/Props/UProperty.cs | 10 +++++----- src/Core/Classes/UClass.cs | 6 +++--- src/Core/Classes/UClassDecompiler.cs | 2 +- src/Core/Classes/UFunctionDecompiler.cs | 2 +- src/Core/Classes/UObject.cs | 4 ++-- src/Core/Classes/UStruct.cs | 10 +++++----- src/UnrealPackage.cs | 16 ++++++++-------- src/UnrealStream.cs | 2 +- 8 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/Core/Classes/Props/UProperty.cs b/src/Core/Classes/Props/UProperty.cs index 442c2cdf..d693582f 100644 --- a/src/Core/Classes/Props/UProperty.cs +++ b/src/Core/Classes/Props/UProperty.cs @@ -114,7 +114,7 @@ protected override void Deserialize() } #endif #if THIEF_DS || DEUSEX_IW - if (Package.Build.Generation == BuildGeneration.Thief) + if (Package.Build == BuildGeneration.Thief) { // Property flags like CustomEditor, CustomViewer, ThiefProp, DeusExProp, NoTextExport, NoTravel uint deusFlags = _Buffer.ReadUInt32(); @@ -134,7 +134,7 @@ protected override void Deserialize() else { #if THIEF_DS || DEUSEX_IW - if (Package.Build.Generation == BuildGeneration.Thief) + if (Package.Build == BuildGeneration.Thief) { short deusInheritedOrRuntimeInstiantiated = _Buffer.ReadInt16(); Record(nameof(deusInheritedOrRuntimeInstiantiated), deusInheritedOrRuntimeInstiantiated); @@ -151,7 +151,7 @@ protected override void Deserialize() Record("RepOffset", RepOffset); } #if VENGEANCE - if (Package.Build.Generation == BuildGeneration.Vengeance) + if (Package.Build == BuildGeneration.Vengeance) { var vengeanceEditComboType = _Buffer.ReadNameReference(); Record(nameof(vengeanceEditComboType), vengeanceEditComboType); @@ -161,9 +161,9 @@ protected override void Deserialize() #endif // Appears to be a UE2X feature, it is not present in UE2 builds with no custom LicenseeVersion // Albeit DeusEx indicates otherwise? - if ((HasPropertyFlag(PropertyFlagsLO.EditorData) && (Package.Build.Generation == BuildGeneration.UE2_5 || Package.Build.Generation == BuildGeneration.Thief)) + if ((HasPropertyFlag(PropertyFlagsLO.EditorData) && (Package.Build == BuildGeneration.UE2_5 || Package.Build == BuildGeneration.Thief)) // No property flag - || Package.Build.Generation == BuildGeneration.Vengeance) + || Package.Build == BuildGeneration.Vengeance) { // May represent a tooltip/comment in some games. EditorDataText = _Buffer.ReadText(); diff --git a/src/Core/Classes/UClass.cs b/src/Core/Classes/UClass.cs index 3f559f49..9d38f00c 100644 --- a/src/Core/Classes/UClass.cs +++ b/src/Core/Classes/UClass.cs @@ -120,7 +120,7 @@ protected override void Deserialize() #endif base.Deserialize(); #if VENGEANCE - if (Package.Build.Generation == BuildGeneration.Vengeance && + if (Package.Build == BuildGeneration.Vengeance && Package.LicenseeVersion >= 36) { var header = (2, 0); @@ -353,7 +353,7 @@ protected override void Deserialize() } } #if THIEF_DS || DeusEx_IW - if (Package.Build.Generation == BuildGeneration.Thief) + if (Package.Build == BuildGeneration.Thief) { string thiefClassVisibleName = _Buffer.ReadText(); Record(nameof(thiefClassVisibleName), thiefClassVisibleName); @@ -371,7 +371,7 @@ protected override void Deserialize() } #endif #if VENGEANCE - if (Package.Build.Generation == BuildGeneration.Vengeance) + if (Package.Build == BuildGeneration.Vengeance) { if (Package.LicenseeVersion >= 2) { diff --git a/src/Core/Classes/UClassDecompiler.cs b/src/Core/Classes/UClassDecompiler.cs index db6d3c5e..d0335451 100644 --- a/src/Core/Classes/UClassDecompiler.cs +++ b/src/Core/Classes/UClassDecompiler.cs @@ -189,7 +189,7 @@ protected override string FormatHeader() output += $" within {Within.Name}"; } #if VENGEANCE - if (Package.Build.Generation == BuildGeneration.Vengeance) + if (Package.Build == BuildGeneration.Vengeance) { if (Vengeance_Implements != null && Vengeance_Implements.Any()) output += $" implements {string.Join(", ", Vengeance_Implements.Select(i => i.Name))}"; diff --git a/src/Core/Classes/UFunctionDecompiler.cs b/src/Core/Classes/UFunctionDecompiler.cs index 5bc33d3a..cb371d81 100644 --- a/src/Core/Classes/UFunctionDecompiler.cs +++ b/src/Core/Classes/UFunctionDecompiler.cs @@ -88,7 +88,7 @@ private string FormatFlags() output += "final "; } #if VENGEANCE - if (Package.Build.Generation == BuildGeneration.Vengeance) + if (Package.Build == BuildGeneration.Vengeance) { if (HasFunctionFlag(Flags.FunctionFlags.VG_Overloaded)) { diff --git a/src/Core/Classes/UObject.cs b/src/Core/Classes/UObject.cs index 1d0b3606..9a9e161a 100644 --- a/src/Core/Classes/UObject.cs +++ b/src/Core/Classes/UObject.cs @@ -225,7 +225,7 @@ protected void VengeanceDeserializeHeader(IUnrealStream stream, ref (int a, int protected virtual void Deserialize() { #if VENGEANCE - if (Package.Build.Generation == BuildGeneration.Vengeance) + if (Package.Build == BuildGeneration.Vengeance) { if (Package.LicenseeVersion >= 25) { @@ -268,7 +268,7 @@ protected virtual void Deserialize() //} #if THIEF_DS || DEUSEX_IW // FIXME: Not present in all objects, even some classes? - if (Package.Build.Generation == BuildGeneration.Thief && GetType() != typeof(UnknownObject)) + if (Package.Build == BuildGeneration.Thief && GetType() != typeof(UnknownObject)) { // var native private const int ObjectInternalPropertyHash[1]; int thiefLinkDataObjectCount = _Buffer.ReadInt32(); diff --git a/src/Core/Classes/UStruct.cs b/src/Core/Classes/UStruct.cs index 51db67eb..ca1b784f 100644 --- a/src/Core/Classes/UStruct.cs +++ b/src/Core/Classes/UStruct.cs @@ -107,14 +107,14 @@ protected override void Deserialize() // Standard, but UT2004' derived games do not include this despite reporting version 128+ if (Package.Version >= VCppText && !Package.IsConsoleCooked() - && Package.Build.Generation != BuildGeneration.UE2_5) + && Package.Build != BuildGeneration.UE2_5) { CppText = _Buffer.ReadObject(); Record(nameof(CppText), CppText); } #if VENGEANCE // Introduced with BioShock - if (Package.Build.Generation == BuildGeneration.Vengeance && + if (Package.Build == BuildGeneration.Vengeance && Package.LicenseeVersion >= 29) { int vengeanceUnknownObject = _Buffer.ReadObjectIndex(); @@ -123,14 +123,14 @@ protected override void Deserialize() #endif // UE3 or UE2.5 build, it appears that StructFlags may have been merged from an early UE3 build. // UT2004 reports version 26, and BioShock version 2 - if ((Package.Build.Generation == BuildGeneration.UE2_5 && Package.LicenseeVersion >= 26) || - (Package.Build.Generation == BuildGeneration.Vengeance && Package.LicenseeVersion >= 2)) + if ((Package.Build == BuildGeneration.UE2_5 && Package.LicenseeVersion >= 26) || + (Package.Build == BuildGeneration.Vengeance && Package.LicenseeVersion >= 2)) { StructFlags = _Buffer.ReadUInt32(); Record(nameof(StructFlags), (StructFlags)StructFlags); } #if VENGEANCE - if (Package.Build.Generation == BuildGeneration.Vengeance && + if (Package.Build == BuildGeneration.Vengeance && Package.LicenseeVersion >= 14) { ProcessedText = _Buffer.ReadObject(); diff --git a/src/UnrealPackage.cs b/src/UnrealPackage.cs index 0599d8e7..c8286b73 100644 --- a/src/UnrealPackage.cs +++ b/src/UnrealPackage.cs @@ -602,25 +602,25 @@ public GameBuild(UnrealPackage package) if (Name == BuildName.Unset) Name = package.LicenseeVersion == 0 ? BuildName.Default : BuildName.Unknown; } - + public static bool operator ==(GameBuild b, BuildGeneration gen) { - return b.Generation == gen; + return b?.Generation == gen; } public static bool operator !=(GameBuild b, BuildGeneration gen) { - return b.Generation != gen; + return b?.Generation != gen; } - - public static bool operator ==(GameBuild b, BuildName i) + + public static bool operator ==(GameBuild b, BuildName name) { - return b != null && b.Name == i; + return b?.Name == name; } - public static bool operator !=(GameBuild b, BuildName i) + public static bool operator !=(GameBuild b, BuildName name) { - return b != null && b.Name != i; + return b?.Name != name; } /// diff --git a/src/UnrealStream.cs b/src/UnrealStream.cs index e02bb6cf..5426b401 100644 --- a/src/UnrealStream.cs +++ b/src/UnrealStream.cs @@ -148,7 +148,7 @@ public string ReadText() #endif int unfixedSize = ReadIndex(); #if BIOSHOCK - if (_Archive.Package.Build.Generation == BuildGeneration.Vengeance && + if (_Archive.Package.Build == BuildGeneration.Vengeance && _Archive.Version >= 135) { unfixedSize = -unfixedSize; From a1969bb6f450b726d6aa7dce3fd6f0da327304e8 Mon Sep 17 00:00:00 2001 From: Eliot Date: Wed, 8 Jun 2022 09:39:02 +0200 Subject: [PATCH 41/64] Add a new attribute to set an overridden package version for particular builds. (cherry picked from commit 42783b1602edd590b942e02435ba392e10434b69) --- src/UnrealBuild.cs | 18 ++++++++++++ src/UnrealPackage.cs | 69 ++++++++++++++++++++++---------------------- 2 files changed, 53 insertions(+), 34 deletions(-) diff --git a/src/UnrealBuild.cs b/src/UnrealBuild.cs index 263f08aa..c5733e11 100644 --- a/src/UnrealBuild.cs +++ b/src/UnrealBuild.cs @@ -94,4 +94,22 @@ public enum BuildFlags : byte /// NoDLLBind = 0x04 } + + [AttributeUsage(AttributeTargets.Field)] + public sealed class OverridePackageVersionAttribute : Attribute + { + public readonly uint FixedVersion; + public readonly ushort? FixedLicenseeVersion; + + public OverridePackageVersionAttribute(uint fixedVersion) + { + FixedVersion = fixedVersion; + } + + public OverridePackageVersionAttribute(uint fixedVersion, ushort? fixedLicenseeVersion) + { + FixedVersion = fixedVersion; + FixedLicenseeVersion = fixedLicenseeVersion; + } + } } diff --git a/src/UnrealPackage.cs b/src/UnrealPackage.cs index c8286b73..b5833471 100644 --- a/src/UnrealPackage.cs +++ b/src/UnrealPackage.cs @@ -80,13 +80,7 @@ public sealed class UnrealPackage : IDisposable, IBuffered #region Serialized Members - private uint _Version; - - public uint Version - { - get => OverrideVersion > 0 ? OverrideVersion : _Version; - set => _Version = value; - } + public uint Version { get; set; } /// /// For debugging purposes. Change this to override the present Version deserialized from the package. @@ -119,13 +113,7 @@ public uint Version #endregion - private ushort _LicenseeVersion; - - public ushort LicenseeVersion - { - get => OverrideLicenseeVersion > 0 ? OverrideLicenseeVersion : _LicenseeVersion; - private set => _LicenseeVersion = value; - } + public ushort LicenseeVersion { get; set; } /// /// For debugging purposes. Change this to override the present Version deserialized from the package. @@ -548,7 +536,9 @@ public enum BuildName public BuildName Name { get; } public uint Version { get; } + public uint? OverrideVersion { get; } public uint LicenseeVersion { get; } + public ushort? OverrideLicenseeVersion { get; } /// /// Is cooked for consoles. @@ -570,32 +560,34 @@ public GameBuild(UnrealPackage package) { if (UnrealConfig.Platform == UnrealConfig.CookedPlatform.Console) Flags |= BuildFlags.ConsoleCooked; - var gameBuilds = (BuildName[])Enum.GetValues(typeof(BuildName)); - foreach (var gameBuild in gameBuilds) + var builds = typeof(BuildName).GetFields(); + foreach (var build in builds) { - var gameBuildMember = typeof(BuildName).GetMember(gameBuild.ToString()); - if (gameBuildMember.Length == 0) - continue; - - object[] attribs = gameBuildMember[0].GetCustomAttributes(false); - var game = attribs.OfType().SingleOrDefault(attr => attr.Verify(this, package)); - if (game == null) + var buildAttributes = build.GetCustomAttributes(false); + var buildAttribute = buildAttributes.FirstOrDefault(attr => attr.Verify(this, package)); + if (buildAttribute == null) continue; Version = package.Version; LicenseeVersion = package.LicenseeVersion; - Flags = game.Flags; - Generation = game.Generation; + Flags = buildAttribute.Flags; + Generation = buildAttribute.Generation; + + var overrideAttribute = build.GetCustomAttribute(false); + if (overrideAttribute != null) + { + OverrideVersion = overrideAttribute.FixedVersion; + OverrideLicenseeVersion = overrideAttribute.FixedLicenseeVersion; + } - Name = (BuildName)Enum.Parse(typeof(BuildName), Enum.GetName(typeof(BuildName), gameBuild)); + Name = (BuildName)Enum.Parse(typeof(BuildName), build.Name); if (package.Decoder != null) break; - var buildDecoderAttr = - attribs.SingleOrDefault(attr => attr is BuildDecoderAttribute) as BuildDecoderAttribute; - if (buildDecoderAttr == null) + var buildDecoderAttribute = build.GetCustomAttribute(false); + if (buildDecoderAttribute == null) break; - package.Decoder = buildDecoderAttr.CreateDecoder(); + package.Decoder = buildDecoderAttribute.CreateDecoder(); break; } @@ -1001,11 +993,9 @@ public void Deserialize(UPackageStream stream) LicenseeVersion = (ushort)(Version >> 16); Version &= 0xFFFFU; Console.WriteLine("Package Version:" + Version + "/" + LicenseeVersion); - - Build = new GameBuild(this); - Console.WriteLine("Build:" + Build.Name); - + SetupBuild(stream); stream.BuildDetected(Build); + Console.WriteLine("Build:" + Build.Name); if (Version >= VHeaderSize) { @@ -1341,6 +1331,17 @@ public void Deserialize(UPackageStream stream) HeaderSize = (int)stream.Position; } + private void SetupBuild(UPackageStream stream) + { + Build = new GameBuild(this); + + if (Build.OverrideVersion.HasValue) Version = Build.OverrideVersion.Value; + if (Build.OverrideLicenseeVersion.HasValue) LicenseeVersion = Build.OverrideLicenseeVersion.Value; + + if (OverrideVersion != 0) Version = OverrideVersion; + if (OverrideLicenseeVersion != 0) LicenseeVersion = OverrideLicenseeVersion; + } + /// /// Constructs all export objects. /// From 0047a95af58510d63bb62a983b469695ed65587c Mon Sep 17 00:00:00 2001 From: Eliot Date: Tue, 6 Dec 2022 18:44:42 +0100 Subject: [PATCH 42/64] More cherry picks to patch up Batman. --- src/UnrealBuild.cs | 2 +- src/UnrealPackage.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/UnrealBuild.cs b/src/UnrealBuild.cs index c5733e11..095d8d4d 100644 --- a/src/UnrealBuild.cs +++ b/src/UnrealBuild.cs @@ -106,7 +106,7 @@ public OverridePackageVersionAttribute(uint fixedVersion) FixedVersion = fixedVersion; } - public OverridePackageVersionAttribute(uint fixedVersion, ushort? fixedLicenseeVersion) + public OverridePackageVersionAttribute(uint fixedVersion, ushort fixedLicenseeVersion) { FixedVersion = fixedVersion; FixedLicenseeVersion = fixedLicenseeVersion; diff --git a/src/UnrealPackage.cs b/src/UnrealPackage.cs index b5833471..5ea27a03 100644 --- a/src/UnrealPackage.cs +++ b/src/UnrealPackage.cs @@ -512,13 +512,14 @@ public enum BuildName [Build(807, 104, BuildGeneration.RSS)] Batman3MP, + /// /// Batman: Arkham Knight /// /// 863/32995(227 & ~8000) /// [Build(863, 32995, BuildGeneration.RSS)] - //[OverridePackageVersion(863, 227)] + [OverridePackageVersion(863, 227)] Batman4, /// From d0a87562103d584000baca16ffab6ec4ec40331a Mon Sep 17 00:00:00 2001 From: Eliot Date: Tue, 6 Dec 2022 18:48:27 +0100 Subject: [PATCH 43/64] Change version 1.3.0 -> 1.3.1 --- src/Properties/AssemblyInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Properties/AssemblyInfo.cs b/src/Properties/AssemblyInfo.cs index b39fca42..0761bf59 100644 --- a/src/Properties/AssemblyInfo.cs +++ b/src/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.3.0")] -[assembly: AssemblyFileVersion("1.3.0")] \ No newline at end of file +[assembly: AssemblyVersion("1.3.1")] +[assembly: AssemblyFileVersion("1.3.1")] \ No newline at end of file From 0ffe978be8cdb255eb88ce6b281b3dcb7c9b452c Mon Sep 17 00:00:00 2001 From: Eliot Date: Tue, 6 Dec 2022 19:50:18 +0100 Subject: [PATCH 44/64] Complete UClass support for Batman series #51. --- src/Core/Classes/UClass.cs | 61 ++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/src/Core/Classes/UClass.cs b/src/Core/Classes/UClass.cs index 9d38f00c..40538a02 100644 --- a/src/Core/Classes/UClass.cs +++ b/src/Core/Classes/UClass.cs @@ -171,7 +171,7 @@ protected override void Deserialize() PackageImports = DeserializeGroup(nameof(PackageImports)); } - skipTo61Stuff: + skipTo61Stuff: if (Package.Version >= 62) { // Class Name Extends Super.Name Within _WithinIndex @@ -258,7 +258,15 @@ protected override void Deserialize() if (Package.Version > 670) { AutoCollapseCategories = DeserializeGroup("AutoCollapseCategories"); - +#if BATMAN + // Only attested in bm4 with no version check. + if (_Buffer.Package.Build == BuildGeneration.RSS && + _Buffer.Package.Build == UnrealPackage.GameBuild.BuildName.Batman4) + { + IList bm4_v198; + bm4_v198 = DeserializeGroup(nameof(bm4_v198)); + } +#endif if (Package.Version >= 749 #if SPECIALFORCE2 && Package.Build != UnrealPackage.GameBuild.BuildName.SpecialForce2 @@ -273,28 +281,31 @@ protected override void Deserialize() { var unknownName = _Buffer.ReadNameReference(); Record("Unknown:Dishonored", unknownName); + + NativeClassName = _Buffer.ReadText(); + Record(nameof(NativeClassName), NativeClassName); + goto skipEditorContent; } #endif - if (Package.Version >= UnrealPackage.VCLASSGROUP) +#if BATMAN + if (_Buffer.Package.Build == BuildGeneration.RSS && + _Buffer.Package.LicenseeVersion >= 95) { -#if DISHONORED - if (Package.Build == UnrealPackage.GameBuild.BuildName.Dishonored) - { - NativeClassName = _Buffer.ReadText(); - Record(nameof(NativeClassName), NativeClassName); - goto skipClassGroups; - } + uint bm4_v174 = _Buffer.ReadUInt32(); + Record(nameof(bm4_v174), bm4_v174); + } #endif + if (Package.Version >= UnrealPackage.VCLASSGROUP) + { ClassGroups = DeserializeGroup("ClassGroups"); - if (Package.Version >= 813) - { - NativeClassName = _Buffer.ReadText(); - Record(nameof(NativeClassName), NativeClassName); - } } -#if DISHONORED - skipClassGroups: ; -#endif + + // No version check in batman??? + if (Package.Version >= 813) + { + NativeClassName = _Buffer.ReadText(); + Record(nameof(NativeClassName), NativeClassName); + } } } @@ -314,16 +325,8 @@ protected override void Deserialize() } } } -#if BATMAN - if (_Buffer.Package.Build == BuildGeneration.RSS) - { - _Buffer.Skip(sizeof(int)); - if (Package.Build == UnrealPackage.GameBuild.BuildName.Batman4) - { - _Buffer.Skip(sizeof(int)); - } - } -#endif + + skipEditorContent: if (Package.Version >= UnrealPackage.VDLLBIND) { if (!Package.Build.Flags.HasFlag(BuildFlags.NoDLLBind)) @@ -359,7 +362,7 @@ protected override void Deserialize() Record(nameof(thiefClassVisibleName), thiefClassVisibleName); // Restore the human-readable name if possible - if (!string.IsNullOrEmpty(thiefClassVisibleName) + if (!string.IsNullOrEmpty(thiefClassVisibleName) && Package.Build == UnrealPackage.GameBuild.BuildName.Thief_DS) { var nameEntry = new UNameTableItem() From ff0646cea4249cba1e99838ef11e012eb3a7d3f7 Mon Sep 17 00:00:00 2001 From: Eliot Date: Tue, 6 Dec 2022 21:28:08 +0100 Subject: [PATCH 45/64] Migrate some improvements from the develop branch. More (hacky) byte-code fixes for Batman4 #51. --- src/Branch/UE3/RSS/Tokens/Bm4ContextToken.cs | 9 ++ .../UE3/RSS/Tokens/NameConstNoNumberToken.cs | 12 +++ src/ByteCodeDecompiler.cs | 50 +++++++++-- src/Core/Tokens/FunctionTokens.cs | 84 +++++++------------ src/Core/Tokens/JumpTokens.cs | 2 +- src/Core/Tokens/Token.cs | 73 +++++++++++----- src/Eliot.UELib.csproj | 4 +- 7 files changed, 149 insertions(+), 85 deletions(-) create mode 100644 src/Branch/UE3/RSS/Tokens/Bm4ContextToken.cs create mode 100644 src/Branch/UE3/RSS/Tokens/NameConstNoNumberToken.cs diff --git a/src/Branch/UE3/RSS/Tokens/Bm4ContextToken.cs b/src/Branch/UE3/RSS/Tokens/Bm4ContextToken.cs new file mode 100644 index 00000000..86d19950 --- /dev/null +++ b/src/Branch/UE3/RSS/Tokens/Bm4ContextToken.cs @@ -0,0 +1,9 @@ +using UELib.Core; + +namespace UELib.Branch.UE3.RSS.Tokens +{ + public class Bm4ContextToken : UStruct.UByteCodeDecompiler.ContextToken + { + + } +} \ No newline at end of file diff --git a/src/Branch/UE3/RSS/Tokens/NameConstNoNumberToken.cs b/src/Branch/UE3/RSS/Tokens/NameConstNoNumberToken.cs new file mode 100644 index 00000000..80c06e4a --- /dev/null +++ b/src/Branch/UE3/RSS/Tokens/NameConstNoNumberToken.cs @@ -0,0 +1,12 @@ +using UELib.Core; + +namespace UELib.Branch.UE3.RSS.Tokens +{ + public class NameConstNoNumberToken : UStruct.UByteCodeDecompiler.NameConstToken + { + public override void Deserialize(IUnrealStream stream) + { + Name = ReadNameNoNumber(stream); + } + } +} \ No newline at end of file diff --git a/src/ByteCodeDecompiler.cs b/src/ByteCodeDecompiler.cs index c0b8c7d3..9e18dc27 100644 --- a/src/ByteCodeDecompiler.cs +++ b/src/ByteCodeDecompiler.cs @@ -13,6 +13,7 @@ namespace UELib.Core { using System.Linq; using System.Text; + using UELib.Branch.UE3.RSS.Tokens; public partial class UStruct { @@ -307,6 +308,18 @@ private void AlignObjectSize() { 0x59, (byte)ExprToken.Unused } }; #endif +#if BATMAN + private static readonly Dictionary ByteCodeMap_BuildBatman4 = new Dictionary + { + { 0x2B, (byte)ExprToken.Unused }, // NameConst but without the Int32 number at the end + // 0x4E, unknown but it has the same pattern as a DynamicCast + { 0x4F, (byte)ExprToken.DynamicCast }, + // 0x4F, unknown but it has the same pattern as a DynamicCast + { 0x50, (byte)ExprToken.DynamicCast }, + // 0x50 + { 0x51, (byte)ExprToken.Unused }, + }; +#endif #if APB private static readonly Dictionary ByteCodeMap_BuildApb = new Dictionary { @@ -367,6 +380,13 @@ private void SetupByteCodeMap() return; } #endif +#if BIOSHOCK + if (Package.Build == UnrealPackage.GameBuild.BuildName.Batman4) + { + _ByteCodeMap = ByteCodeMap_BuildBatman4; + return; + } +#endif #if APB if (Package.Build == UnrealPackage.GameBuild.BuildName.APB && Package.LicenseeVersion >= 32) @@ -1119,8 +1139,26 @@ private Token DeserializeNext(byte tokenCode = byte.MaxValue) } } } +#if BATMAN + // HACK: temporary for the hotfix (:D) + if (token == null && Package.Build == UnrealPackage.GameBuild.BuildName.Batman4) + { + switch (serializedByte) + { + case 0x2B: + token = new NameConstNoNumberToken(); + break; - if (token == null) token = new UnresolvedToken(); + case 0x50: + token = new Bm4ContextToken(); + break; + } + } +#endif + if (token == null) + { + token = new UnresolvedToken(); + } AddToken(token, serializedByte, tokenPosition); return token; } @@ -1306,11 +1344,11 @@ private Token DeserializeCastToken(byte castToken) return token; } - #endregion +#endregion #if DECOMPILE - #region Decompile +#region Decompile public class NestManager { @@ -1935,9 +1973,9 @@ private string DecompileNests(bool outputAllRemainingNests = false) return output; } - #endregion +#endregion - #region Disassemble +#region Disassemble [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")] public string Disassemble() @@ -1945,7 +1983,7 @@ public string Disassemble() return string.Empty; } - #endregion +#endregion #endif } diff --git a/src/Core/Tokens/FunctionTokens.cs b/src/Core/Tokens/FunctionTokens.cs index 619d27ec..a5e904c9 100644 --- a/src/Core/Tokens/FunctionTokens.cs +++ b/src/Core/Tokens/FunctionTokens.cs @@ -35,23 +35,6 @@ private void DeserializeParms() #pragma warning restore 642 } - protected void DeserializeBinaryOperator() - { - DeserializeNext(); - DeserializeNext(); - - DeserializeNext(); // ) - Decompiler.DeserializeDebugToken(); - } - - protected void DeserializeUnaryOperator() - { - DeserializeNext(); - - DeserializeNext(); // ) - Decompiler.DeserializeDebugToken(); - } - private static string PrecedenceToken(Token t) { if (!(t is FunctionToken)) @@ -69,29 +52,46 @@ private static string PrecedenceToken(Token t) break; } - return addParenthesis ? $"({t.Decompile()})" : t.Decompile(); + return addParenthesis + ? $"({t.Decompile()})" + : t.Decompile(); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private bool NeedsSpace(string operatorName) + { + return char.IsUpper(operatorName[0]) + || char.IsLower(operatorName[0]); } protected string DecompilePreOperator(string operatorName) { - string output = operatorName + (operatorName.Length > 1 ? " " : string.Empty) + DecompileNext(); - DecompileNext(); // ) - return output; + string operand = DecompileNext(); + AssertSkipCurrentToken(); + + // Only space out if we have a non-symbol operator name. + return NeedsSpace(operatorName) + ? $"{operatorName} {operand}" + : $"{operatorName}{operand}"; } protected string DecompileOperator(string operatorName) { var output = - $"{PrecedenceToken(GrabNextToken())} {operatorName} {PrecedenceToken(GrabNextToken())}"; - DecompileNext(); // ) + $"{PrecedenceToken(NextToken())} {operatorName} {PrecedenceToken(NextToken())}"; + AssertSkipCurrentToken(); return output; } protected string DecompilePostOperator(string operatorName) { - string output = $"{operatorName} {DecompileNext()}"; - DecompileNext(); // ) - return output; + string operand = DecompileNext(); + AssertSkipCurrentToken(); + + // Only space out if we have a non-symbol operator name. + return NeedsSpace(operatorName) + ? $"{operand} {operatorName}" + : $"{operand}{operatorName}"; } protected string DecompileCall(string functionName) @@ -116,7 +116,7 @@ private string DecompileParms() var tokens = new List>(); { next: - var t = GrabNextToken(); + var t = NextToken(); tokens.Add(Tuple.Create(t, t.Decompile())); if (!(t is EndFunctionParmsToken)) goto next; @@ -313,35 +313,7 @@ public class NativeFunctionToken : FunctionToken public override void Deserialize(IUnrealStream stream) { - if (NativeItem == null) - { - NativeItem = new NativeTableItem - { - Type = FunctionType.Function, - Name = "UnresolvedNativeFunction_" + RepresentToken, - ByteToken = RepresentToken - }; - } - - switch (NativeItem.Type) - { - case FunctionType.Function: - DeserializeCall(); - break; - - case FunctionType.PreOperator: - case FunctionType.PostOperator: - DeserializeUnaryOperator(); - break; - - case FunctionType.Operator: - DeserializeBinaryOperator(); - break; - - default: - DeserializeCall(); - break; - } + DeserializeCall(); } public override string Decompile() diff --git a/src/Core/Tokens/JumpTokens.cs b/src/Core/Tokens/JumpTokens.cs index c179df95..27de6962 100644 --- a/src/Core/Tokens/JumpTokens.cs +++ b/src/Core/Tokens/JumpTokens.cs @@ -609,7 +609,7 @@ public override string Decompile() { output = $"foreach {DecompileNext()}({DecompileNext()})"; // Skip Index param - GrabNextToken(); + NextToken(); } Decompiler._CanAddSemicolon = false; diff --git a/src/Core/Tokens/Token.cs b/src/Core/Tokens/Token.cs index 462db95c..8c45397f 100644 --- a/src/Core/Tokens/Token.cs +++ b/src/Core/Tokens/Token.cs @@ -52,28 +52,52 @@ public virtual string Disassemble() protected string DecompileNext() { - tryNext: - var t = Decompiler.NextToken; - if (t is DebugInfoToken) goto tryNext; + tryNext: + var token = Decompiler.NextToken; + if (token is DebugInfoToken) goto tryNext; - try - { - return t.Decompile(); - } - catch (Exception e) - { - return $"{t.GetType().Name}({e.GetType().Name})"; - } + return token.Decompile(); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + protected T NextToken() + where T : Token + { + return (T)NextToken(); } - protected Token GrabNextToken() + [MethodImpl(MethodImplOptions.AggressiveInlining)] + protected Token NextToken() { - tryNext: + tryNext: var t = Decompiler.NextToken; if (t is DebugInfoToken) goto tryNext; return t; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + protected void SkipCurrentToken() + { + ++Decompiler.CurrentTokenIndex; + } + + /// + /// Asserts that the token that we want to skip is indeed of the correct type, this also skips past any . + /// + /// The type of the token that we want to assert. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + protected void AssertSkipCurrentToken() + where T : Token + { + tryNext: + var token = Decompiler.NextToken; + if (token is DebugInfoToken) goto tryNext; + // This assertion will fail in most cases if the native indexes are a mismatch. +#if STRICT + Debug.Assert(token is T, $"Expected to skip a token of type '{typeof(T)}', but got '{token.GetType()}'"); +#endif + } [MethodImpl(MethodImplOptions.AggressiveInlining)] protected Token DeserializeNext() @@ -91,27 +115,34 @@ protected Token DeserializeNext() [MethodImpl(MethodImplOptions.AggressiveInlining)] protected UName ReadName(IUnrealStream stream) { - UName name; #if BATMAN // (Only for byte-codes) No int32 numeric followed after a name index for Batman4 if (stream.Package.Build == UnrealPackage.GameBuild.BuildName.Batman4) { - Decompiler.AlignSize(sizeof(int)); - int nameIndex = stream.ReadInt32(); - name = new UName(stream.Package.Names[nameIndex]); - return name; + return ReadNameNoNumber(stream); } #endif + var name = stream.ReadNameReference(); Decompiler.AlignNameSize(); - name = stream.ReadNameReference(); return name; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - protected T ReadObject(IUnrealStream stream) where T : UObject + protected UName ReadNameNoNumber(IUnrealStream stream) + { + int nameIndex = stream.ReadInt32(); + Decompiler.AlignSize(sizeof(int)); + var name = new UName(stream.Package.Names[nameIndex], 0); + return name; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + protected T ReadObject(IUnrealStream stream) + where T : UObject { + var obj = stream.ReadObject(); Decompiler.AlignObjectSize(); - return stream.ReadObject(); + return obj; } public override string ToString() diff --git a/src/Eliot.UELib.csproj b/src/Eliot.UELib.csproj index 813d88e3..5fdb3a3b 100644 --- a/src/Eliot.UELib.csproj +++ b/src/Eliot.UELib.csproj @@ -115,6 +115,8 @@ + + @@ -252,7 +254,7 @@ - +