mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-24 20:04:13 +08:00
(IndexReader): refined compressed entries detection.
This commit is contained in:
parent
d63bb19338
commit
b91fdeddf1
@ -460,11 +460,7 @@ namespace GameRes.Formats.Lucifen
|
|||||||
if (name_length < 1)
|
if (name_length < 1)
|
||||||
throw new InvalidFormatException ("Invalid LPK entry name");
|
throw new InvalidFormatException ("Invalid LPK entry name");
|
||||||
string name = Encodings.cp932.GetString (m_name, 0, name_length);
|
string name = Encodings.cp932.GetString (m_name, 0, name_length);
|
||||||
var entry = new LuciEntry {
|
var entry = FormatCatalog.Instance.Create<LuciEntry> (name);
|
||||||
Name = name,
|
|
||||||
Type = FormatCatalog.Instance.GetTypeFromName (name),
|
|
||||||
IsPacked = m_info.PackedEntries,
|
|
||||||
};
|
|
||||||
int entry_pos = m_entries_offset + EntrySize * entry_num;
|
int entry_pos = m_entries_offset + EntrySize * entry_num;
|
||||||
if (entry_pos+EntrySize > m_index.Length)
|
if (entry_pos+EntrySize > m_index.Length)
|
||||||
throw new InvalidFormatException ("Invalid LPK entry index");
|
throw new InvalidFormatException ("Invalid LPK entry index");
|
||||||
@ -473,10 +469,14 @@ namespace GameRes.Formats.Lucifen
|
|||||||
long offset = LittleEndian.ToUInt32 (m_index, entry_pos);
|
long offset = LittleEndian.ToUInt32 (m_index, entry_pos);
|
||||||
entry.Offset = m_info.AlignedOffset ? offset << 11 : offset;
|
entry.Offset = m_info.AlignedOffset ? offset << 11 : offset;
|
||||||
entry.Size = LittleEndian.ToUInt32 (m_index, entry_pos+4);
|
entry.Size = LittleEndian.ToUInt32 (m_index, entry_pos+4);
|
||||||
if (entry.IsPacked)
|
entry.UnpackedSize = entry.Size;
|
||||||
entry.UnpackedSize = LittleEndian.ToUInt32 (m_index, entry_pos+8);
|
if (m_info.PackedEntries)
|
||||||
else
|
{
|
||||||
entry.UnpackedSize = entry.Size;
|
uint unpacked_size = LittleEndian.ToUInt32 (m_index, entry_pos+8);
|
||||||
|
entry.IsPacked = unpacked_size != 0;
|
||||||
|
if (entry.IsPacked)
|
||||||
|
entry.UnpackedSize = unpacked_size;
|
||||||
|
}
|
||||||
m_dir.Add (entry);
|
m_dir.Add (entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user