Skip to content

Commit

Permalink
Bump version > 1.5.0; + minor changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
EliotVU committed Apr 7, 2024
1 parent 79fd5b2 commit d4aca85
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 19 deletions.
2 changes: 2 additions & 0 deletions src/Branch/DefaultEngineBranch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,8 @@ protected override TokenMap BuildTokenMap(UnrealPackage linker)
tokenMap[0x4F] = typeof(LocalVariableToken<bool>);
tokenMap[0x50] = typeof(LocalVariableToken<UObject>);
tokenMap[0x51] = typeof(LocalVariableToken<dynamic>);

tokenMap[0x5B] = typeof(ByteConstToken);
break;
#endif
#if BIOSHOCK
Expand Down
2 changes: 2 additions & 0 deletions src/Core/Classes/UStruct.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public partial class UStruct : UField
//protected uint _CodePosition;

public long ScriptOffset { get; private set; }
public int ScriptSize { get; private set; }

public UByteCodeDecompiler ByteCodeManager;

Expand Down Expand Up @@ -233,6 +234,7 @@ protected override void Deserialize()
}

_Buffer.ConformRecordPosition();
ScriptSize = (int)(_Buffer.Position - ScriptOffset);
#if DNF
if (Package.Build == UnrealPackage.GameBuild.BuildName.DNF)
{
Expand Down
23 changes: 12 additions & 11 deletions src/Core/Tokens/ContextTokens.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,32 +110,33 @@ public override void Deserialize(IUnrealStream stream)
Debug.Assert(Struct != null);
}
#endif
// TODO: Corrigate version. Definitely didn't exist in Roboblitz(369)
if (stream.Version > 369)
// TODO: Corrigate version. Definitely didn't exist in Roboblitz(369), first seen in MOHA(421).
if (stream.Version > 374)
{
Struct = stream.ReadObject<UStruct>();
Decompiler.AlignObjectSize();
Debug.Assert(Struct != null);
#if MKKE
if (Package.Build != UnrealPackage.GameBuild.BuildName.MKKE)
if (Package.Build == UnrealPackage.GameBuild.BuildName.MKKE)
{
#endif
// Copy?
stream.ReadByte();
Decompiler.AlignSize(sizeof(byte));
#if MKKE
goto skipToNext;
}
#endif
// Copy?
stream.ReadByte();
Decompiler.AlignSize(sizeof(byte));
}
// TODO: Corrigate version. Definitely didn't exist in MKKE(472), first seen in SWG(486).
if (stream.Version > 472)

// TODO: Corrigate version. Definitely didn't exist in MKKE(472), first seen in FFOW(433).
if (stream.Version >= 433)
{
// Modification?
stream.ReadByte();
Decompiler.AlignSize(sizeof(byte));
}

skipToNext:

// Pre-Context
DeserializeNext();
}
Expand Down
7 changes: 4 additions & 3 deletions src/Eliot.UELib.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<DefineConstants>DECOMPILE;BINARYMETADATA;Forms;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;SPLINTERCELL;AHIT</DefineConstants>
<TargetFramework>net48</TargetFramework>
Expand Down Expand Up @@ -32,6 +32,7 @@
<CodeAnalysisRuleSet>GlobalizationRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<DebugType>none</DebugType>
<DefineConstants>$(DefineConstants);TRACE;</DefineConstants>
<UseVSHostingProcess>true</UseVSHostingProcess>
Expand Down Expand Up @@ -70,10 +71,9 @@
</ItemGroup>
<ProjectExtensions></ProjectExtensions>
<PropertyGroup>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<AssemblyName>Eliot.UELib</AssemblyName>
<PackageId>$(AssemblyName)</PackageId>
<Version>$(VersionPrefix)1.4.0</Version>
<Version>$(VersionPrefix)1.5.0</Version>
<Authors>EliotVU</Authors>
<Title>$(AssemblyName)</Title>
<PackageDescription>UnrealScript decompiler library for Unreal package files (.upk, .u, .uasset; etc), with support for Unreal Engine 1, 2, and 3.</PackageDescription>
Expand All @@ -86,5 +86,6 @@
<EnableNETAnalyzers>True</EnableNETAnalyzers>
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
<AnalysisLevel>latest-recommended</AnalysisLevel>
<PackageReleaseNotes>Improved support for A Hat in Time (UE3)</PackageReleaseNotes>
</PropertyGroup>
</Project>
6 changes: 3 additions & 3 deletions src/Engine/Types/Poly.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public TResult Accept<TResult>(IVisitor<TResult> visitor)
public void Deserialize(IUnrealStream stream)
{
// Always 16
int numVertices = stream.Version < (uint)PackageObjectLegacyVersion.FixedVerticesToArrayFromPoly
int verticesCount = stream.Version < (uint)PackageObjectLegacyVersion.FixedVerticesToArrayFromPoly
? stream.ReadIndex()
: -1;

Expand All @@ -89,7 +89,7 @@ public void Deserialize(IUnrealStream stream)
}
else
{
stream.ReadArray(out Vertex, numVertices);
stream.ReadArray(out Vertex, verticesCount);
}

PolyFlags = stream.ReadUInt32();
Expand Down Expand Up @@ -170,4 +170,4 @@ public void Serialize(IUnrealStream stream)
throw new NotImplementedException();
}
}
}
}
11 changes: 9 additions & 2 deletions src/UnrealPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1511,9 +1511,16 @@ public void Deserialize(UPackageStream stream)
"Branch.Serializer cannot be null. Did you forget to initialize the Serializer in PostDeserializeSummary?");

// We can't continue without decompressing.
if (CompressedChunks != null && CompressedChunks.Any())
if (Summary.CompressedChunks != null &&
Summary.CompressedChunks.Any())
{
return;
if (Summary.CompressionFlags != 0)
{
return;
}

// Flags 0? Let's pretend that we no longer possess any chunks.
Summary.CompressedChunks.Clear();
}
#if TERA
if (Build == GameBuild.BuildName.Tera) Summary.NameCount = Generations.Last().NameCount;
Expand Down

0 comments on commit d4aca85

Please sign in to comment.