Add better error message for AWC encrypting stream of wrong length

This commit is contained in:
dexy 2024-07-26 20:48:42 +10:00
parent d5ac5e8e59
commit 09d7cf68ff

View File

@ -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);
}
}