Skip to content

Commit dafb545

Browse files
committed
Merge branch 'develop'
2 parents 9da244b + 324eb88 commit dafb545

File tree

14 files changed

+145
-4
lines changed

14 files changed

+145
-4
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
#
22

3+
## [1.11.1](https://github.com/EliotVU/Unreal-Library/releases/tag/1.11.1)
4+
5+
* Support for Gears of War: Ultimate Edition and Reloaded (thanks to @PaoloTK)
6+
* Fixed missing CtorLink flag resulting in a /* 0x400000 */ comment in the decompilation output.
7+
8+
## [1.11.0](https://github.com/EliotVU/Unreal-Library/releases/tag/1.11.0)
9+
310
* Support for Star Wars: Republic Commando
411
* Support for Advent Rising
512
* Support for Tom Clancy's Splinter Cell: Blacklist (thanks to @shryder)

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,8 @@ This is a table of games that are confirmed to be compatible with the current st
202202
| Borderlands 2 | 8623/0023 | 832/056 | |
203203
| Borderlands: Game of the Year Enhanced | 5001/0001 | 832/058 | |
204204
| Remember Me | 8623 | 832/021 | |
205+
| Gears of War: Ultimate Edition | 3340 | 835/056 | Actual package version is 490; thanks to @PaoloTK |
206+
| Gears of War: Reloaded | 3340 | 835/076 | Actual package version is 490; thanks to @PaoloTK |
205207
| The Haunted: Hells Reach | 8788 | 841/000 | |
206208
| Asura's Wrath | 8788 | 841/000 | -zlib; platform needs to be set to console. |
207209
| Blacklight Retribution | 8788-10499 | 841-864/002 | |
40.3 KB
Binary file not shown.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net9.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<ProjectReference Include="..\..\src\Eliot.UELib.csproj" />
12+
</ItemGroup>
13+
14+
<ItemGroup>
15+
<None Update="Assets\TestUC3.u">
16+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
17+
</None>
18+
</ItemGroup>
19+
20+
</Project>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Expands an object's size using a path to find the object in a package.
2+
// The example assumes an UE3 Package, for UE2 a different approach will be needed.
3+
4+
using System.Diagnostics;
5+
using UELib;
6+
7+
// Has to be a decompressed(and decrypted if any) package!
8+
var packagePath = @"Assets/TestUC3.u";
9+
10+
using var stream = new UPackageStream(packagePath, FileMode.Open, FileAccess.ReadWrite);
11+
using var package = new UnrealPackage(stream);
12+
package.BuildTarget = UnrealPackage.GameBuild.BuildName.Unset;
13+
package.Deserialize(stream);
14+
15+
// In order for FindObjectByGroup to work, we need to initialize the export objects.
16+
package.InitializePackage(UnrealPackage.InitFlags.RegisterClasses | UnrealPackage.InitFlags.Construct);
17+
18+
var objectToExpandName = "UC3Test.Test"; // ClassName.FunctionName
19+
var testFunction = package.FindObjectByGroup(objectToExpandName);
20+
Console.WriteLine(testFunction == null
21+
? $"Object '{objectToExpandName}' not found in package."
22+
: $"Found object: {testFunction.Name} of type {testFunction.Class?.Name ?? "Class"}");
23+
24+
if (testFunction != null)
25+
{
26+
var export = testFunction.ExportTable;
27+
Debug.Assert(export != null, "Object must be an export");
28+
29+
int newSerialSize = export.SerialSize + 100; // Increase size by 100 bytes
30+
var newBuffer = new byte[newSerialSize];
31+
32+
stream.Seek(export.SerialOffset, SeekOrigin.Begin);
33+
int copy = stream.Read(newBuffer, 0, export.SerialSize); // read the old data
34+
Debug.Assert(copy == export.SerialSize, "Failed to read the old data");
35+
36+
stream.Position = stream.Length; // Move to the end of the stream
37+
export.SerialOffset = (int)stream.Position; // Update the offset to the end of the stream
38+
export.SerialSize = newSerialSize; // Update the size of the export
39+
stream.Write(newBuffer); // Write the old data to the end of the stream
40+
41+
// Write the new serial offset and size to the export
42+
stream.Seek(export.Offset, SeekOrigin.Begin); // Offset to the export item.
43+
export.Serialize(stream); // Because the export item size itself hasn't changed, we can cheat and serialize it in place
44+
45+
stream.Flush(); // Ensure all changes are written to the file
46+
}

