mirror of
https://github.com/crskycode/GARbro.git
synced 2025-01-12 04:49:32 +08:00
(XoredStream): limit write buffer to 80k.
This commit is contained in:
parent
7f3d2dfdfb
commit
838abb8773
@ -563,13 +563,19 @@ namespace GameRes.Formats
|
|||||||
|
|
||||||
public override void Write (byte[] buffer, int offset, int count)
|
public override void Write (byte[] buffer, int offset, int count)
|
||||||
{
|
{
|
||||||
if (null == write_buf || write_buf.Length < count)
|
if (null == write_buf)
|
||||||
write_buf = new byte[count];
|
write_buf = new byte[81920];
|
||||||
for (int i = 0; i < count; ++i)
|
while (count > 0)
|
||||||
|
{
|
||||||
|
int chunk = Math.Min (write_buf.Length, count);
|
||||||
|
for (int i = 0; i < chunk; ++i)
|
||||||
{
|
{
|
||||||
write_buf[i] = (byte)(buffer[offset+i] ^ m_key);
|
write_buf[i] = (byte)(buffer[offset+i] ^ m_key);
|
||||||
}
|
}
|
||||||
BaseStream.Write (write_buf, 0, count);
|
BaseStream.Write (write_buf, 0, count);
|
||||||
|
offset += chunk;
|
||||||
|
count -= chunk;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void WriteByte (byte value)
|
public override void WriteByte (byte value)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user