Merge pull request #8147 from DeadlySurprise/vqaAudioFix
Fixed gdi3lose.vqa crash
This commit is contained in:
@@ -187,7 +187,9 @@ namespace OpenRA.FileFormats
|
|||||||
{
|
{
|
||||||
case "SND0":
|
case "SND0":
|
||||||
case "SND2":
|
case "SND2":
|
||||||
if (audioChannels == 1)
|
if (audioChannels == 0)
|
||||||
|
throw new NotSupportedException();
|
||||||
|
else if (audioChannels == 1)
|
||||||
{
|
{
|
||||||
var rawAudio = stream.ReadBytes((int)length);
|
var rawAudio = stream.ReadBytes((int)length);
|
||||||
audio1.Write(rawAudio);
|
audio1.Write(rawAudio);
|
||||||
@@ -198,11 +200,15 @@ namespace OpenRA.FileFormats
|
|||||||
audio1.Write(rawAudio);
|
audio1.Write(rawAudio);
|
||||||
rawAudio = stream.ReadBytes((int)length / 2);
|
rawAudio = stream.ReadBytes((int)length / 2);
|
||||||
audio2.Write(rawAudio);
|
audio2.Write(rawAudio);
|
||||||
|
if (length % 2 != 0)
|
||||||
|
stream.ReadBytes(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
compressed = type == "SND2";
|
compressed = type == "SND2";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
if (length + stream.Position > stream.Length)
|
||||||
|
throw new NotSupportedException("Vqa uses unknown Subtype: {0}".F(type));
|
||||||
stream.ReadBytes((int)length);
|
stream.ReadBytes((int)length);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -304,7 +304,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
if (!GlobalFileSystem.Exists(filename))
|
if (!GlobalFileSystem.Exists(filename))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (Path.GetExtension(filename) == ".vqa")
|
if (Path.GetExtension(filename).ToLower() == ".vqa")
|
||||||
{
|
{
|
||||||
player = panel.Get<VqaPlayerWidget>("PLAYER");
|
player = panel.Get<VqaPlayerWidget>("PLAYER");
|
||||||
currentFilename = filename;
|
currentFilename = filename;
|
||||||
|
|||||||
Reference in New Issue
Block a user