Skip to content

Commit

Permalink
Add ivXor of CPlugVehiclePhyTuning (ty Auris!)
Browse files Browse the repository at this point in the history
  • Loading branch information
BigBang1112 committed Jan 2, 2025
1 parent 0cb2f89 commit 2a85c39
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
26 changes: 26 additions & 0 deletions Src/GBX.NET/Engines/Plug/CPlugVehiclePhyTuning.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System.Text;

namespace GBX.NET.Engines.Plug;

public partial class CPlugVehiclePhyTuning
{
public partial class Chunk090EB000
{
public override void ReadWrite(CPlugVehiclePhyTuning n, GbxReaderWriter rw)
{
rw.Id(ref n.name);
rw.NodeRef<CFuncKeysReal>(ref U01);
rw.Single(ref U02);

if (rw.Reader?.Settings.EncryptionInitializer is not null)
{
if (n.name is null || n.name.Length < 4)
{
throw new InvalidOperationException("Name length must be at least 4 characters.");
}

rw.Reader.Settings.EncryptionInitializer.Initialize(Encoding.ASCII.GetBytes(n.name.Substring(0, 4)), 0, 4);
}
}
}
}
10 changes: 4 additions & 6 deletions Src/GBX.NET/Serialization/GbxReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2069,15 +2069,13 @@ internal bool TryInitializeDecryption(IClass node)
{
parentClassId = 0x07001000;
}

if (node is CPlugSurfaceGeom)
else if (baseType == typeof(CGameCtnBlockInfo))
{
parentClassId = 0x0902B000;
parentClassId = 0x24005000;
}

if (baseType == typeof(CGameCtnBlockInfo))
else if (baseType == typeof(CPlugVehiclePhyTuning))
{
parentClassId = 0x24005000;
parentClassId = 0x0A02E000;
}

var parentClassIDBytes = BitConverter.GetBytes(parentClassId);
Expand Down

0 comments on commit 2a85c39

Please sign in to comment.