mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-08 01:30:18 +08:00
use IBinaryStream interface instead of BinaryReader where appropriate.
This commit is contained in:
@@ -164,33 +164,32 @@ namespace GameRes.Formats.RealLive
|
||||
tiles.Add (tile);
|
||||
m_input.Seek (0x10, SeekOrigin.Current);
|
||||
}
|
||||
using (var input = new MemoryStream (LzDecompress (m_input, 2, 1)))
|
||||
using (var reader = new BinaryReader (input))
|
||||
using (var input = new BinMemoryStream (LzDecompress (m_input, 2, 1)))
|
||||
{
|
||||
if (reader.ReadInt32() != tile_count)
|
||||
if (input.ReadInt32() != tile_count)
|
||||
throw new InvalidFormatException();
|
||||
int dst_stride = m_width * 4;
|
||||
m_output = new byte[m_height * dst_stride];
|
||||
for (int i = 0; i < tile_count; ++i)
|
||||
{
|
||||
tiles[i].Offset = reader.ReadUInt32();
|
||||
tiles[i].Length = reader.ReadInt32();
|
||||
tiles[i].Offset = input.ReadUInt32();
|
||||
tiles[i].Length = input.ReadInt32();
|
||||
}
|
||||
var tile = tiles.First (t => t.Length != 0);
|
||||
|
||||
input.Position = tile.Offset;
|
||||
int tile_type = reader.ReadUInt16();
|
||||
int count = reader.ReadUInt16();
|
||||
int tile_type = input.ReadUInt16();
|
||||
int count = input.ReadUInt16();
|
||||
if (tile_type != 1)
|
||||
throw new InvalidFormatException();
|
||||
input.Seek (0x70, SeekOrigin.Current);
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
int tile_x = reader.ReadUInt16();
|
||||
int tile_y = reader.ReadUInt16();
|
||||
reader.ReadInt16();
|
||||
int tile_width = reader.ReadUInt16();
|
||||
int tile_height = reader.ReadUInt16();
|
||||
int tile_x = input.ReadUInt16();
|
||||
int tile_y = input.ReadUInt16();
|
||||
input.ReadInt16();
|
||||
int tile_width = input.ReadUInt16();
|
||||
int tile_height = input.ReadUInt16();
|
||||
input.Seek (0x52, SeekOrigin.Current);
|
||||
|
||||
tile_x += tile.X;
|
||||
@@ -201,7 +200,7 @@ namespace GameRes.Formats.RealLive
|
||||
int tile_stride = tile_width * 4;
|
||||
for (int row = 0; row < tile_height; ++row)
|
||||
{
|
||||
reader.Read (m_output, dst, tile_stride);
|
||||
input.Read (m_output, dst, tile_stride);
|
||||
dst += dst_stride;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user