mirror of
https://github.com/lifegpc/GARbro.git
synced 2026-06-06 05:28:49 +08:00
IBinaryStream migration.
This commit is contained in:
@@ -188,7 +188,7 @@ namespace GameRes.Formats.Aoi
|
||||
{
|
||||
data[i] ^= KeyFromOffset (offset++);
|
||||
}
|
||||
return new MemoryStream (data);
|
||||
return new BinMemoryStream (data, entry.Name);
|
||||
}
|
||||
|
||||
static byte KeyFromOffset (uint offset)
|
||||
|
||||
@@ -36,14 +36,12 @@ namespace GameRes.Formats.Aoi
|
||||
public override string Description { get { return "Aoi engine audio format"; } }
|
||||
public override uint Signature { get { return 0x4F696F41; } } // 'AoiO'
|
||||
|
||||
public override SoundInput TryOpen (Stream file)
|
||||
public override SoundInput TryOpen (IBinaryStream file)
|
||||
{
|
||||
var header = new byte[0x30];
|
||||
if (header.Length != file.Read (header, 0, header.Length))
|
||||
var header = file.ReadHeader (0x30);
|
||||
if (!header.AsciiEqual (0, "AoiOgg") || !header.AsciiEqual (0x2C, "OggS"))
|
||||
return null;
|
||||
if (!Binary.AsciiEqual (header, 0, "AoiOgg") || !Binary.AsciiEqual (header, 0x2C, "OggS"))
|
||||
return null;
|
||||
var ogg = new StreamRegion (file, 0x2C);
|
||||
var ogg = new StreamRegion (file.AsStream, 0x2C);
|
||||
return new OggInput (ogg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace GameRes.Formats.Aoi
|
||||
|
||||
case 5:
|
||||
count = (count >> 8) & 0xFF;
|
||||
input.BaseStream.Seek ((count - count / 4) * 4, SeekOrigin.Current);
|
||||
input.Seek ((count - count / 4) * 4, SeekOrigin.Current);
|
||||
count *= 4;
|
||||
break;
|
||||
|
||||
@@ -134,9 +134,9 @@ namespace GameRes.Formats.Aoi
|
||||
var base_name = ReadBaseName (input, meta);
|
||||
if (VFS.FileExists (base_name))
|
||||
{
|
||||
using (var base_file = VFS.OpenSeekableStream (base_name))
|
||||
using (var base_file = VFS.OpenBinaryStream (base_name))
|
||||
{
|
||||
var base_image = Read (base_name, base_file);
|
||||
var base_image = Read (base_file);
|
||||
BlendImage (meta, pixels, base_image.Bitmap);
|
||||
}
|
||||
}
|
||||
@@ -152,13 +152,13 @@ namespace GameRes.Formats.Aoi
|
||||
|
||||
string ReadBaseName (IBinaryStream input, AgfMetaData info)
|
||||
{
|
||||
input.BaseStream.Position = info.DataOffset + info.BaseNameOffset;
|
||||
input.Position = info.DataOffset + info.BaseNameOffset;
|
||||
using (var reader = new BinaryReader (input.AsStream, Encoding.Unicode, true))
|
||||
{
|
||||
var name = new StringBuilder();
|
||||
for (;;)
|
||||
{
|
||||
char c = input.ReadChar();
|
||||
char c = reader.ReadChar();
|
||||
if (0 == c)
|
||||
break;
|
||||
name.Append (c);
|
||||
|
||||
Reference in New Issue
Block a user