Skip to content

Commit

Permalink
#50
Browse files Browse the repository at this point in the history
Merge remote-tracking branch 'origin/feature/Feature-Shadow_Strike' into develop

# Conflicts:
#	src/ByteCodeDecompiler.cs
#	src/Eliot.UELib.csproj
#	src/UnrealPackage.cs
#	src/UnrealStream.cs
  • Loading branch information
EliotVU committed Oct 14, 2024
2 parents 83c7ecf + b5a5fea commit a226a6c
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 16 deletions.
25 changes: 25 additions & 0 deletions src/Branch/UE2/ShadowStrike/EngineBranch.ShadowStrike.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using UELib.Core;
using UELib.Core.Tokens;

namespace UELib.Branch.UE2.ShadowStrike
{
public class EngineBranchShadowStrike : DefaultEngineBranch
{
public EngineBranchShadowStrike(BuildGeneration generation) : base(BuildGeneration.UE2)
{
}

protected override TokenMap BuildTokenMap(UnrealPackage linker)
{
var tokenMap = base.BuildTokenMap(linker);

if (linker.Build == UnrealPackage.GameBuild.BuildName.SC_DA_Online)
{
// TODO: All tokens
tokenMap[0x28] = typeof(UStruct.UByteCodeDecompiler.NativeParameterToken);
}

return tokenMap;
}
}
}
10 changes: 10 additions & 0 deletions src/UnrealBuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ public enum BuildGeneration
/// </summary>
Flesh,

/// <summary>
/// Unreal Engine 2 based, offline version for the Splinter Cell series.
/// </summary>
SCX,

/// <summary>
/// Unreal Engine 2 based, online version for the Splinter Cell series.
/// </summary>
ShadowStrike,

/// <summary>
/// Unreal Engine 2 with some early UE3 upgrades.
/// </summary>
Expand Down
61 changes: 46 additions & 15 deletions src/UnrealPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace UELib
using Branch.UE2.DVS;
using Branch.UE3.RL;
using Branch.UE3.SFX;
using Branch.UE2.ShadowStrike;

/// <summary>
/// Represents the method that will handle the UELib.UnrealPackage.NotifyObjectAdded
Expand Down Expand Up @@ -348,6 +349,20 @@ public enum BuildName
[Build(159, 29u, BuildGeneration.UE2_5)]
Spellborn,

[Build(100, 167, BuildGeneration.SCX)]
SC_DA_Offline,

/// <summary>
/// Tom Clancy's Splinter Cell: Double Agent
///
/// 275/000
/// Overriden to version 120, so we can pickup the CppText property in UStruct (although this might be a ProcessedText reference)
/// </summary>
[Build(275, 0, BuildGeneration.ShadowStrike)]
[BuildEngineBranch(typeof(EngineBranchShadowStrike))]
[OverridePackageVersion(120)]
SC_DA_Online,

/// <summary>
/// EndWar
///
Expand Down Expand Up @@ -1156,7 +1171,14 @@ public void Deserialize(IUnrealStream stream)
{
FolderName = stream.ReadString();
}

#if SHADOW_STRIKE
if (stream.Package.Build == BuildGeneration.SCX &&
stream.LicenseeVersion >= 83)
{
// reads 0
int scInt32 = stream.ReadInt32();
}
#endif
PackageFlags = stream.ReadFlags32<PackageFlag>();
Console.WriteLine("Package Flags:" + PackageFlags);
#if HAWKEN || GIGANTIC
Expand Down Expand Up @@ -1220,7 +1242,16 @@ public void Deserialize(IUnrealStream stream)
+ " Exports Count:" + ExportCount + " Exports Offset:" + ExportOffset
+ " Imports Count:" + ImportCount + " Imports Offset:" + ImportOffset
);

#if SHADOW_STRIKE
// No version check, not serialized for DA_Online.
if (stream.Package.Build == BuildGeneration.SCX)
{
int scInt32_2 = stream.ReadInt32();
Debug.Assert(scInt32_2 == 0xff0adde);

string scSaveInfo = stream.ReadText();
}
#endif
if (stream.Version < 68)
{
HeritageCount = stream.ReadInt32();
Expand Down Expand Up @@ -1317,24 +1348,24 @@ public void Deserialize(IUnrealStream stream)
if (stream.Package.Build == GameBuild.BuildName.Tera) stream.Position -= 4;
#endif
#if MKKE
if (stream.Package.Build != GameBuild.BuildName.MKKE)
if (stream.Package.Build == GameBuild.BuildName.MKKE)
{
goto skipGenerations;
}
#endif
int generationCount = stream.ReadInt32();
Contract.Assert(generationCount >= 0);
Console.WriteLine("Generations Count:" + generationCount);
int generationCount = stream.ReadInt32();
Contract.Assert(generationCount >= 0);
Console.WriteLine("Generations Count:" + generationCount);
#if APB
// Guid, however only serialized for the first generation item.
if (stream.Package.Build == GameBuild.BuildName.APB &&
stream.LicenseeVersion >= 32)
{
stream.Skip(16);
}
#endif
stream.ReadArray(out Generations, generationCount);
#if MKKE
// Guid, however only serialized for the first generation item.
if (stream.Package.Build == GameBuild.BuildName.APB &&
stream.LicenseeVersion >= 32)
{
stream.Skip(16);
}
#endif
stream.ReadArray(out Generations, generationCount);
skipGenerations:
#if DNF
if (stream.Package.Build == GameBuild.BuildName.DNF &&
stream.Version >= 151)
Expand Down
5 changes: 4 additions & 1 deletion src/UnrealStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,17 @@ public int ReadIndex() =>
: ReadCompactIndex();

[Obsolete]
public long ReadNameIndex() => (uint)ReadNameIndex(out int n) | ((long)n << 32);
// HACK: Specific builds logic should be displaced by a specialized stream.

public int ReadNameIndex(out int num)
{
int index = ReadIndex();
if (Archive.Version >= (uint)PackageObjectLegacyVersion.NumberAddedToName
#if BIOSHOCK
|| Archive.Package.Build == UnrealPackage.GameBuild.BuildName.BioShock
#endif
#if SHADOW_STRIKE
|| Archive.Package.Build == BuildGeneration.ShadowStrike
#endif
)
{
Expand Down

0 comments on commit a226a6c

Please sign in to comment.