Skip to content

Commit

Permalink
Finish Release-1.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
EliotVU committed Nov 12, 2024
2 parents 94770b6 + 0c69bea commit 896638c
Show file tree
Hide file tree
Showing 25 changed files with 303 additions and 94 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Benchmark
on:
push:
branches:
- master

permissions:
contents: write
deployments: write

jobs:
benchmark:
name: Run Benchmark
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Run benchmark
run: cd Benchmark && dotnet run -c Release --exporters json --filter '*'

- name: Store benchmark results
uses: rhysd/github-action-benchmark@v1
with:
name: Benchmark.Net Benchmark
tool: 'benchmarkdotnet'
output-file-path: Benchmark/BenchmarkDotNet.Artifacts/results/Eliot.UELib.Benchmark.Benchmarks-report-full-compressed.json
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
alert-threshold: '200%'
comment-on-alert: true
42 changes: 28 additions & 14 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build .NET Framework and Publish to NuGet
name: Build .NET and Publish

on:
workflow_dispatch:
Expand All @@ -8,25 +8,39 @@ on:

jobs:
build:
runs-on: windows-2019
runs-on: windows-2022
strategy:
matrix:
dotnet: [ '8.0.x' ]
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2

- name: Setup NuGet
uses: NuGet/setup-nuget@v2

- name: Restore dependencies
run: nuget restore src/Eliot.UELib.csproj


- name: Setup
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet }}

- name: Install
run: dotnet restore src/Eliot.UELib.csproj

- name: Build
run: msbuild src/Eliot.UELib.csproj -t:rebuild -property:Configuration=Release

run: dotnet build src/Eliot.UELib.csproj

- name: Restore
run: dotnet restore src/Eliot.UELib.csproj

#- name: Test
# run: dotnet test Test/Eliot.UELib.Test.csproj

- name: Pack
run: dotnet pack --configuration Release src/Eliot.UELib.csproj

#- name: Push
# run: dotnet nuget push src/Eliot.UELib.csproj -k ${{ secrets.NUGET_API_KEY }}} -s https://api.nuget.org/v3/index.json

- name: Publish Eliot.UELib to NuGet
id: nuget
uses: alirezanet/[email protected]
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
#

## [1.8.0](https://github.com/EliotVU/Unreal-Library/releases/tag/1.8.0)

* 89401543 Support for Stranglehold
* 6c89b66a Improved support for Batman series
* 4222595f Improved support for Borderlands: GOTYE
* 6c89b66a Fixed bad decompilation of intrinsic array function calls under certain circumstances.
* 8ba153b3 Fixed missing ')' in a replication statement
* 3eab0cba #92 Fixed issue with overriding a class type when initializing a package.

## [1.7.0](https://github.com/EliotVU/Unreal-Library/releases/tag/1.7.0)

* 0ff0ed96 Added .NET Standard 2.1 and .NET 8.0 as framework targets.
Expand Down
14 changes: 1 addition & 13 deletions CLI/Eliot.UELib.CLI.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<LangVersion>12.0</LangVersion>
<OutputType>Exe</OutputType>
<RootNamespace>UELib.CLI</RootNamespace>
<PublishUrl>publish\</PublishUrl>
Expand All @@ -23,17 +24,4 @@
<ItemGroup>
<ProjectReference Include="..\src\Eliot.UELib.csproj" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.8">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.8 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<PropertyGroup />
</Project>
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ This is a table of games that are confirmed to be compatible with the current st
| | | | |
| Tom Clancy's EndWar | Unknown | 329/000 | |
| Roboblitz | 2306 | 369/006 | |
| Stranglehold | 2605 | 375/025 | |
| Mass Effect (Xbox 360) | 2674 | 391/092 | Xenon |
| Medal of Honor: Airborne | 2859 | 421/011 | |
| Frontlines: Fuel of War | 2917 | 433/052 | |
Expand Down Expand Up @@ -221,10 +222,10 @@ This is a table of games that are confirmed to be compatible with the current st
| Gal\*Gun: Double Peace | 10897 | 871/000 | |
| Battleborn | 8623/1055 | 874/078 | |
| A Hat in Time | 12097 | 877-893/005 | |
| Blue Estate The Game | 10246 | 893/000 | |
| Shadow Complex Remastered | 10897 | 893/001 | |
| Soldier Front 2 | 6712 | 904/009 | |
| Rise of the Triad | 10508 | Unknown | |
| Outlast | 12046 | Unknown | |
| Sherlock Holmes: Crimes and Punishments | 10897 | Unknown | |
| Alien Rage | 7255 | Unknown | |

