fix AudLoader failing to load sounds that use only half of the final byte
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
#region Copyright & License Information
|
\#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
@@ -141,10 +141,14 @@ namespace OpenRA.FileFormats
|
|||||||
output[offset++] = (byte)t;
|
output[offset++] = (byte)t;
|
||||||
output[offset++] = (byte)(t >> 8);
|
output[offset++] = (byte)(t >> 8);
|
||||||
|
|
||||||
|
if (offset < outputSize)
|
||||||
|
{
|
||||||
|
/* possible that only half of the final byte is used! */
|
||||||
t = DecodeSample((byte)(b >> 4), ref index, ref currentSample);
|
t = DecodeSample((byte)(b >> 4), ref index, ref currentSample);
|
||||||
output[offset++] = (byte)t;
|
output[offset++] = (byte)t;
|
||||||
output[offset++] = (byte)(t >> 8);
|
output[offset++] = (byte)(t >> 8);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dataSize -= 8 + chunk.CompressedSize;
|
dataSize -= 8 + chunk.CompressedSize;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user