Skip to content

Commit

Permalink
Support UE4 FNameEntry.
Browse files Browse the repository at this point in the history
  • Loading branch information
EliotVU committed Mar 9, 2018
1 parent 716d801 commit ab49963
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions src/Core/Tables/UNameTableItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,36 +23,28 @@ public sealed class UNameTableItem : UTableItem, IUnrealSerializableClass
public ulong Flags;
#endregion

private const int QWORDVersion = 141;
private const int VerToQword = 141;

public void Deserialize( IUnrealStream stream )
{
Name = stream.ReadText();
#if UE4
if( stream.Package.UE4Version > 0 )
if( stream.Package.UE4Version >= 504 )
{
stream.Skip(4);
// ushort nonCasePreservingHash = stream.ReadUInt16();
// ushort casePreservingHash = stream.ReadUInt16();
return;
}
#endif
Flags = stream.Version >= QWORDVersion ? stream.ReadUInt64() : stream.ReadUInt32();
#if DEOBFUSCATE
// De-obfuscate names that contain unprintable characters!
foreach( char c in Name )
{
if( !char.IsLetterOrDigit( c ) )
{
Name = "N" + TableIndex + "_OBF";
break;
}
}
#endif
Flags = stream.Version >= VerToQword ? stream.ReadUInt64() : stream.ReadUInt32();
}

public void Serialize( IUnrealStream stream )
{
stream.WriteString( Name );

if( stream.Version < QWORDVersion )
if( stream.Version < VerToQword )
{
// Writing UINT
stream.UW.Write( (uint)Flags );
Expand Down

0 comments on commit ab49963

Please sign in to comment.