mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-23 19:34:15 +08:00
use ArcView.Frame.AsciiEqual for sanity check.
This commit is contained in:
parent
e2773d437e
commit
e90643d71d
@ -68,13 +68,10 @@ namespace GameRes.Formats.Majiro
|
|||||||
|
|
||||||
public override ArcFile TryOpen (ArcView file)
|
public override ArcFile TryOpen (ArcView file)
|
||||||
{
|
{
|
||||||
byte[] header = new byte[16];
|
|
||||||
file.View.Read (0, header, 0, 16);
|
|
||||||
var char_header = header.Select (b => Convert.ToChar (b));
|
|
||||||
int version;
|
int version;
|
||||||
if (char_header.SequenceEqual ("MajiroArcV1.000\0"))
|
if (file.View.AsciiEqual (0, "MajiroArcV1.000\0"))
|
||||||
version = 1;
|
version = 1;
|
||||||
// else if (char_header.SequenceEqual ("MajiroArcV2.000\0"))
|
// else if (file.View.AsciiEqual (0, "MajiroArcV2.000\0"))
|
||||||
// version = 2;
|
// version = 2;
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
@ -88,12 +85,13 @@ namespace GameRes.Formats.Majiro
|
|||||||
table_size *= 4 * (version+1);
|
table_size *= 4 * (version+1);
|
||||||
if (table_size + 0x1c != names_offset)
|
if (table_size + 0x1c != names_offset)
|
||||||
return null;
|
return null;
|
||||||
|
if (data_offset != file.View.Reserve (0, data_offset))
|
||||||
|
return null;
|
||||||
int names_size = (int)(data_offset - names_offset);
|
int names_size = (int)(data_offset - names_offset);
|
||||||
var names = new byte[names_size];
|
var names = new byte[names_size];
|
||||||
file.View.Read (names_offset, names, 0, (uint)names_size);
|
file.View.Read (names_offset, names, 0, (uint)names_size);
|
||||||
int names_pos = 0;
|
int names_pos = 0;
|
||||||
uint table_pos = 0x1c;
|
uint table_pos = 0x1c;
|
||||||
file.View.Reserve (0, data_offset);
|
|
||||||
uint offset_next = file.View.ReadUInt32 (table_pos+4);
|
uint offset_next = file.View.ReadUInt32 (table_pos+4);
|
||||||
|
|
||||||
var dir = new List<Entry> (count);
|
var dir = new List<Entry> (count);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user