Skip to content

Commit

Permalink
Full The Chronicles of Spellborn support (Except for the new UC featu…
Browse files Browse the repository at this point in the history
…res)
  • Loading branch information
EliotVU committed Apr 28, 2022
1 parent 51474ad commit 0747049
Show file tree
Hide file tree
Showing 10 changed files with 110 additions and 16 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,14 @@ Below is a table of games that are known to be compatible with the UELib.
| Unreal Tournament 2003 | 1077-2225 | 119/025 | |
| Unreal II | 829-2001 | 126/2609 | |
| Unreal Tournament 2004 | 3120-3369 | 128/029 | |
| America's Army 2 | 3369 | 128/032:033 | | 2.5, 2.6, 2.8
| America's Army (Arcade) | 3369 | 128/032 | | 2.6
| America's Army 2 | 3369 | 128/032:033 | 2.5, 2.6, 2.8 |
| America's Army (Arcade) | 3369 | 128/032 | 2.6 |
| Red Orchestra: Ostfront 41-45 | 3323-3369 | 128/029 | |
| Killing Floor | 3369 | 128/029 | |
| Battle Territory Battery | Unknown | Unknown | |
| Swat 4 | Unknown | 129/027 | |
| Unreal Championship 2: Liandri Conflict | 3323 | 151/002 | (Third-party) <https://forums.beyondunreal.com/threads/unreal-championship-2-script-decompiler-release.206036/> |
| The Chronicles of Spellborn | Unknown | 159/029 | |
| | | | |
| | | | |
| Roboblitz | 2306 | 369/006 | |
Expand All @@ -72,7 +73,7 @@ Below is a table of games that are known to be compatible with the UELib.
| The Exiled Realm of Arborea or TERA | 4206 | 610/014 | |
| Monday Night Combat | 5697 | 638/000 | |
| Unreal Development Kit | 6094-10246 | 664-860 | |
| Dungeon Defenders | 6262 | 678/002 | | Earlier releases only
| Dungeon Defenders | 6262 | 678/002 | Earlier releases only |
| Alice Madness Returns | 6760 | 690/000 | |
| The Ball | 6699 | 706/000 | |
| Bioshock Infinite | 6829 | 727/075 | |
Expand Down
29 changes: 27 additions & 2 deletions src/Core/Classes/Props/UProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,37 @@ protected override void Deserialize()

if (HasPropertyFlag(PropertyFlagsLO.EditorData)
// FIXME: At which version was this feature removed?
if (HasPropertyFlag(Flags.PropertyFlagsLO.EditorData) && Package.Version <= 128)
&& Package.Version <= 160)
{
// May represent a tooltip/comment in some games.
EditorDataText = _Buffer.ReadText();
Record(nameof(EditorDataText), EditorDataText);
}

