mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-30 17:05:37 +08:00
(DifFormat): throw exceptions on base image failures.
This commit is contained in:
parent
0a2b1f1583
commit
407947c978
@ -77,7 +77,7 @@ namespace GameRes.Formats.MnoViolet
|
|||||||
return null;
|
return null;
|
||||||
var files = VFS.GetFiles (base_name+".*");
|
var files = VFS.GetFiles (base_name+".*");
|
||||||
if (!files.Any())
|
if (!files.Any())
|
||||||
return null;
|
throw new FileNotFoundException (string.Format ("Base image '{0}' not found"), base_name);
|
||||||
var base_entry = files.First();
|
var base_entry = files.First();
|
||||||
using (var input = VFS.OpenSeekableStream (base_entry))
|
using (var input = VFS.OpenSeekableStream (base_entry))
|
||||||
{
|
{
|
||||||
@ -85,7 +85,7 @@ namespace GameRes.Formats.MnoViolet
|
|||||||
// prevented here unless we save state in a static member.
|
// prevented here unless we save state in a static member.
|
||||||
var format = ImageFormat.FindFormat (input, base_entry.Name);
|
var format = ImageFormat.FindFormat (input, base_entry.Name);
|
||||||
if (null == format)
|
if (null == format)
|
||||||
return null;
|
throw new InvalidFormatException (string.Format ("Unable to interpret base image '{0}'", base_name));
|
||||||
format.Item2.FileName = base_entry.Name;
|
format.Item2.FileName = base_entry.Name;
|
||||||
return new DifMetaData
|
return new DifMetaData
|
||||||
{
|
{
|
||||||
@ -122,7 +122,7 @@ namespace GameRes.Formats.MnoViolet
|
|||||||
if (base_bitmap.Format.BitsPerPixel != 24)
|
if (base_bitmap.Format.BitsPerPixel != 24)
|
||||||
base_bitmap = new FormatConvertedBitmap (base_bitmap, PixelFormats.Bgr24, null, 0);
|
base_bitmap = new FormatConvertedBitmap (base_bitmap, PixelFormats.Bgr24, null, 0);
|
||||||
|
|
||||||
int src_stride = base_bitmap.PixelWidth * 3;
|
int src_stride = base_bitmap.PixelWidth * 3; // XXX
|
||||||
int dst_stride = (src_stride + 3) & ~3;
|
int dst_stride = (src_stride + 3) & ~3;
|
||||||
var pixels = new byte[dst_stride * base_bitmap.PixelHeight];
|
var pixels = new byte[dst_stride * base_bitmap.PixelHeight];
|
||||||
int row_offset = 0;
|
int row_offset = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user