Expand Down
1 change: 1 addition & 0 deletions Test/Eliot.UELib.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>12.0</LangVersion>
<IsPackable>false</IsPackable>
<Configurations>Debug;Release</Configurations>
</PropertyGroup>
Expand Down
25 changes: 25 additions & 0 deletions Test/UnrealPackageTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,31 @@ namespace Eliot.UELib.Test
[TestClass]
public class UnrealPackageTests
{
public class MyUModel : UModel;

[TestMethod]
public void TestClassTypeOverride()
{
using var stream = UnrealPackageUtilities.CreateTempPackageStream();
using var linker = new UnrealPackage(stream);

Assert.IsTrue(linker.GetClassType("Model") == typeof(UnknownObject));
linker.AddClassType("Model", typeof(MyUModel));
Assert.IsTrue(linker.GetClassType("Model") == typeof(MyUModel));
linker.InitializePackage(UnrealPackage.InitFlags.RegisterClasses);
Assert.IsTrue(linker.GetClassType("Model") == typeof(UModel));

using var stream2 = UnrealPackageUtilities.CreateTempPackageStream();
using var linker2 = new UnrealPackage(stream2);

// Swapped order...
Assert.IsTrue(linker2.GetClassType("Model") == typeof(UnknownObject));
linker2.InitializePackage(UnrealPackage.InitFlags.RegisterClasses);
Assert.IsTrue(linker2.GetClassType("Model") == typeof(UModel));
linker2.AddClassType("Model", typeof(MyUModel));
Assert.IsTrue(linker2.GetClassType("Model") == typeof(MyUModel));
}

internal static void AssertTestClass(UnrealPackage linker)
{
var testClass = linker.FindObject<UClass>("Test");
Expand Down
19 changes: 19 additions & 0 deletions Test/UnrealPackageUtilities.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using System.IO;
using UELib;

namespace Eliot.UELib.Test
{
internal static class UnrealPackageUtilities
{
// HACK: Ugly workaround the issues with UPackageStream
public static UPackageStream CreateTempPackageStream()
{
string tempFilePath = Path.Join(Path.GetTempFileName());
File.WriteAllBytes(tempFilePath, BitConverter.GetBytes(UnrealPackage.Signature));

var stream = new UPackageStream(tempFilePath, FileMode.Open, FileAccess.ReadWrite);
return stream;
}
}
}
22 changes: 6 additions & 16 deletions Test/UnrealStreamTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@ namespace Eliot.UELib.Test
[TestClass]
public class UnrealStreamTests
{
// HACK: Ugly workaround the issues with UPackageStream
private static UPackageStream CreateTempStream()
{
string tempFilePath = Path.Join(Path.GetTempFileName());
File.WriteAllBytes(tempFilePath, BitConverter.GetBytes(UnrealPackage.Signature));

var stream = new UPackageStream(tempFilePath, FileMode.Open, FileAccess.ReadWrite);
return stream;
}

[DataTestMethod]
[DataRow(PackageObjectLegacyVersion.Undefined, 1, +0b0000000000000000000000100001)]
[DataRow(PackageObjectLegacyVersion.Undefined, 1, -0b0000000000000000000000100001)]
Expand All @@ -32,7 +22,7 @@ private static UPackageStream CreateTempStream()
[DataRow(PackageObjectLegacyVersion.CompactIndexDeprecated, 4, int.MaxValue)]
public void SerializeCompactIndex(PackageObjectLegacyVersion version, int count, int compactIndex)
{
using var stream = CreateTempStream();
using var stream = UnrealPackageUtilities.CreateTempPackageStream();
using var linker = new UnrealPackage(stream);
linker.Build = new UnrealPackage.GameBuild(linker);
linker.Summary = new UnrealPackage.PackageFileSummary
Expand Down Expand Up @@ -65,7 +55,7 @@ public void SerializeCompactIndex(PackageObjectLegacyVersion version, int count,
[DataRow(PackageObjectLegacyVersion.Undefined, "语言处理")]
public void SerializeString(PackageObjectLegacyVersion version, string text)
{
using var stream = CreateTempStream();
using var stream = UnrealPackageUtilities.CreateTempPackageStream();
using var linker = new UnrealPackage(stream);
linker.Build = new UnrealPackage.GameBuild(linker);
linker.Summary = new UnrealPackage.PackageFileSummary
Expand All @@ -86,7 +76,7 @@ public void SerializeString(PackageObjectLegacyVersion version, string text)
[TestMethod]
public void SerializeStruct()
{
using var stream = CreateTempStream();
using var stream = UnrealPackageUtilities.CreateTempPackageStream();
using var linker = new UnrealPackage(stream);
linker.Build = new UnrealPackage.GameBuild(linker);
linker.Summary = new UnrealPackage.PackageFileSummary();
Expand All @@ -113,7 +103,7 @@ public void SerializeStruct()
[TestMethod]
public void SerializeStructMarshal()
{
using var stream = CreateTempStream();
using var stream = UnrealPackageUtilities.CreateTempPackageStream();
using var linker = new UnrealPackage(stream);
linker.Build = new UnrealPackage.GameBuild(linker);
linker.Summary = new UnrealPackage.PackageFileSummary();
Expand Down Expand Up @@ -156,7 +146,7 @@ public void SerializeStructMarshal()
[DataRow(PackageObjectLegacyVersion.LazyArrayReplacedWithBulkData)]
public void SerializeBulkData(PackageObjectLegacyVersion version)
{
using var stream = CreateTempStream();
using var stream = UnrealPackageUtilities.CreateTempPackageStream();
using var linker = new UnrealPackage(stream);
linker.Build = new UnrealPackage.GameBuild(linker);
linker.Summary = new UnrealPackage.PackageFileSummary
Expand Down Expand Up @@ -192,7 +182,7 @@ public void SerializeBulkData(PackageObjectLegacyVersion version)
[DataRow(PackageObjectLegacyVersion.VerticalOffsetAddedToUFont)]
public void SerializeDataTypes(PackageObjectLegacyVersion version)
{
using var stream = CreateTempStream();
using var stream = UnrealPackageUtilities.CreateTempPackageStream();
using var linker = new UnrealPackage(stream);
linker.Build = new UnrealPackage.GameBuild(linker);
linker.Summary = new UnrealPackage.PackageFileSummary
Expand Down
4 changes: 4 additions & 0 deletions src/Branch/DefaultEngineBranch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,10 @@ protected override TokenMap BuildTokenMap(UnrealPackage linker)

tokenMap[0x5B] = typeof(ByteConstToken);
break;

case UnrealPackage.GameBuild.BuildName.Borderlands_GOTYE:
tokenMap[0x5B] = typeof(BLVariableToken);
break;
#endif
#if BIOSHOCK
case UnrealPackage.GameBuild.BuildName.BioShock:
Expand Down
22 changes: 13 additions & 9 deletions src/Branch/PackageObjectLegacyVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,23 +162,27 @@ public enum PackageObjectLegacyVersion
CompressionAdded = 334,

NumberAddedToName = 343,

[Discardable] GameGOW = 374, // Engine Version: 2451
[Discardable] GameStranglehold = 375, // Engine Version: 2605

// FIXME: Version 374-491; Delegate source type changed from Name to Object
ChangedDelegateSourceFromNameToObject = 376,

[Discardable] GameGOW = 374,
/// <summary>
/// Possibly attested first with Stranglehold (v375)
/// FIXME: Version 375-491; Delegate source type changed from Name to Object
/// </summary>
ChangedDelegateSourceFromNameToObject = GameStranglehold,

/// <summary>
/// Not attested in (GoW v374, oldest attest (v421)
/// Not attested in GoW v374), oldest attests (v375,v421)
/// FIXME: Version
/// </summary>
SkipSizeAddedToArrayFindTokenIntrinsics = GameGOW + 1,

/// <summary>
/// Not attested in GoW (v374), oldest attest (v421)
/// Not attested in GoW (v374), oldest attests (v375,v421)
/// FIXME: Unknown version
/// </summary>
StructReferenceAddedToStructMember = GameGOW + 1,
StructReferenceAddedToStructMember = GameStranglehold,

// 417 according to the GoW client
LightingChannelsAddedToPoly = 417,
Expand All @@ -189,9 +193,9 @@ public enum PackageObjectLegacyVersion
/// Oldest attest MOHA (v421), but not MKKE (v472, non standard)
/// FIXME: Unknown version
/// </summary>
IsCopyAddedToStructMember = GameGOW + 1,
IsCopyAddedToStructMember = GameStranglehold + 1,

[Discardable] GameFFOW = 433,
[Discardable] GameFFOW = 433, // Engine Version: 2917

/// <summary>
/// Oldest attest FFOW (v433), but not MKKE (v472, non standard)
Expand Down
12 changes: 12 additions & 0 deletions src/Branch/UE3/BL2/Tokens/BLVariableToken.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using UELib.Core;
using UELib.ObjectModel.Annotations;
using UELib.Tokens;

namespace UELib.Branch.UE3.BL2.Tokens
{
[ExprToken(ExprToken.InstanceVariable)]
public class BLVariableToken : UStruct.UByteCodeDecompiler.FieldToken
{

}
}
10 changes: 8 additions & 2 deletions src/Branch/UE3/RSS/EngineBranch.RSS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,17 @@ public EngineBranchRSS(BuildGeneration generation) : base(BuildGeneration.RSS)
protected override TokenMap BuildTokenMap(UnrealPackage linker)
{
var tokenMap = base.BuildTokenMap(linker);

// Identical to ContextToken and ClassContextToken. Spotted in BM 1, 2, and 4
tokenMap[0x50] = typeof(RSSContextToken);

if (linker.Build == UnrealPackage.GameBuild.BuildName.Batman4)
{
tokenMap[0x2B] = typeof(NameConstNoNumberToken); // FIXME: NameConst but without the Int32 number at the end
// FIXME: NameConst but without the Int32 number at the end
tokenMap[0x2B] = typeof(NameConstNoNumberToken);
}

return tokenMap;
}
}
}
}
9 changes: 0 additions & 9 deletions src/Branch/UE3/RSS/Tokens/Bm4ContextToken.cs

This file was deleted.

Loading

0 comments on commit 896638c

Please sign in to comment.