diff --git a/CodeWalker.Core/GameFiles/FileTypes/AwcFile.cs b/CodeWalker.Core/GameFiles/FileTypes/AwcFile.cs index 8c3c900..42a30f5 100644 --- a/CodeWalker.Core/GameFiles/FileTypes/AwcFile.cs +++ b/CodeWalker.Core/GameFiles/FileTypes/AwcFile.cs @@ -341,6 +341,10 @@ namespace CodeWalker.GameFiles { if (SingleChannelEncryptFlag && !WholeFileEncrypted) { + if (datachunk.Data.Length % 4 != 0) + { + throw new Exception($"Unable to encrypt data chunk of length {datachunk.Data.Length}: Data to encrypt must be a multiple of 4 bytes long.\nEnsure that PCM streams have an even number of samples, and ADPCM streams have a multiple of 8 samples."); + } Encrypt_RSXXTEA(datachunk.Data); } }