Armageddon: Read and write signature as unsigned integer instead of string.

This commit is contained in:
Ray Koopa 2020-07-03 13:57:34 +02:00
parent 6d2864e6f7
commit b44ae666b6

View File

@ -19,7 +19,7 @@ namespace Syroot.Worms.Armageddon
{
// ---- CONSTANTS ----------------------------------------------------------------------------------------------
private const string _signature = "SCHM";
private const uint _signature = 0x4D484353; // "SCHM"
private const int _objectCount5Step = 30;
private const int _objectCount10Step = 44;
@ -1024,7 +1024,7 @@ namespace Syroot.Worms.Armageddon
}
// Read the header.
if (reader.ReadString(_signature.Length) != _signature)
if (reader.ReadUInt32() != _signature)
throw new InvalidDataException("Invalid scheme file signature.");
Version = reader.ReadEnum<SchemeVersion>(true);
@ -1156,7 +1156,7 @@ namespace Syroot.Worms.Armageddon
// Write the header.
SchemeVersion version = (SchemeVersion)((uint)format >> 16);
writer.Write(_signature, StringCoding.Raw);
writer.Write(_signature);
writer.WriteEnum(version);
// Write the options.