mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-25 04:14:13 +08:00
(AImageHeader): don't require input stream to be seekable.
This commit is contained in:
parent
b99f0c7029
commit
fa972916c3
@ -213,8 +213,7 @@ namespace GameRes.Formats.Cyberworks
|
|||||||
int id = input.ReadByte();
|
int id = input.ReadByte();
|
||||||
if (id == scheme.Value2)
|
if (id == scheme.Value2)
|
||||||
{
|
{
|
||||||
using (var seekable = new SeekableStream (input))
|
using (var reader = new AImageReader (input, scheme))
|
||||||
using (var reader = new AImageReader (seekable, scheme))
|
|
||||||
{
|
{
|
||||||
reader.Unpack();
|
reader.Unpack();
|
||||||
return TgaStream.Create (reader.Info, reader.Data, scheme.Flipped);
|
return TgaStream.Create (reader.Info, reader.Data, scheme.Flipped);
|
||||||
|
@ -116,12 +116,13 @@ namespace GameRes.Formats.Cyberworks
|
|||||||
if (src_stride * (int)Info.Height != data_size)
|
if (src_stride * (int)Info.Height != data_size)
|
||||||
throw new InvalidFormatException();
|
throw new InvalidFormatException();
|
||||||
m_output = new byte[dst_stride * (int)Info.Height];
|
m_output = new byte[dst_stride * (int)Info.Height];
|
||||||
|
var gap = new byte[src_stride-dst_stride];
|
||||||
int dst = 0;
|
int dst = 0;
|
||||||
for (uint y = 0; y < Info.Height; ++y)
|
for (uint y = 0; y < Info.Height; ++y)
|
||||||
{
|
{
|
||||||
m_input.Read (m_output, dst, dst_stride);
|
m_input.Read (m_output, dst, dst_stride);
|
||||||
|
m_input.Read (gap, 0, gap.Length);
|
||||||
dst += dst_stride;
|
dst += dst_stride;
|
||||||
m_input.BaseStream.Seek (src_stride-dst_stride, SeekOrigin.Current);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user