mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-27 07:34:00 +08:00
(S25): pick first non-null frame as default.
This commit is contained in:
parent
95e1dd97a6
commit
4a2f867353
@ -2,7 +2,7 @@
|
|||||||
//! \date Sat Apr 18 17:00:54 2015
|
//! \date Sat Apr 18 17:00:54 2015
|
||||||
//! \brief ShiinaRio S25 multi-image format.
|
//! \brief ShiinaRio S25 multi-image format.
|
||||||
//
|
//
|
||||||
// Copyright (C) 2015 by morkt
|
// Copyright (C) 2015-2016 by morkt
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to
|
// of this software and associated documentation files (the "Software"), to
|
||||||
@ -58,7 +58,9 @@ namespace GameRes.Formats.ShiinaRio
|
|||||||
int count = input.ReadInt32();
|
int count = input.ReadInt32();
|
||||||
if (count < 0 || count > 0xfffff)
|
if (count < 0 || count > 0xfffff)
|
||||||
return null;
|
return null;
|
||||||
uint first_offset = input.ReadUInt32();
|
uint first_offset = 0;
|
||||||
|
for (int i = 0; i < count && 0 == first_offset; ++i)
|
||||||
|
first_offset = input.ReadUInt32();
|
||||||
if (0 == first_offset)
|
if (0 == first_offset)
|
||||||
return null;
|
return null;
|
||||||
input.BaseStream.Position = first_offset;
|
input.BaseStream.Position = first_offset;
|
||||||
@ -76,11 +78,7 @@ namespace GameRes.Formats.ShiinaRio
|
|||||||
|
|
||||||
public override ImageData Read (Stream stream, ImageMetaData info)
|
public override ImageData Read (Stream stream, ImageMetaData info)
|
||||||
{
|
{
|
||||||
var meta = info as S25MetaData;
|
using (var reader = new Reader (stream, (S25MetaData)info))
|
||||||
if (null == meta)
|
|
||||||
throw new ArgumentException ("S25Format.Read should be supplied with S25MetaData", "info");
|
|
||||||
|
|
||||||
using (var reader = new Reader (stream, meta))
|
|
||||||
{
|
{
|
||||||
var pixels = reader.Unpack();
|
var pixels = reader.Unpack();
|
||||||
return ImageData.Create (info, PixelFormats.Bgra32, null, pixels);
|
return ImageData.Create (info, PixelFormats.Bgra32, null, pixels);
|
||||||
|
Loading…
Reference in New Issue
Block a user