mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-24 20:04:13 +08:00
Revert "cosmetic changes."
This reverts commit 06e651d43b8c8008171ca377628d2d96dc84857f.
This commit is contained in:
parent
06e651d43b
commit
c5982da278
@ -294,13 +294,12 @@ namespace GameRes.Formats
|
|||||||
return packed_size;
|
return packed_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static readonly GrpFormat s_grp_format = FormatCatalog.Instance.ImageFormats.OfType<GrpFormat>().FirstOrDefault();
|
|
||||||
|
|
||||||
uint WriteImageEntry (PackedEntry entry, Stream input, Stream output)
|
uint WriteImageEntry (PackedEntry entry, Stream input, Stream output)
|
||||||
{
|
{
|
||||||
if (null == s_grp_format) // probably never happens
|
var grp = FormatCatalog.Instance.ImageFormats.OfType<GrpFormat>().FirstOrDefault();
|
||||||
|
if (null == grp) // probably never happens
|
||||||
throw new FileFormatException ("GRP image encoder not available");
|
throw new FileFormatException ("GRP image encoder not available");
|
||||||
bool is_grp = s_grp_format.Signature == FormatCatalog.ReadSignature (input);
|
bool is_grp = grp.Signature == FormatCatalog.ReadSignature (input);
|
||||||
input.Position = 0;
|
input.Position = 0;
|
||||||
using (var zstream = new ZLibStream (output, CompressionMode.Compress, CompressionLevel.Level9, true))
|
using (var zstream = new ZLibStream (output, CompressionMode.Compress, CompressionLevel.Level9, true))
|
||||||
{
|
{
|
||||||
@ -313,7 +312,7 @@ namespace GameRes.Formats
|
|||||||
var image = ImageFormat.Read (input);
|
var image = ImageFormat.Read (input);
|
||||||
if (null == image)
|
if (null == image)
|
||||||
throw new InvalidFormatException (string.Format (arcStrings.MsgInvalidImageFormat, entry.Name));
|
throw new InvalidFormatException (string.Format (arcStrings.MsgInvalidImageFormat, entry.Name));
|
||||||
s_grp_format.Write (zstream, image);
|
grp.Write (zstream, image);
|
||||||
entry.UnpackedSize = (uint)zstream.TotalIn;
|
entry.UnpackedSize = (uint)zstream.TotalIn;
|
||||||
}
|
}
|
||||||
zstream.Flush();
|
zstream.Flush();
|
||||||
|
@ -174,15 +174,12 @@ namespace GameRes.Formats.Kogado
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
string name = Path.GetFileNameWithoutExtension (entry.Name);
|
string name = Path.GetFileNameWithoutExtension (entry.Name);
|
||||||
string ext = Path.GetExtension (entry.Name);
|
string ext = Path.GetExtension (entry.Name).TrimStart ('.').ToLowerInvariant();
|
||||||
byte[] name_buf = new byte[0x15];
|
byte[] name_buf = new byte[0x15];
|
||||||
byte[] ext_buf = new byte[3];
|
byte[] ext_buf = new byte[3];
|
||||||
encoding.GetBytes (name, 0, name.Length, name_buf, 0);
|
encoding.GetBytes (name, 0, name.Length, name_buf, 0);
|
||||||
if (!string.IsNullOrEmpty (ext))
|
if (!string.IsNullOrEmpty (ext))
|
||||||
{
|
|
||||||
ext = ext.TrimStart ('.').ToLowerInvariant();
|
|
||||||
encoding.GetBytes (ext, 0, ext.Length, ext_buf, 0);
|
encoding.GetBytes (ext, 0, ext.Length, ext_buf, 0);
|
||||||
}
|
|
||||||
var out_entry = new OutputEntry
|
var out_entry = new OutputEntry
|
||||||
{
|
{
|
||||||
Name = entry.Name,
|
Name = entry.Name,
|
||||||
|
@ -594,9 +594,9 @@ namespace GameRes.Formats.NitroPlus
|
|||||||
private bool m_read_mode;
|
private bool m_read_mode;
|
||||||
private long m_base_pos;
|
private long m_base_pos;
|
||||||
|
|
||||||
public override bool CanRead { get { return m_read_mode && m_stream.CanRead; } }
|
public override bool CanRead { get { return m_read_mode; } }
|
||||||
public override bool CanSeek { get { return m_stream.CanSeek; } }
|
public override bool CanSeek { get { return m_stream.CanSeek; } }
|
||||||
public override bool CanWrite { get { return !m_read_mode && m_stream.CanWrite; } }
|
public override bool CanWrite { get { return !m_read_mode; } }
|
||||||
public override long Length { get { return m_stream.Length - m_base_pos; } }
|
public override long Length { get { return m_stream.Length - m_base_pos; } }
|
||||||
public override long Position
|
public override long Position
|
||||||
{
|
{
|
||||||
|
@ -104,7 +104,7 @@ namespace GameRes.Formats.KiriKiri
|
|||||||
return null;
|
return null;
|
||||||
dir_offset = file.View.ReadInt64 (0x20);
|
dir_offset = file.View.ReadInt64 (0x20);
|
||||||
}
|
}
|
||||||
if (dir_offset < 0x13 || dir_offset >= file.MaxOffset)
|
if (dir_offset >= file.MaxOffset)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
int header_type = file.View.ReadByte (dir_offset);
|
int header_type = file.View.ReadByte (dir_offset);
|
||||||
@ -588,7 +588,7 @@ NextEntry:
|
|||||||
long m_offset = 0;
|
long m_offset = 0;
|
||||||
bool m_eof = false;
|
bool m_eof = false;
|
||||||
|
|
||||||
public override bool CanRead { get { return m_stream != null; } }
|
public override bool CanRead { get { return true; } }
|
||||||
public override bool CanSeek { get { return false; } }
|
public override bool CanSeek { get { return false; } }
|
||||||
public override bool CanWrite { get { return false; } }
|
public override bool CanWrite { get { return false; } }
|
||||||
public override long Length { get { return m_entry.UnpackedSize; } }
|
public override long Length { get { return m_entry.UnpackedSize; } }
|
||||||
@ -616,9 +616,11 @@ NextEntry:
|
|||||||
if (null != m_stream)
|
if (null != m_stream)
|
||||||
m_stream.Dispose();
|
m_stream.Dispose();
|
||||||
var segment = m_segment.Current;
|
var segment = m_segment.Current;
|
||||||
m_stream = m_file.CreateStream (segment.Offset, segment.Size);
|
|
||||||
if (segment.IsCompressed)
|
if (segment.IsCompressed)
|
||||||
m_stream = new ZLibStream (m_stream, CompressionMode.Decompress);
|
m_stream = new ZLibStream (m_file.CreateStream (segment.Offset, segment.PackedSize),
|
||||||
|
CompressionMode.Decompress);
|
||||||
|
else
|
||||||
|
m_stream = m_file.CreateStream (segment.Offset, segment.Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int Read (byte[] buffer, int offset, int count)
|
public override int Read (byte[] buffer, int offset, int count)
|
||||||
|
@ -222,7 +222,7 @@ namespace GameRes.Formats.YuRis
|
|||||||
writer.Write (name_len);
|
writer.Write (name_len);
|
||||||
writer.Write (entry.IndexName);
|
writer.Write (entry.IndexName);
|
||||||
writer.Write (entry.FileType);
|
writer.Write (entry.FileType);
|
||||||
writer.Write (entry.IsPacked);
|
writer.Write ((byte)(entry.IsPacked ? 1 : 0));
|
||||||
writer.Write (entry.UnpackedSize);
|
writer.Write (entry.UnpackedSize);
|
||||||
writer.Write (entry.Size);
|
writer.Write (entry.Size);
|
||||||
writer.Write ((uint)entry.Offset);
|
writer.Write ((uint)entry.Offset);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user