Skip to content

Commit 9ac9250

Browse files
committed
Build detection fixes.
(cherry picked from commit 52ac6dfae9979de11183124eb6ec45cffe7127e6)
1 parent f5c715b commit 9ac9250

4 files changed

Lines changed: 45 additions & 26 deletions

File tree

CHANGELOG.md

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

3+
##
4+
5+
* Fixed #138, unit test and document things regarding build overriding.
6+
* Fixed https://github.com/UE-Explorer/UE-Explorer/issues/100; Detection for "Dungeon Defenders Eternity"
7+
8+
* Improved support for Sudden Attack 2 (#127, #129); "Supper newer version" and "Fixes trailing data for old package OnlineSubsystemPC.u"
9+
310
## [1.12.1](https://github.com/EliotVU/Unreal-Library/releases/tag/1.12.1)
411

512
* Fixed support for Alien: Colonial Marines

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
<PropertyGroup>
2222
<Authors>EliotVU</Authors>
23-
<Copyright>2009-2025 Eliot van Uytfanghe. All rights reserved.</Copyright>
23+
<Copyright>2009-2026 Eliot van Uytfanghe. All rights reserved.</Copyright>
2424
<PackageProjectUrl>https://github.com/EliotVU/Unreal-Library</PackageProjectUrl>
2525
<PackageLicenseFile>LICENSE</PackageLicenseFile>
2626
<PackageReadmeFile>README.md</PackageReadmeFile>

src/Eliot.UELib.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010
<PackageTags>UnrealEngine;UnrealScript;Decompiler;UPK;Exporter;Bytecode</PackageTags>
1111
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1212
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
13-
<IncludeSymbols>true</IncludeSymbols>
14-
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
1513
<GenerateDocumentationFile>True</GenerateDocumentationFile>
1614
<SignAssembly>True</SignAssembly>
1715
<AssemblyOriginatorKeyFile>Eliot.UELib.snk</AssemblyOriginatorKeyFile>
16+
<DebugType>portable</DebugType>
17+
<IncludeSymbols>true</IncludeSymbols>
18+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
1819
</PropertyGroup>
1920
<PropertyGroup Condition="$([MSBuild]::IsOsPlatform('Windows'))">
2021
<TargetFrameworks>net48;$(TargetFrameworks)</TargetFrameworks>

src/UnrealPackage.cs

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@ public GameBuild(BuildName name)
972972
Contract.Assert(buildFieldInfo != null);
973973

974974
// Pick the last attribute.
975-
var buildAttributes = buildFieldInfo.GetCustomAttributes<BuildAttribute>(false).Last();
975+
var buildAttributes = buildFieldInfo.GetCustomAttributes<BuildAttribute>(false).LastOrDefault();
976976
if (buildAttributes != null)
977977
{
978978
Generation = buildAttributes.Generation;
@@ -1048,6 +1048,9 @@ public GameBuild(UnrealPackage package)
10481048
Name = package.Summary.LicenseeVersion == 0
10491049
? BuildName.Default
10501050
: BuildName.Unknown;
1051+
1052+
DetermineGeneration(package.Summary.Version);
1053+
10511054
return;
10521055
}
10531056

@@ -1060,28 +1063,14 @@ public GameBuild(UnrealPackage package)
10601063
OverrideLicenseeVersion = overrideAttribute.FixedLicenseeVersion;
10611064
}
10621065

1063-
if (buildAttribute != null)
1066+
if (buildAttribute is { Generation: BuildGeneration.Undefined } or null)
10641067
{
1065-
if (buildAttribute.Generation == BuildGeneration.Undefined)
1066-
{
1067-
uint version = OverrideVersion.GetValueOrDefault(package.Summary.Version);
1068-
if (package.Summary.UE4Version > 0)
1069-
{
1070-
Generation = BuildGeneration.UE4;
1071-
}
1072-
else
1073-
Generation = version switch
1074-
{
1075-
>= (uint)PackageObjectLegacyVersion.UE3 => BuildGeneration.UE3,
1076-
>= (uint)PackageObjectLegacyVersion.PrimitiveCastTokenAdded => BuildGeneration.UE2,
1077-
_ => BuildGeneration.UE1
1078-
};
1079-
}
1080-
else
1081-
{
1082-
Generation = buildAttribute.Generation;
1083-
}
1084-
1068+
uint version = OverrideVersion.GetValueOrDefault(package.Summary.Version);
1069+
DetermineGeneration(version);
1070+
}
1071+
else
1072+
{
1073+
Generation = buildAttribute.Generation;
10851074
Flags = buildAttribute.Flags;
10861075
}
10871076

@@ -1091,6 +1080,25 @@ public GameBuild(UnrealPackage package)
10911080
// We cannot create the instance here, because the instance itself may be dependent on GameBuild.
10921081
EngineBranchType = engineBranchAttribute.EngineBranchType;
10931082
}
1083+
1084+
return;
1085+
1086+
void DetermineGeneration(uint version)
1087+
{
1088+
if (package.Summary.UE4Version > 0)
1089+
{
1090+
Generation = BuildGeneration.UE4;
1091+
}
1092+
else
1093+
{
1094+
Generation = version switch
1095+
{
1096+
>= (uint)PackageObjectLegacyVersion.UE3 => BuildGeneration.UE3,
1097+
>= (uint)PackageObjectLegacyVersion.PrimitiveCastTokenAdded => BuildGeneration.UE2,
1098+
_ => BuildGeneration.UE1
1099+
};
1100+
}
1101+
}
10941102
}
10951103

10961104
private FieldInfo? FindBuildInfo(UnrealPackage linker, out BuildAttribute? buildAttribute)
@@ -1408,7 +1416,10 @@ private void SetupBranch(UnrealPackage package)
14081416
package.Build.Generation);
14091417

14101418
// The branch may override the generation. (Especially in unit-tests this is useful)
1411-
package.Build.Generation = package.Branch.Generation;
1419+
if (package.Branch.Generation != BuildGeneration.Undefined)
1420+
{
1421+
package.Build.Generation = package.Branch.Generation;
1422+
}
14121423
}
14131424
else if (package.Summary.UE4Version > 0)
14141425
{

0 commit comments

Comments
 (0)