mirror of
https://github.com/crskycode/GARbro.git
synced 2025-01-11 20:39:29 +08:00
(WaveAudio.TryOpen): check for "WAVE" signature beforehand.
This commit is contained in:
parent
bd037316c3
commit
7c989a0150
@ -113,6 +113,10 @@ namespace GameRes
|
|||||||
|
|
||||||
public override SoundInput TryOpen (IBinaryStream file)
|
public override SoundInput TryOpen (IBinaryStream file)
|
||||||
{
|
{
|
||||||
|
var header = file.ReadHeader (12);
|
||||||
|
if (!header.AsciiEqual (8, "WAVE"))
|
||||||
|
return null;
|
||||||
|
file.Position = 0;
|
||||||
SoundInput sound = new WaveInput (file.AsStream);
|
SoundInput sound = new WaveInput (file.AsStream);
|
||||||
if (EmbeddedFormats.Contains (sound.Format.FormatTag))
|
if (EmbeddedFormats.Contains (sound.Format.FormatTag))
|
||||||
{
|
{
|
||||||
@ -122,7 +126,6 @@ namespace GameRes
|
|||||||
var embedded = AudioFormat.Read (bin);
|
var embedded = AudioFormat.Read (bin);
|
||||||
if (null != embedded)
|
if (null != embedded)
|
||||||
{
|
{
|
||||||
// sound.Dispose();
|
|
||||||
sound = embedded;
|
sound = embedded;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user