mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-26 23:24:00 +08:00
(RCT): use ReadHeader method.
This commit is contained in:
parent
77c76bbc2a
commit
a0beff18a3
@ -87,24 +87,22 @@ namespace GameRes.Formats.Majiro
|
|||||||
|
|
||||||
public override ImageMetaData ReadMetaData (IBinaryStream stream)
|
public override ImageMetaData ReadMetaData (IBinaryStream stream)
|
||||||
{
|
{
|
||||||
stream.Position = 4;
|
var header = stream.ReadHeader (0x14);
|
||||||
int id = stream.ReadByte();
|
if (header[4] != 'T')
|
||||||
if (0x54 != id)
|
|
||||||
return null;
|
return null;
|
||||||
int encryption = stream.ReadByte();
|
int encryption = header[5];
|
||||||
if (encryption != 0x43 && encryption != 0x53)
|
if (encryption != 'C' && encryption != 'S')
|
||||||
return null;
|
return null;
|
||||||
bool is_encrypted = 0x53 == encryption;
|
bool is_encrypted = 'S' == encryption;
|
||||||
int version = stream.ReadByte();
|
if (header[6] != '0')
|
||||||
if (0x30 != version)
|
|
||||||
return null;
|
return null;
|
||||||
version = stream.ReadByte() - 0x30;
|
int version = header[7] - '0';
|
||||||
if (version != 0 && version != 1)
|
if (version != 0 && version != 1)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
uint width = stream.ReadUInt32();
|
uint width = header.ToUInt32 (8);
|
||||||
uint height = stream.ReadUInt32();
|
uint height = header.ToUInt32 (12);
|
||||||
int data_size = stream.ReadInt32();
|
int data_size = header.ToInt32 (16);
|
||||||
int additional_size = 0;
|
int additional_size = 0;
|
||||||
if (1 == version)
|
if (1 == version)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user