#if SPELLBORN
if (Package.Build == UnrealPackage.GameBuild.BuildName.Spellborn)
{
if (_Buffer.Version < 157)
{
throw new NotSupportedException("< 157 Spellborn packages are not supported");

if (133 < _Buffer.Version)
{
// idk
}

if (134 < _Buffer.Version)
{
int unk32 = _Buffer.ReadInt32();
Record("Unknown", unk32);
}
}
else
{
uint replicationFlags = _Buffer.ReadUInt32();
Record(nameof(replicationFlags), replicationFlags);
}
}
#endif
#if SWAT4
if (Package.Build == UnrealPackage.GameBuild.BuildName.Swat4)
{
Expand Down
3 changes: 2 additions & 1 deletion src/Core/Classes/Props/UPropertyDecompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ public string FormatFlags()
output += FormatAccess();

// UE3 flags
if (Package.Version > 129)
// FIXME: Correct version
if (Package.Version > 160)
{
if (HasPropertyFlag(Flags.PropertyFlagsHO.PrivateWrite))
{
Expand Down
18 changes: 17 additions & 1 deletion src/Core/Classes/UClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,15 @@ protected override void Deserialize()
#endif
ClassFlags = _Buffer.ReadUInt32();
Record("ClassFlags", (ClassFlags)ClassFlags);

#if SPELLBORN
if (Package.Build == UnrealPackage.GameBuild.BuildName.Spellborn)
{
_Buffer.ReadArray(out ClassDependencies);
Record(nameof(ClassDependencies), ClassDependencies);
PackageImports = DeserializeGroup(nameof(PackageImports));
goto skipTo61Stuff;
}
#endif
// FIXME: Both were deprecated since then
if (Package.Version < 140)
{
Expand All @@ -151,6 +159,7 @@ protected override void Deserialize()
Record("???", unknown);
}

skipTo61Stuff:
if (Package.Version > 61)
{
// Class Name Extends Super.Name Within _WithinIndex
Expand Down Expand Up @@ -202,6 +211,13 @@ protected override void Deserialize()
if (Package.Version < 220 || !isHideCategoriesOldOrder)
{
DeserializeHideCategories();
#if SPELLBORN
if (Package.Build == UnrealPackage.GameBuild.BuildName.Spellborn)
{
uint replicationFlags = _Buffer.ReadUInt32();
Record(nameof(replicationFlags), replicationFlags);
}
#endif
}

// +AutoExpandCategories
Expand Down
8 changes: 8 additions & 0 deletions src/Core/Classes/UEnum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,15 @@ protected override void Deserialize()
{
Names.Add(_Buffer.ReadNameReference());
}
#if SPELLBORN
if (_Buffer.Package.Build == UnrealPackage.GameBuild.BuildName.Spellborn
&& 145 < _Buffer.Version)
{
uint unknownEnumFlags = _Buffer.ReadUInt32();
Record(nameof(unknownEnumFlags), unknownEnumFlags);
}
}
#endif

#endregion
}
Expand Down
12 changes: 12 additions & 0 deletions src/Core/Classes/UFunction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,18 @@ protected override void Deserialize()
Record("RepOffset", RepOffset);
}

#if SPELLBORN
if (_Buffer.Package.Build == UnrealPackage.GameBuild.BuildName.Spellborn
&& 133 < _Buffer.Version)
{
// Always 0xAC6975C
uint unknownFlags1 = _Buffer.ReadUInt32();
Record(nameof(unknownFlags1), unknownFlags1);
uint replicationFlags = _Buffer.ReadUInt32();
Record(nameof(replicationFlags), replicationFlags);
}
#endif

// TODO: Data-strip version?
if (Package.Version >= VFriendlyName && !Package.IsConsoleCooked()
#if TRANSFORMERS
Expand Down
10 changes: 8 additions & 2 deletions src/Core/Classes/UStruct.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ public partial class UStruct : UField
private const uint VProcessedText = 129;

// TODO: Corrigate version
private const uint VFriendlyNameMoved = 154;
private const uint VFriendlyNameMoved = 160;

// TODO: Corrigate version
private const uint VStructFlagsMoved = 154;
private const uint VStructFlagsMoved = 160;

#region Serialized Members

Expand Down Expand Up @@ -106,6 +106,9 @@ protected override void Deserialize()
if (Package.Version >= VCppText && !Package.IsConsoleCooked()
#if VANGUARD
&& Package.Build.Name != UnrealPackage.GameBuild.BuildName.Vanguard
#endif
#if SPELLBORN
&& Package.Build.Name != UnrealPackage.GameBuild.BuildName.Spellborn
#endif
)
{
Expand All @@ -131,6 +134,9 @@ protected override void Deserialize()
if (Package.Version >= VProcessedText
#if VANGUARD
&& Package.Build.Name != UnrealPackage.GameBuild.BuildName.Vanguard
#endif
#if SPELLBORN
&& Package.Build.Name != UnrealPackage.GameBuild.BuildName.Spellborn
#endif
)
{
Expand Down
10 changes: 5 additions & 5 deletions src/Eliot.UELib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;DECOMPILE BINARYMETADATA Forms UE1 UE2 UE3 SWAT4 UNREAL2 INFINITYBLADE BORDERLANDS2 GOW2 DEBUG_TEST APB SPECIALFORCE2 XIII SINGULARITY THIEFDEADLYSHADOWS BORDERLANDS MIRRORSEDGE BIOSHOCK HAWKEN UT DISHONORED REMEMBERME ALPHAPROTOCOL VANGUARD TERA MKKE TRANSFORMERS XCOM2 AA2</DefineConstants>
<DefineConstants>TRACE;DEBUG;DECOMPILE BINARYMETADATA Forms UE1 UE2 UE3 SWAT4 UNREAL2 INFINITYBLADE BORDERLANDS2 GOW2 DEBUG_TEST APB SPECIALFORCE2 XIII SINGULARITY THIEFDEADLYSHADOWS BORDERLANDS MIRRORSEDGE BIOSHOCK HAWKEN UT DISHONORED REMEMBERME ALPHAPROTOCOL VANGUARD TERA MKKE TRANSFORMERS XCOM2 AA2 SPELLBORN</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>0</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
Expand All @@ -61,7 +61,7 @@
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;Forms DECOMPILE SWAT4 UNREAL2 INFINITYBLADE BORDERLANDS2 APB GOW2 SPECIALFORCE2 XIII SINGULARITY THIEFDEADLYSHADOWS BORDERLANDS MIRRORSEDGE HAWKEN UT DISHONORED REMEMBERME BIOSHOCK DEUSEXINVISIBLEWAR XCOM2 AA2</DefineConstants>
<DefineConstants>TRACE;Forms DECOMPILE SWAT4 UNREAL2 INFINITYBLADE BORDERLANDS2 APB GOW2 SPECIALFORCE2 XIII SINGULARITY THIEFDEADLYSHADOWS BORDERLANDS MIRRORSEDGE HAWKEN UT DISHONORED REMEMBERME BIOSHOCK DEUSEXINVISIBLEWAR XCOM2 AA2 SPELLBORN</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>
Expand All @@ -73,7 +73,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DecompileDebug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Publish\</OutputPath>
<DefineConstants>TRACE;DEBUG;DECOMPILE BINARYMETADATA Forms DEBUG_TEST DEBUG_TOKENPOSITIONS DEBUG_HIDDENTOKENS DEBUG_NESTS DEBUG_FUNCTIONINFO UE1 UE2 UE3 SWAT4 UNREAL2 INFINITYBLADE BORDERLANDS2 GOW2 DEBUG_TEST APB SPECIALFORCE2 XIII SINGULARITY THIEFDEADLYSHADOWS BORDERLANDS MIRRORSEDGE BIOSHOCK HAWKEN UT DISHONORED REMEMBERME ALPHAPROTOCOL VANGUARD TERA MKKE TRANSFORMERS XCOM2 AA2</DefineConstants>
<DefineConstants>TRACE;DEBUG;DECOMPILE BINARYMETADATA Forms DEBUG_TEST DEBUG_TOKENPOSITIONS DEBUG_HIDDENTOKENS DEBUG_NESTS DEBUG_FUNCTIONINFO UE1 UE2 UE3 SWAT4 UNREAL2 INFINITYBLADE BORDERLANDS2 GOW2 DEBUG_TEST APB SPECIALFORCE2 XIII SINGULARITY THIEFDEADLYSHADOWS BORDERLANDS MIRRORSEDGE BIOSHOCK HAWKEN UT DISHONORED REMEMBERME ALPHAPROTOCOL VANGUARD TERA MKKE TRANSFORMERS XCOM2 AA2 SPELLBORN</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<Optimize>false</Optimize>
Expand All @@ -95,7 +95,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Publish|AnyCPU'">
<OutputPath>bin\Publish\</OutputPath>
<DefineConstants>Forms DECOMPILE BINARYMETADATA SWAT4 UNREAL2 INFINITYBLADE BORDERLANDS2 GOW2 APB SPECIALFORCE2 XIII SINGULARITY THIEFDEADLYSHADOWS BORDERLANDS MIRRORSEDGE BIOSHOCK HAWKEN UT DISHONORED REMEMBERME ALPHAPROTOCOL VANGUARD TERA MKKE TRANSFORMERS XCOM2 AA2</DefineConstants>
<DefineConstants>Forms DECOMPILE BINARYMETADATA SWAT4 UNREAL2 INFINITYBLADE BORDERLANDS2 GOW2 APB SPECIALFORCE2 XIII SINGULARITY THIEFDEADLYSHADOWS BORDERLANDS MIRRORSEDGE BIOSHOCK HAWKEN UT DISHONORED REMEMBERME ALPHAPROTOCOL VANGUARD TERA MKKE TRANSFORMERS XCOM2 AA2 SPELLBORN</DefineConstants>
<Optimize>true</Optimize>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisLogFile>..\..\..\..\..\..\..\Program Files (x86)\UE Explorer\Eliot.UELib.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
Expand All @@ -116,7 +116,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'UnitTest|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Test\</OutputPath>
<DefineConstants>TRACE;DEBUG;DECOMPILE UE1 UE2 UE3 SWAT4 UNREAL2 INFINITYBLADE BORDERLANDS2 GOW2 DEBUG_TEST APB SPECIALFORCE2 XIII SINGULARITY THIEFDEADLYSHADOWS BORDERLANDS MIRRORSEDGE BIOSHOCK HAWKEN UT DISHONORED REMEMBERME ALPHAPROTOCOL VANGUARD TERA MKKE TRANSFORMERS XCOM2 AA2</DefineConstants>
<DefineConstants>TRACE;DEBUG;DECOMPILE UE1 UE2 UE3 SWAT4 UNREAL2 INFINITYBLADE BORDERLANDS2 GOW2 DEBUG_TEST APB SPECIALFORCE2 XIII SINGULARITY THIEFDEADLYSHADOWS BORDERLANDS MIRRORSEDGE BIOSHOCK HAWKEN UT DISHONORED REMEMBERME ALPHAPROTOCOL VANGUARD TERA MKKE TRANSFORMERS XCOM2 AA2 SPELLBORN</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<WarningLevel>0</WarningLevel>
<DebugType>full</DebugType>
Expand Down
1 change: 1 addition & 0 deletions src/UnrealFlags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public enum ExportFlags : uint
public enum ObjectFlagsLO : ulong // 32bit aligned, see ObjectFlags64
{
Transactional = 0x00000001U,
InSingularFunc = 0x00000002U,
Public = 0x00000004U,

Private = 0x00000080U,
Expand Down
28 changes: 26 additions & 2 deletions src/UnrealPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,9 @@ public enum BuildName
/// </summary>
[Build(118, 128, 25u, 29u)] UT2004,

// Built on UT2004
// Represents both AAO and AAA
/// <summary>
/// Built on UT2004
/// Represents both AAO and AAA
/// 128/032:033
/// </summary>
[Build(128, 128, 32u, 33u)] AA2,
Expand All @@ -303,6 +303,14 @@ public enum BuildName

// IrrationalGames - 129:143/027:059

/// <summary>
/// Built on UT2004
/// 159/029
///
/// Comes with several new non-standard UnrealScript features, these are however not supported.
/// </summary>
[Build(159, 29u)] Spellborn,

/// <summary>
/// 369/006
/// </summary>
Expand Down Expand Up @@ -952,8 +960,14 @@ public void Deserialize(UPackageStream stream)
#if MKKE
if (Build == GameBuild.BuildName.MKKE) stream.Skip(4);
#endif
if (Build == GameBuild.BuildName.Spellborn
&& stream.Version >= 148)
{
goto skipGuid;
}
GUID = stream.ReadGuid().ToString();
Console.WriteLine("GUID:" + GUID);
skipGuid:
#if TERA
if (Build == GameBuild.BuildName.Tera) stream.Position -= 4;
#endif
Expand Down Expand Up @@ -1085,6 +1099,16 @@ public void Deserialize(UPackageStream stream)
nameEntry.Size = (int)(stream.Position - nameEntry.Offset);
Names.Add(nameEntry);
}
#if SPELLBORN
// WTF were they thinking? Change DRFORTHEWIN to None
if (Build == GameBuild.BuildName.Spellborn
&& Names[0].Name == "DRFORTHEWIN")
{
Names[0].Name = "None";
// False??
//Debug.Assert(stream.Position == _TablesData.ImportsOffset);
}
#endif
}

// Read Import Table
Expand Down

0 comments on commit 0747049

Please sign in to comment.