mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-24 20:04:13 +08:00
(MP3): added threshold for searching sync byte.
This commit is contained in:
parent
5990e6603f
commit
f435bf7349
@ -94,6 +94,8 @@ namespace GameRes.Formats
|
|||||||
public override uint Signature { get { return 0; } }
|
public override uint Signature { get { return 0; } }
|
||||||
public override bool CanWrite { get { return false; } }
|
public override bool CanWrite { get { return false; } }
|
||||||
|
|
||||||
|
const int SyncSearchThreshold = 0x280;
|
||||||
|
|
||||||
public override SoundInput TryOpen (IBinaryStream file)
|
public override SoundInput TryOpen (IBinaryStream file)
|
||||||
{
|
{
|
||||||
var header = file.ReadHeader (10).ToArray();
|
var header = file.ReadHeader (10).ToArray();
|
||||||
@ -108,8 +110,8 @@ namespace GameRes.Formats
|
|||||||
else if (0xFF != header[0])
|
else if (0xFF != header[0])
|
||||||
{
|
{
|
||||||
file.Position = 1;
|
file.Position = 1;
|
||||||
header = file.ReadBytes (0x100);
|
header = file.ReadBytes (SyncSearchThreshold);
|
||||||
sync_pos = System.Array.IndexOf<byte> (header, 0xFF, 1, 0xFC);
|
sync_pos = System.Array.IndexOf<byte> (header, 0xFF, 1, SyncSearchThreshold-4);
|
||||||
if (-1 == sync_pos)
|
if (-1 == sync_pos)
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user