Skip to content

Commit

Permalink
Some cleanup & documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
EliotVU committed Jun 24, 2022
1 parent f4ed381 commit 0ca537f
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 40 deletions.
30 changes: 17 additions & 13 deletions src/Core/Classes/Props/UProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,27 +107,31 @@ protected override void Deserialize()
}
#endif
#if THIEF_DS || DEUSEX_IW
if (Package.Build == BuildGeneration.Thief)
if (Package.Build == BuildGeneration.Flesh)
{
// Property flags like CustomEditor, CustomViewer, ThiefProp, DeusExProp, NoTextExport, NoTravel
uint deusFlags = _Buffer.ReadUInt32();
Record(nameof(deusFlags), deusFlags);
}
#endif
// FIXME: UE4 version
if (!Package.IsConsoleCooked() && _Buffer.UE4Version < 160)
if (!Package.IsConsoleCooked())
{
CategoryName = _Buffer.ReadNameReference();
Record(nameof(CategoryName), CategoryName);
}
// FIXME: UE4 version
if (_Buffer.UE4Version < 160)
{
CategoryName = _Buffer.ReadNameReference();
Record(nameof(CategoryName), CategoryName);
}

if (Package.Version > 400)
{
ArrayEnum = GetIndexObject(_Buffer.ReadObjectIndex()) as UEnum;
Record("ArrayEnum", ArrayEnum);
if (_Buffer.Version > 400)
{
ArrayEnum = _Buffer.ReadObject<UEnum>();
Record(nameof(ArrayEnum), ArrayEnum);
}
}