Test/upk/Builds/PackageTests.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,26 @@ public class PackageTests
116116
BuildName.EndWar,
117117
BuildPlatform.Undetermined
118118
)]
119+
[DataRow(@"Gears of War\", // G4WLive
120+
BuildName.GoW1,
121+
BuildPlatform.Undetermined
122+
)]
123+
[DataRow(@"Gears of War 2\",
124+
BuildName.GoW2,
125+
BuildPlatform.Undetermined
126+
)]
127+
[DataRow(@"Gears of War 3\",
128+
BuildName.GoW3,
129+
BuildPlatform.Undetermined
130+
)]
131+
[DataRow(@"Gears of War Ultimate Edition\", // Microsoft Store / WinUAP
132+
BuildName.GoWUE,
133+
BuildPlatform.Undetermined
134+
)]
135+
[DataRow(@"Gears of War Reloaded Beta\", // Steam
136+
BuildName.GoWUE,
137+
BuildPlatform.Undetermined
138+
)]
119139
[DataRow(@"Mirrors Edge\",
120140
BuildName.MirrorsEdge,
121141
BuildPlatform.Undetermined

src/Branch/DefaultEngineBranch.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,8 @@ protected virtual void SetupEnumPropertyFlags(UnrealPackage linker)
263263
// Not functional
264264
PropertyFlags[(int)PropertyFlag.DuplicateTransient] = (ulong)PropertyFlagsLO.New;
265265

266+
PropertyFlags[(int)PropertyFlag.CtorLink] = (ulong)PropertyFlagsLO.NeedCtorLink;
267+
266268
if (linker.Version > 68)
267269
{
268270
PropertyFlags[(int)PropertyFlag.NoExport] = (ulong)PropertyFlagsLO.NoExport;

src/ByteCodeDecompiler.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,14 @@ private void SetupMemorySizes()
8585
if (_Package.Build == UnrealPackage.GameBuild.BuildName.Tera) return;
8686
#endif
8787
const short vObjectSizeTo8 = 587;
88-
if (_Package.Version >= vObjectSizeTo8) _ObjectMemorySize = sizeof(long);
88+
if (_Package.Version >= vObjectSizeTo8
89+
#if GOWUE
90+
|| _Package.Build == UnrealPackage.GameBuild.BuildName.GoWUE
91+
#endif
92+
)
93+
{
94+
_ObjectMemorySize = sizeof(long);
95+
}
8996
}
9097

9198
[MethodImpl(MethodImplOptions.AggressiveInlining)]

src/Core/Classes/Props/UPropertyDecompiler.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ public string FormatFlags()
121121
copyFlags &= ~PropertyFlags.GetFlag(PropertyFlag.AlwaysInit);
122122
}
123123

124+
if (HasPropertyFlag(PropertyFlag.CtorLink))
125+
{
126+
copyFlags &= ~PropertyFlags.GetFlag(PropertyFlag.CtorLink);
127+
}
128+
124129
/** Flags that are valid as parameters only */
125130
if (Outer is UFunction && HasPropertyFlag(PropertyFlag.Parm))
126131
{

src/Eliot.UELib.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<DefineConstants>DECOMPILE;BINARYMETADATA;UE1;UE2;UE3;UE4;VENGEANCE;SWAT4;UNREAL2;INFINITYBLADE;BORDERLANDS2;GOW2;APB;SPECIALFORCE2;XIII;SINGULARITY;THIEF_DS;DEUSEX_IW;BORDERLANDS;MIRRORSEDGE;BIOSHOCK;HAWKEN;UT;DISHONORED;REMEMBERME;ALPHAPROTOCOL;VANGUARD;TERA;MKKE;TRANSFORMERS;XCOM2;DD2;DCUO;AA2;SPELLBORN;BATMAN;MOH;ROCKETLEAGUE;DNF;LSGAME;UNDYING;HP;DEVASTATION;BATTLEBORN;SPLINTERCELLX;AHIT;GIGANTIC;ENDWAR;SG1;MASS_EFFECT;MOV;MIDWAY;SHADOWSTRIKE;R6;HUXLEY;RM;LEAD;BULLETSTORM;ADVENT;SWRepublicCommando</DefineConstants>
3+
<DefineConstants>DECOMPILE;BINARYMETADATA;UE1;UE2;UE3;UE4;VENGEANCE;SWAT4;UNREAL2;INFINITYBLADE;BORDERLANDS2;GOW2;APB;SPECIALFORCE2;XIII;SINGULARITY;THIEF_DS;DEUSEX_IW;BORDERLANDS;MIRRORSEDGE;BIOSHOCK;HAWKEN;UT;DISHONORED;REMEMBERME;ALPHAPROTOCOL;VANGUARD;TERA;MKKE;TRANSFORMERS;XCOM2;DD2;DCUO;AA2;SPELLBORN;BATMAN;MOH;ROCKETLEAGUE;DNF;LSGAME;UNDYING;HP;DEVASTATION;BATTLEBORN;SPLINTERCELLX;AHIT;GIGANTIC;ENDWAR;SG1;MASS_EFFECT;MOV;MIDWAY;SHADOWSTRIKE;R6;HUXLEY;RM;LEAD;BULLETSTORM;ADVENT;SWRepublicCommando;GOWUE</DefineConstants>
44
<TargetFrameworks>net48;netstandard2.0;netstandard2.1;net8.0;net9.0</TargetFrameworks>
55
<LangVersion>13.0</LangVersion>
66
<OutputType>Library</OutputType>
@@ -78,7 +78,7 @@
7878
<PropertyGroup>
7979
<AssemblyName>Eliot.UELib</AssemblyName>
8080
<PackageId>$(AssemblyName)</PackageId>
81-
<Version>$(VersionPrefix)1.11.0</Version>
81+
<Version>$(VersionPrefix)1.11.1</Version>
8282
<Authors>EliotVU</Authors>
8383
<Title>$(AssemblyName)</Title>
8484
<PackageDescription>UnrealScript decompiler library for Unreal package files (.upk, .u, .uasset; etc), with support for Unreal Engine 1, 2, and 3.</PackageDescription>

0 commit comments

Comments
 (0)