#if THIEF_DS || DEUSEX_IW
if (Package.Build == BuildGeneration.Thief)
if (Package.Build == BuildGeneration.Flesh)
{
short deusInheritedOrRuntimeInstiantiated = _Buffer.ReadInt16();
Record(nameof(deusInheritedOrRuntimeInstiantiated), deusInheritedOrRuntimeInstiantiated);
Expand Down Expand Up @@ -158,10 +162,10 @@ protected override void Deserialize()
Record(nameof(vengeanceEditDisplay), vengeanceEditDisplay);
}
#endif
// Appears to be a UE2X feature, it is not present in UE2 builds with no custom LicenseeVersion
// Appears to be a UE2.5 feature, it is not present in UE2 builds with no custom LicenseeVersion
// Albeit DeusEx indicates otherwise?
if ((HasPropertyFlag(PropertyFlagsLO.EditorData) &&
(Package.Build == BuildGeneration.UE2_5 || Package.Build == BuildGeneration.Thief))
(Package.Build == BuildGeneration.UE2_5 || Package.Build == BuildGeneration.Flesh))
// No property flag
|| Package.Build == BuildGeneration.Vengeance)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Core/Classes/UClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ protected override void Deserialize()
}
}
#if BATMAN
if (Package.Build == UnrealPackage.GameBuild.BuildName.BatmanUDK)
if (Package.Build == BuildGeneration.RSS)
{
_Buffer.Skip(sizeof(int));
}
Expand Down Expand Up @@ -372,7 +372,7 @@ protected override void Deserialize()
}
#endif
#if THIEF_DS || DeusEx_IW
if (Package.Build == BuildGeneration.Thief)
if (Package.Build == BuildGeneration.Flesh)
{
string thiefClassVisibleName = _Buffer.ReadText();
Record(nameof(thiefClassVisibleName), thiefClassVisibleName);
Expand Down
6 changes: 3 additions & 3 deletions src/Core/Classes/UDefaultProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,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();
Expand Down Expand Up @@ -275,7 +275,7 @@ private bool DeserializeTagByOffset()
Record(nameof(Type), Type.ToString());
if (Type == PropertyType.None) return true;

if (_Buffer.Package.Build != BuildGeneration.Batman3MP)
if (_Buffer.Package.Build != UnrealPackage.GameBuild.BuildName.Batman3MP)
{
ushort offset = _Buffer.ReadUInt16();
Record(nameof(offset), offset);
Expand All @@ -295,7 +295,7 @@ private bool DeserializeTagByOffset()
Type == PropertyType.StructProperty ||
Type == PropertyType.Vector ||
Type == PropertyType.Rotator ||
(Type == PropertyType.BoolProperty && _Buffer.Package.Build == BuildGeneration.Batman4))
(Type == PropertyType.BoolProperty && _Buffer.Package.Build == UnrealPackage.GameBuild.BuildName.Batman4))
{
switch (Type)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Classes/UObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ protected virtual void Deserialize()
//}
#if THIEF_DS || DEUSEX_IW
// FIXME: Not present in all objects, even some classes?
if (Package.Build == BuildGeneration.Thief && GetType() != typeof(UnknownObject))
if (Package.Build == BuildGeneration.Flesh && GetType() != typeof(UnknownObject))
{
// var native private const int ObjectInternalPropertyHash[1];
int thiefLinkDataObjectCount = _Buffer.ReadInt32();
Expand Down
4 changes: 1 addition & 3 deletions src/Core/Tables/UExportTableItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,12 @@ public void Deserialize(IUnrealStream stream)
{
ArchetypeIndex = stream.ReadInt32();
}

#if BATMAN
if (stream.Package.Build == UnrealPackage.GameBuild.BuildName.BatmanUDK)
if (stream.Package.Build == BuildGeneration.RSS)
{
stream.Skip(sizeof(int));
}
#endif

_ObjectFlagsOffset = stream.Position;
#if BIOSHOCK
// Like UE3 but without the shifting of flags
Expand Down
68 changes: 60 additions & 8 deletions src/UnrealBuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,73 @@ public enum BuildGeneration
{
Undefined,

Thief,
/// <summary>
/// Unreal Engine 1
///
/// Not in use yet.
/// </summary>
UE1,

/// <summary>
/// Unreal Engine 2
///
/// Not in use yet.
/// </summary>
UE2,

/// <summary>
/// Heavily modified Unreal Engine 2 by Ion Storm for Thief: Deadly Shadows
/// </summary>
Flesh,

/// <summary>
/// Unreal Engine 2 with some early UE3 upgrades.
/// </summary>
UE2_5,
UE2X,

/// <summary>
/// Heavily modified Unreal Engine 2.5 for Vengeance: Tribes; also used by Swat4 and BioShock.
/// </summary>
Vengeance,

/// <summary>
/// Heavily modified Unreal Engine 2.5 for Splinter Cell
///
/// Not yet supported.
/// </summary>
Lead,

// Batman2+ use the same Engine spinoff, but it's still necessary to distinguish the builds by name.
Batman2,
Batman3,
Batman3MP,
Batman4,
/// <summary>
/// Modified Unreal Engine 2 for Xbox e.g. Unreal Championship 2: The Liandri Conflict
/// </summary>
UE2X,

/// <summary>
/// Unreal Engine 3
///
/// Not in use yet.
/// </summary>
UE3,

/// <summary>
/// Rocksteady Studios
///
/// Heavily modified Unreal Engine 3 for the Arkham series
/// </summary>
RSS,

/// <summary>
/// High Moon Studios
///
/// Heavily modified Unreal Engine 3 for Transformers and Deadpool etc
/// </summary>
HMS,


/// <summary>
/// Unreal Engine 4
///
/// Not in use yet.
/// </summary>
UE4
}

Expand Down
39 changes: 29 additions & 10 deletions src/UnrealPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,14 @@ public enum BuildName
/// Missing support for custom classes such as BitfieldProperty and BitfieldEnum among others.
/// 95/69
/// </summary>
[Build(95, 69, BuildGeneration.Thief)] DeusEx_IW,
[Build(95, 69, BuildGeneration.Flesh)] DeusEx_IW,

/// <summary>
/// Thief: Deadly Shadows
///
/// 95/133
/// </summary>
[Build(95, 133, BuildGeneration.Thief)]
[Build(95, 133, BuildGeneration.Flesh)]
Thief_DS,

/// <summary>
Expand Down Expand Up @@ -486,17 +486,36 @@ public enum BuildName
[Build(860, 4)] Hawken,

/// <summary>
/// 805-6/101-3
/// 807/137-8
/// Batman: Arkham City
///
/// 805/101
/// </summary>
[Build(805, 101, BuildGeneration.RSS)]
Batman2,

/// <summary>
/// Batman: Arkham Origins
///
/// 806/103
/// 807/807
/// </summary>
[Build(806, 103, BuildGeneration.RSS)]
[Build(807, 807, 137, 138, BuildGeneration.RSS)]
Batman3,

/// <summary>
/// 807/104
/// </summary>
[Build(807, 104, BuildGeneration.RSS)]
Batman3MP,

/// <summary>
/// Batman: Arkham Knight
///
/// 863/32995
/// </summary>
[Build(805, 101, BuildGeneration.Batman2)] // Batman: Arkham City
[Build(806, 103, BuildGeneration.Batman3)]
[Build(807, 807, 137, 138, BuildGeneration.Batman3)] // Batman: Arkham Origins
[Build(807, 104, BuildGeneration.Batman3MP)]
[Build(863, 32995, BuildGeneration.Batman4)] // Batman: Arkham Knight
BatmanUDK,
[Build(863, 32995, BuildGeneration.RSS)]
Batman4,

/// <summary>
/// 867/009:032
Expand Down

0 comments on commit 0ca537f

Please sign in to comment.